change console=tty0 to enable linux framebuffer console
[jz_uboot.git] / cpu / ixp / npe / IxQMgrInit.c
blobb00c22d08ea0c5e11920a011c0bb5c3c059644ee
1 /**
2 * @file IxQMgrInit.c
4 * @author Intel Corporation
5 * @date 30-Oct-2001
7 * @brief: Provided initialization of the QMgr component and its subcomponents.
9 *
10 * @par
11 * IXP400 SW Release version 2.0
13 * -- Copyright Notice --
15 * @par
16 * Copyright 2001-2005, Intel Corporation.
17 * All rights reserved.
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.
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.
45 * @par
46 * -- End of Copyright Notice --
50 * System defined include files.
54 * User defined include files.
56 #include "IxOsal.h"
57 #include "IxQMgr.h"
58 #include "IxQMgrQCfg_p.h"
59 #include "IxQMgrDispatcher_p.h"
60 #include "IxQMgrLog_p.h"
61 #include "IxQMgrQAccess_p.h"
62 #include "IxQMgrDefines_p.h"
63 #include "IxQMgrAqmIf_p.h"
66 * Set to true if initialized
67 * N.B. global so integration/unit tests can reinitialize
69 BOOL qMgrIsInitialized = FALSE;
72 * Function definitions.
74 IX_STATUS
75 ixQMgrInit (void)
77 if (qMgrIsInitialized)
79 IX_QMGR_LOG0("ixQMgrInit: IxQMgr already initialised\n");
80 return IX_FAIL;
83 /* Initialise the QCfg component */
84 ixQMgrQCfgInit ();
86 /* Initialise the Dispatcher component */
87 ixQMgrDispatcherInit ();
89 /* Initialise the Access component */
90 ixQMgrQAccessInit ();
92 /* Initialization complete */
93 qMgrIsInitialized = TRUE;
95 return IX_SUCCESS;
98 IX_STATUS
99 ixQMgrUnload (void)
101 if (!qMgrIsInitialized)
103 return IX_FAIL;
106 /* Uninitialise the QCfg component */
107 ixQMgrQCfgUninit ();
109 /* Uninitialization complete */
110 qMgrIsInitialized = FALSE;
112 return IX_SUCCESS;
115 void
116 ixQMgrShow (void)
118 IxQMgrQCfgStats *qCfgStats = NULL;
119 IxQMgrDispatcherStats *dispatcherStats = NULL;
120 int i;
121 UINT32 lowIntRegRead, upIntRegRead;
123 qCfgStats = ixQMgrQCfgStatsGet ();
124 dispatcherStats = ixQMgrDispatcherStatsGet ();
125 ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUELOW_GROUP, &lowIntRegRead);
126 ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUEUPP_GROUP, &upIntRegRead);
127 printf("Generic Stats........\n");
128 printf("=====================\n");
129 printf("Loop Run Count..........%u\n",dispatcherStats->loopRunCnt);
130 printf("Watermark set count.....%d\n", qCfgStats->wmSetCnt);
131 printf("===========================================\n");
132 printf("On the fly Interrupt Register Stats........\n");
133 printf("===========================================\n");
134 printf("Lower Interrupt Register............0x%08x\n",lowIntRegRead);
135 printf("Upper Interrupt Register............0x%08x\n",upIntRegRead);
136 printf("==============================================\n");
137 printf("Queue Specific Stats........\n");
138 printf("============================\n");
140 for (i=0; i<IX_QMGR_MAX_NUM_QUEUES; i++)
142 if (ixQMgrQIsConfigured(i))
144 ixQMgrQShow(i);
148 printf("============================\n");
151 IX_STATUS
152 ixQMgrQShow (IxQMgrQId qId)
154 IxQMgrQCfgStats *qCfgStats = NULL;
155 IxQMgrDispatcherStats *dispatcherStats = NULL;
157 if (!ixQMgrQIsConfigured(qId))
159 return IX_QMGR_Q_NOT_CONFIGURED;
162 dispatcherStats = ixQMgrDispatcherStatsGet ();
163 qCfgStats = ixQMgrQCfgQStatsGet (qId);
165 printf("QId %d\n", qId);
166 printf("======\n");
167 printf(" IxQMgrQCfg Stats\n");
168 printf(" Name..................... \"%s\"\n", qCfgStats->qStats[qId].qName);
169 printf(" Size in words............ %u\n", qCfgStats->qStats[qId].qSizeInWords);
170 printf(" Entry size in words...... %u\n", qCfgStats->qStats[qId].qEntrySizeInWords);
171 printf(" Nearly empty watermark... %u\n", qCfgStats->qStats[qId].ne);
172 printf(" Nearly full watermark.... %u\n", qCfgStats->qStats[qId].nf);
173 printf(" Number of full entries... %u\n", qCfgStats->qStats[qId].numEntries);
174 printf(" Sram base address........ 0x%X\n", qCfgStats->qStats[qId].baseAddress);
175 printf(" Read pointer............. 0x%X\n", qCfgStats->qStats[qId].readPtr);
176 printf(" Write pointer............ 0x%X\n", qCfgStats->qStats[qId].writePtr);
178 #ifndef NDEBUG
179 if (dispatcherStats->queueStats[qId].notificationEnabled)
181 char *localEvent = "none ????";
182 switch (dispatcherStats->queueStats[qId].srcSel)
184 case IX_QMGR_Q_SOURCE_ID_E:
185 localEvent = "Empty";
186 break;
187 case IX_QMGR_Q_SOURCE_ID_NE:
188 localEvent = "Nearly Empty";
189 break;
190 case IX_QMGR_Q_SOURCE_ID_NF:
191 localEvent = "Nearly Full";
192 break;
193 case IX_QMGR_Q_SOURCE_ID_F:
194 localEvent = "Full";
195 break;
196 case IX_QMGR_Q_SOURCE_ID_NOT_E:
197 localEvent = "Not Empty";
198 break;
199 case IX_QMGR_Q_SOURCE_ID_NOT_NE:
200 localEvent = "Not Nearly Empty";
201 break;
202 case IX_QMGR_Q_SOURCE_ID_NOT_NF:
203 localEvent = "Not Nearly Full";
204 break;
205 case IX_QMGR_Q_SOURCE_ID_NOT_F:
206 localEvent = "Not Full";
207 break;
208 default :
209 break;
211 printf(" Notifications localEvent...... %s\n", localEvent);
213 else
215 printf(" Notifications............ not enabled\n");
217 printf(" IxQMgrDispatcher Stats\n");
218 printf(" Callback count................%d\n",
219 dispatcherStats->queueStats[qId].callbackCnt);
220 printf(" Priority change count.........%d\n",
221 dispatcherStats->queueStats[qId].priorityChangeCnt);
222 printf(" Interrupt no callback count...%d\n",
223 dispatcherStats->queueStats[qId].intNoCallbackCnt);
224 printf(" Interrupt lost callback count...%d\n",
225 dispatcherStats->queueStats[qId].intLostCallbackCnt);
226 #endif
228 return IX_SUCCESS;