1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46#include <config.h>
47#include <common.h>
48#include "IxOsal.h"
49#include <IxEthAcc.h>
50#include <IxEthDB.h>
51#include <IxNpeDl.h>
52#include <IxQMgr.h>
53#include <IxNpeMh.h>
54
55static char *traceHeaders[] = {
56 "",
57 "[fatal] ",
58 "[error] ",
59 "[warning] ",
60 "[message] ",
61 "[debug1] ",
62 "[debug2] ",
63 "[debug3] ",
64 "[all]"
65};
66
67
68PRIVATE int ixOsalCurrLogLevel = IX_OSAL_LOG_LVL_MESSAGE;
69
70
71
72
73
74PUBLIC IX_STATUS
75ixOsalIrqBind (UINT32 vector, IxOsalVoidFnVoidPtr routine, void *parameter)
76{
77 return IX_FAIL;
78}
79
80PUBLIC IX_STATUS
81ixOsalIrqUnbind (UINT32 vector)
82{
83 return IX_FAIL;
84}
85
86PUBLIC UINT32
87ixOsalIrqLock ()
88{
89 return 0;
90}
91
92
93
94
95
96PUBLIC void
97ixOsalIrqUnlock (UINT32 lockKey)
98{
99}
100
101PUBLIC UINT32
102ixOsalIrqLevelSet (UINT32 level)
103{
104 return IX_FAIL;
105}
106
107PUBLIC void
108ixOsalIrqEnable (UINT32 irqLevel)
109{
110}
111
112PUBLIC void
113ixOsalIrqDisable (UINT32 irqLevel)
114{
115}
116
117
118
119
120
121INT32
122ixOsalLog (IxOsalLogLevel level,
123 IxOsalLogDevice device,
124 char *format, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6)
125{
126
127
128
129 if ((device != IX_OSAL_LOG_DEV_STDOUT)
130 && (device != IX_OSAL_LOG_DEV_STDERR))
131 {
132 debug("ixOsalLog: only IX_OSAL_LOG_DEV_STDOUT and IX_OSAL_LOG_DEV_STDERR are supported \n");
133 return (IX_OSAL_LOG_ERROR);
134 }
135
136 if (level <= ixOsalCurrLogLevel && level != IX_OSAL_LOG_LVL_NONE)
137 {
138#if 0
139 int headerByteCount = (level == IX_OSAL_LOG_LVL_USER) ? 0 : diag_printf(traceHeaders[level - 1]);
140
141 return headerByteCount + diag_printf (format, arg1, arg2, arg3, arg4, arg5, arg6);
142#else
143 int headerByteCount = (level == IX_OSAL_LOG_LVL_USER) ? 0 : strlen(traceHeaders[level - 1]);
144
145 return headerByteCount + strlen(format);
146#endif
147 }
148 else
149 {
150
151
152
153 return (IX_OSAL_LOG_ERROR);
154 }
155}
156
157PUBLIC UINT32
158ixOsalLogLevelSet (UINT32 level)
159{
160 UINT32 oldLevel;
161
162
163
164
165 if ((level < IX_OSAL_LOG_LVL_NONE) || (level > IX_OSAL_LOG_LVL_ALL))
166 {
167 ixOsalLog (IX_OSAL_LOG_LVL_MESSAGE,
168 IX_OSAL_LOG_DEV_STDOUT,
169 "ixOsalLogLevelSet: Log Level is between %d and%d \n",
170 IX_OSAL_LOG_LVL_NONE, IX_OSAL_LOG_LVL_ALL, 0, 0, 0, 0);
171 return IX_OSAL_LOG_LVL_NONE;
172 }
173 oldLevel = ixOsalCurrLogLevel;
174
175 ixOsalCurrLogLevel = level;
176
177 return oldLevel;
178}
179
180
181
182
183
184PUBLIC void
185ixOsalBusySleep (UINT32 microseconds)
186{
187 udelay(microseconds);
188}
189
190PUBLIC void
191ixOsalSleep (UINT32 milliseconds)
192{
193 if (milliseconds != 0) {
194#if 1
195
196
197
198
199 int i;
200 IxQMgrDispatcherFuncPtr qDispatcherFunc;
201
202 ixQMgrDispatcherLoopGet(&qDispatcherFunc);
203
204 while (milliseconds--) {
205 for (i = 1; i <= 2; i++)
206 ixNpeMhMessagesReceive(i);
207 (*qDispatcherFunc)(IX_QMGR_QUELOW_GROUP);
208
209 udelay(1000);
210 }
211#endif
212 }
213}
214
215
216
217
218
219void *
220ixOsalMemAlloc (UINT32 size)
221{
222 return (void *)0;
223}
224
225void
226ixOsalMemFree (void *ptr)
227{
228}
229
230
231
232
233
234void *
235ixOsalMemCopy (void *dest, void *src, UINT32 count)
236{
237 IX_OSAL_ASSERT (dest != NULL);
238 IX_OSAL_ASSERT (src != NULL);
239 return (memcpy (dest, src, count));
240}
241
242
243
244
245
246void *
247ixOsalMemSet (void *ptr, UINT8 filler, UINT32 count)
248{
249 IX_OSAL_ASSERT (ptr != NULL);
250 return (memset (ptr, filler, count));
251}
252