IxQMgrInit.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /**
  2. * @file IxQMgrInit.c
  3. *
  4. * @author Intel Corporation
  5. * @date 30-Oct-2001
  6. *
  7. * @brief: Provided initialization of the QMgr component and its subcomponents.
  8. *
  9. *
  10. * @par
  11. * IXP400 SW Release version 2.0
  12. *
  13. * -- Copyright Notice --
  14. *
  15. * @par
  16. * Copyright 2001-2005, Intel Corporation.
  17. * All rights reserved.
  18. *
  19. * @par
  20. * Redistribution and use in source and binary forms, with or without
  21. * modification, are permitted provided that the following conditions
  22. * are met:
  23. * 1. Redistributions of source code must retain the above copyright
  24. * notice, this list of conditions and the following disclaimer.
  25. * 2. Redistributions in binary form must reproduce the above copyright
  26. * notice, this list of conditions and the following disclaimer in the
  27. * documentation and/or other materials provided with the distribution.
  28. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  29. * may be used to endorse or promote products derived from this software
  30. * without specific prior written permission.
  31. *
  32. * @par
  33. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  34. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  35. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  36. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  37. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  38. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  39. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  40. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  41. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  42. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  43. * SUCH DAMAGE.
  44. *
  45. * @par
  46. * -- End of Copyright Notice --
  47. */
  48. /*
  49. * System defined include files.
  50. */
  51. /*
  52. * User defined include files.
  53. */
  54. #include "IxOsal.h"
  55. #include "IxQMgr.h"
  56. #include "IxQMgrQCfg_p.h"
  57. #include "IxQMgrDispatcher_p.h"
  58. #include "IxQMgrLog_p.h"
  59. #include "IxQMgrQAccess_p.h"
  60. #include "IxQMgrDefines_p.h"
  61. #include "IxQMgrAqmIf_p.h"
  62. /*
  63. * Set to true if initialized
  64. * N.B. global so integration/unit tests can reinitialize
  65. */
  66. BOOL qMgrIsInitialized = FALSE;
  67. /*
  68. * Function definitions.
  69. */
  70. IX_STATUS
  71. ixQMgrInit (void)
  72. {
  73. if (qMgrIsInitialized)
  74. {
  75. IX_QMGR_LOG0("ixQMgrInit: IxQMgr already initialised\n");
  76. return IX_FAIL;
  77. }
  78. /* Initialise the QCfg component */
  79. ixQMgrQCfgInit ();
  80. /* Initialise the Dispatcher component */
  81. ixQMgrDispatcherInit ();
  82. /* Initialise the Access component */
  83. ixQMgrQAccessInit ();
  84. /* Initialization complete */
  85. qMgrIsInitialized = TRUE;
  86. return IX_SUCCESS;
  87. }
  88. IX_STATUS
  89. ixQMgrUnload (void)
  90. {
  91. if (!qMgrIsInitialized)
  92. {
  93. return IX_FAIL;
  94. }
  95. /* Uninitialise the QCfg component */
  96. ixQMgrQCfgUninit ();
  97. /* Uninitialization complete */
  98. qMgrIsInitialized = FALSE;
  99. return IX_SUCCESS;
  100. }
  101. void
  102. ixQMgrShow (void)
  103. {
  104. IxQMgrQCfgStats *qCfgStats = NULL;
  105. IxQMgrDispatcherStats *dispatcherStats = NULL;
  106. int i;
  107. UINT32 lowIntRegRead, upIntRegRead;
  108. qCfgStats = ixQMgrQCfgStatsGet ();
  109. dispatcherStats = ixQMgrDispatcherStatsGet ();
  110. ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUELOW_GROUP, &lowIntRegRead);
  111. ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUEUPP_GROUP, &upIntRegRead);
  112. printf("Generic Stats........\n");
  113. printf("=====================\n");
  114. printf("Loop Run Count..........%u\n",dispatcherStats->loopRunCnt);
  115. printf("Watermark set count.....%d\n", qCfgStats->wmSetCnt);
  116. printf("===========================================\n");
  117. printf("On the fly Interrupt Register Stats........\n");
  118. printf("===========================================\n");
  119. printf("Lower Interrupt Register............0x%08x\n",lowIntRegRead);
  120. printf("Upper Interrupt Register............0x%08x\n",upIntRegRead);
  121. printf("==============================================\n");
  122. printf("Queue Specific Stats........\n");
  123. printf("============================\n");
  124. for (i=0; i<IX_QMGR_MAX_NUM_QUEUES; i++)
  125. {
  126. if (ixQMgrQIsConfigured(i))
  127. {
  128. ixQMgrQShow(i);
  129. }
  130. }
  131. printf("============================\n");
  132. }
  133. IX_STATUS
  134. ixQMgrQShow (IxQMgrQId qId)
  135. {
  136. IxQMgrQCfgStats *qCfgStats = NULL;
  137. IxQMgrDispatcherStats *dispatcherStats = NULL;
  138. if (!ixQMgrQIsConfigured(qId))
  139. {
  140. return IX_QMGR_Q_NOT_CONFIGURED;
  141. }
  142. dispatcherStats = ixQMgrDispatcherStatsGet ();
  143. qCfgStats = ixQMgrQCfgQStatsGet (qId);
  144. printf("QId %d\n", qId);
  145. printf("======\n");
  146. printf(" IxQMgrQCfg Stats\n");
  147. printf(" Name..................... \"%s\"\n", qCfgStats->qStats[qId].qName);
  148. printf(" Size in words............ %u\n", qCfgStats->qStats[qId].qSizeInWords);
  149. printf(" Entry size in words...... %u\n", qCfgStats->qStats[qId].qEntrySizeInWords);
  150. printf(" Nearly empty watermark... %u\n", qCfgStats->qStats[qId].ne);
  151. printf(" Nearly full watermark.... %u\n", qCfgStats->qStats[qId].nf);
  152. printf(" Number of full entries... %u\n", qCfgStats->qStats[qId].numEntries);
  153. printf(" Sram base address........ 0x%X\n", qCfgStats->qStats[qId].baseAddress);
  154. printf(" Read pointer............. 0x%X\n", qCfgStats->qStats[qId].readPtr);
  155. printf(" Write pointer............ 0x%X\n", qCfgStats->qStats[qId].writePtr);
  156. #ifndef NDEBUG
  157. if (dispatcherStats->queueStats[qId].notificationEnabled)
  158. {
  159. char *localEvent = "none ????";
  160. switch (dispatcherStats->queueStats[qId].srcSel)
  161. {
  162. case IX_QMGR_Q_SOURCE_ID_E:
  163. localEvent = "Empty";
  164. break;
  165. case IX_QMGR_Q_SOURCE_ID_NE:
  166. localEvent = "Nearly Empty";
  167. break;
  168. case IX_QMGR_Q_SOURCE_ID_NF:
  169. localEvent = "Nearly Full";
  170. break;
  171. case IX_QMGR_Q_SOURCE_ID_F:
  172. localEvent = "Full";
  173. break;
  174. case IX_QMGR_Q_SOURCE_ID_NOT_E:
  175. localEvent = "Not Empty";
  176. break;
  177. case IX_QMGR_Q_SOURCE_ID_NOT_NE:
  178. localEvent = "Not Nearly Empty";
  179. break;
  180. case IX_QMGR_Q_SOURCE_ID_NOT_NF:
  181. localEvent = "Not Nearly Full";
  182. break;
  183. case IX_QMGR_Q_SOURCE_ID_NOT_F:
  184. localEvent = "Not Full";
  185. break;
  186. default :
  187. break;
  188. }
  189. printf(" Notifications localEvent...... %s\n", localEvent);
  190. }
  191. else
  192. {
  193. printf(" Notifications............ not enabled\n");
  194. }
  195. printf(" IxQMgrDispatcher Stats\n");
  196. printf(" Callback count................%d\n",
  197. dispatcherStats->queueStats[qId].callbackCnt);
  198. printf(" Priority change count.........%d\n",
  199. dispatcherStats->queueStats[qId].priorityChangeCnt);
  200. printf(" Interrupt no callback count...%d\n",
  201. dispatcherStats->queueStats[qId].intNoCallbackCnt);
  202. printf(" Interrupt lost callback count...%d\n",
  203. dispatcherStats->queueStats[qId].intLostCallbackCnt);
  204. #endif
  205. return IX_SUCCESS;
  206. }