IxQMgrInit.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. * SPDX-License-Identifier: BSD-3-Clause
  21. * @par
  22. * -- End of Copyright Notice --
  23. */
  24. /*
  25. * System defined include files.
  26. */
  27. /*
  28. * User defined include files.
  29. */
  30. #include "IxOsal.h"
  31. #include "IxQMgr.h"
  32. #include "IxQMgrQCfg_p.h"
  33. #include "IxQMgrDispatcher_p.h"
  34. #include "IxQMgrLog_p.h"
  35. #include "IxQMgrQAccess_p.h"
  36. #include "IxQMgrDefines_p.h"
  37. #include "IxQMgrAqmIf_p.h"
  38. /*
  39. * Set to true if initialized
  40. * N.B. global so integration/unit tests can reinitialize
  41. */
  42. BOOL qMgrIsInitialized = false;
  43. /*
  44. * Function definitions.
  45. */
  46. IX_STATUS
  47. ixQMgrInit (void)
  48. {
  49. if (qMgrIsInitialized)
  50. {
  51. IX_QMGR_LOG0("ixQMgrInit: IxQMgr already initialised\n");
  52. return IX_FAIL;
  53. }
  54. /* Initialise the QCfg component */
  55. ixQMgrQCfgInit ();
  56. /* Initialise the Dispatcher component */
  57. ixQMgrDispatcherInit ();
  58. /* Initialise the Access component */
  59. ixQMgrQAccessInit ();
  60. /* Initialization complete */
  61. qMgrIsInitialized = true;
  62. return IX_SUCCESS;
  63. }
  64. IX_STATUS
  65. ixQMgrUnload (void)
  66. {
  67. if (!qMgrIsInitialized)
  68. {
  69. return IX_FAIL;
  70. }
  71. /* Uninitialise the QCfg component */
  72. ixQMgrQCfgUninit ();
  73. /* Uninitialization complete */
  74. qMgrIsInitialized = false;
  75. return IX_SUCCESS;
  76. }
  77. void
  78. ixQMgrShow (void)
  79. {
  80. IxQMgrQCfgStats *qCfgStats = NULL;
  81. IxQMgrDispatcherStats *dispatcherStats = NULL;
  82. int i;
  83. UINT32 lowIntRegRead, upIntRegRead;
  84. qCfgStats = ixQMgrQCfgStatsGet ();
  85. dispatcherStats = ixQMgrDispatcherStatsGet ();
  86. ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUELOW_GROUP, &lowIntRegRead);
  87. ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUEUPP_GROUP, &upIntRegRead);
  88. printf("Generic Stats........\n");
  89. printf("=====================\n");
  90. printf("Loop Run Count..........%u\n",dispatcherStats->loopRunCnt);
  91. printf("Watermark set count.....%d\n", qCfgStats->wmSetCnt);
  92. printf("===========================================\n");
  93. printf("On the fly Interrupt Register Stats........\n");
  94. printf("===========================================\n");
  95. printf("Lower Interrupt Register............0x%08x\n",lowIntRegRead);
  96. printf("Upper Interrupt Register............0x%08x\n",upIntRegRead);
  97. printf("==============================================\n");
  98. printf("Queue Specific Stats........\n");
  99. printf("============================\n");
  100. for (i=0; i<IX_QMGR_MAX_NUM_QUEUES; i++)
  101. {
  102. if (ixQMgrQIsConfigured(i))
  103. {
  104. ixQMgrQShow(i);
  105. }
  106. }
  107. printf("============================\n");
  108. }
  109. IX_STATUS
  110. ixQMgrQShow (IxQMgrQId qId)
  111. {
  112. IxQMgrQCfgStats *qCfgStats = NULL;
  113. IxQMgrDispatcherStats *dispatcherStats = NULL;
  114. if (!ixQMgrQIsConfigured(qId))
  115. {
  116. return IX_QMGR_Q_NOT_CONFIGURED;
  117. }
  118. dispatcherStats = ixQMgrDispatcherStatsGet ();
  119. qCfgStats = ixQMgrQCfgQStatsGet (qId);
  120. printf("QId %d\n", qId);
  121. printf("======\n");
  122. printf(" IxQMgrQCfg Stats\n");
  123. printf(" Name..................... \"%s\"\n", qCfgStats->qStats[qId].qName);
  124. printf(" Size in words............ %u\n", qCfgStats->qStats[qId].qSizeInWords);
  125. printf(" Entry size in words...... %u\n", qCfgStats->qStats[qId].qEntrySizeInWords);
  126. printf(" Nearly empty watermark... %u\n", qCfgStats->qStats[qId].ne);
  127. printf(" Nearly full watermark.... %u\n", qCfgStats->qStats[qId].nf);
  128. printf(" Number of full entries... %u\n", qCfgStats->qStats[qId].numEntries);
  129. printf(" Sram base address........ 0x%X\n", qCfgStats->qStats[qId].baseAddress);
  130. printf(" Read pointer............. 0x%X\n", qCfgStats->qStats[qId].readPtr);
  131. printf(" Write pointer............ 0x%X\n", qCfgStats->qStats[qId].writePtr);
  132. #ifndef NDEBUG
  133. if (dispatcherStats->queueStats[qId].notificationEnabled)
  134. {
  135. char *localEvent = "none ????";
  136. switch (dispatcherStats->queueStats[qId].srcSel)
  137. {
  138. case IX_QMGR_Q_SOURCE_ID_E:
  139. localEvent = "Empty";
  140. break;
  141. case IX_QMGR_Q_SOURCE_ID_NE:
  142. localEvent = "Nearly Empty";
  143. break;
  144. case IX_QMGR_Q_SOURCE_ID_NF:
  145. localEvent = "Nearly Full";
  146. break;
  147. case IX_QMGR_Q_SOURCE_ID_F:
  148. localEvent = "Full";
  149. break;
  150. case IX_QMGR_Q_SOURCE_ID_NOT_E:
  151. localEvent = "Not Empty";
  152. break;
  153. case IX_QMGR_Q_SOURCE_ID_NOT_NE:
  154. localEvent = "Not Nearly Empty";
  155. break;
  156. case IX_QMGR_Q_SOURCE_ID_NOT_NF:
  157. localEvent = "Not Nearly Full";
  158. break;
  159. case IX_QMGR_Q_SOURCE_ID_NOT_F:
  160. localEvent = "Not Full";
  161. break;
  162. default :
  163. break;
  164. }
  165. printf(" Notifications localEvent...... %s\n", localEvent);
  166. }
  167. else
  168. {
  169. printf(" Notifications............ not enabled\n");
  170. }
  171. printf(" IxQMgrDispatcher Stats\n");
  172. printf(" Callback count................%d\n",
  173. dispatcherStats->queueStats[qId].callbackCnt);
  174. printf(" Priority change count.........%d\n",
  175. dispatcherStats->queueStats[qId].priorityChangeCnt);
  176. printf(" Interrupt no callback count...%d\n",
  177. dispatcherStats->queueStats[qId].intNoCallbackCnt);
  178. printf(" Interrupt lost callback count...%d\n",
  179. dispatcherStats->queueStats[qId].intLostCallbackCnt);
  180. #endif
  181. return IX_SUCCESS;
  182. }