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