]> git.sur5r.net Git - u-boot/blob - drivers/net/npe/include/IxOsalTypes.h
00a49ada05b5d38176d491b14f0945001d5726ea
[u-boot] / drivers / net / npe / include / IxOsalTypes.h
1 /**
2  * @file IxOsalTypes.h
3  *
4  * @brief Define OSAL basic data types.
5  *
6  * This file contains fundamental data types used by OSAL.
7  *
8  * @par
9  * IXP400 SW Release version 2.0
10  *
11  * -- Copyright Notice --
12  *
13  * @par
14  * Copyright 2001-2005, Intel Corporation.
15  * All rights reserved.
16  *
17  * @par
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions
20  * are met:
21  * 1. Redistributions of source code must retain the above copyright
22  *    notice, this list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright
24  *    notice, this list of conditions and the following disclaimer in the
25  *    documentation and/or other materials provided with the distribution.
26  * 3. Neither the name of the Intel Corporation nor the names of its contributors
27  *    may be used to endorse or promote products derived from this software
28  *    without specific prior written permission.
29  *
30  * @par
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
32  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
35  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41  * SUCH DAMAGE.
42  *
43  * @par
44  * -- End of Copyright Notice --
45  */
46
47
48 #ifndef IxOsalTypes_H
49 #define IxOsalTypes_H
50
51 #include <config.h>
52 #include <common.h>
53
54 #define __ixp42X                        /* sr: U-Boot needs this define */
55 #define IXP425_EXP_CFG_BASE     0xC4000000
56 #define diag_printf             debug
57
58 #undef SIMSPARCSOLARIS
59 #define SIMSPARCSOLARIS         0xaffe  /* sr: U-Boot gets confused with this solaris define */
60
61 /*
62  * Include the OS-specific type definitions
63  */
64 #include "IxOsalOsTypes.h"
65 /**
66  * @defgroup IxOsalTypes Osal basic data types.
67  *
68  * @brief Basic data types for Osal
69  *
70  * @{
71  */
72
73 /**
74  * @brief OSAL status
75  *
76  * @note Possible OSAL return status include IX_SUCCESS and IX_FAIL.
77  */
78 typedef UINT32 IX_STATUS;
79
80 /**
81  * @brief VUINT32
82  *
83  * @note volatile UINT32
84  */
85 typedef volatile UINT32 VUINT32;
86
87 /**
88  * @brief VINT32
89  *
90  * @note volatile INT32
91  */
92 typedef volatile INT32 VINT32;
93
94 /**
95  * @ingroup IxOsalTypes
96  *
97  * @def IX_OSAL_BILLION
98  *
99  * @brief  Alias for 1,000,000,000
100  *
101  */
102 #define IX_OSAL_BILLION (1000000000)
103
104 #ifndef NULL
105 #define NULL       0L
106 #endif
107
108 /**
109  * @ingroup IxOsalTypes
110  *
111  * @def IX_SUCCESS
112  *
113  * @brief Success status
114  *
115  */
116 #ifndef IX_SUCCESS
117 #define IX_SUCCESS 0L /**< #defined as 0L */
118 #endif
119
120 /**
121  * @ingroup IxOsalTypes
122  *
123  * @def IX_FAIL
124  *
125  * @brief Failure status
126  *
127  */
128 #ifndef IX_FAIL
129 #define IX_FAIL    1L /**< #defined as 1L */
130 #endif
131
132
133 #ifndef PRIVATE
134 #ifdef IX_PRIVATE_OFF
135 #define PRIVATE                 /* nothing */
136 #else
137 #define PRIVATE static  /**< #defined as static, except for debug builds */
138 #endif /* IX_PRIVATE_OFF */
139 #endif /* PRIVATE */
140
141
142 /**
143  * @ingroup IxOsalTypes
144  *
145  * @def IX_OSAL_INLINE
146  *
147  * @brief Alias for __inline
148  *
149  */
150 #ifndef IX_OSAL_INLINE
151 #define IX_OSAL_INLINE __inline
152 #endif /* IX_OSAL_INLINE */
153
154
155 #ifndef __inline__
156 #define __inline__      IX_OSAL_INLINE
157 #endif
158
159
160 /* Each OS can define its own PUBLIC, otherwise it will be empty. */
161 #ifndef PUBLIC
162 #define PUBLIC
163 #endif /* PUBLIC */
164
165
166 /**
167  * @ingroup IxOsalTypes
168  *
169  * @def IX_OSAL_INLINE_EXTERN
170  *
171  * @brief Alias for __inline extern
172  *
173  */
174 #ifndef IX_OSAL_INLINE_EXTERN
175 #define IX_OSAL_INLINE_EXTERN IX_OSAL_INLINE extern
176 #endif
177
178 /**
179  * @ingroup IxOsalTypes
180  * @enum IxOsalLogDevice
181  * @brief This is an emum for OSAL log devices.
182  */
183 typedef enum
184 {
185     IX_OSAL_LOG_DEV_STDOUT = 0,        /**< standard output (implemented by default) */
186     IX_OSAL_LOG_DEV_STDERR = 1,        /**< standard error (implemented */
187     IX_OSAL_LOG_DEV_HEX_DISPLAY = 2,   /**< hexadecimal display (not implemented) */
188     IX_OSAL_LOG_DEV_ASCII_DISPLAY = 3  /**< ASCII-capable display (not implemented) */
189 } IxOsalLogDevice;
190
191
192 /**
193  * @ingroup IxOsalTypes
194  *
195  * @def IX_OSAL_LOG_ERROR
196  *
197  * @brief Alias for -1, used as log function error status
198  *
199  */
200 #define IX_OSAL_LOG_ERROR (-1)
201
202 /**
203  * @ingroup IxOsalTypes
204  * @enum IxOsalLogLevel
205  * @brief This is an emum for OSAL log trace level.
206  */
207 typedef enum
208 {
209     IX_OSAL_LOG_LVL_NONE = 0,    /**<No trace level */
210     IX_OSAL_LOG_LVL_USER = 1,    /**<Set trace level to user */
211     IX_OSAL_LOG_LVL_FATAL = 2,   /**<Set trace level to fatal */
212     IX_OSAL_LOG_LVL_ERROR = 3,   /**<Set trace level to error */
213     IX_OSAL_LOG_LVL_WARNING = 4, /**<Set trace level to warning */
214     IX_OSAL_LOG_LVL_MESSAGE = 5, /**<Set trace level to message */
215     IX_OSAL_LOG_LVL_DEBUG1 = 6,  /**<Set trace level to debug1 */
216     IX_OSAL_LOG_LVL_DEBUG2 = 7,  /**<Set trace level to debug2 */
217     IX_OSAL_LOG_LVL_DEBUG3 = 8,  /**<Set trace level to debug3 */
218     IX_OSAL_LOG_LVL_ALL /**<Set trace level to all */
219 } IxOsalLogLevel;
220
221
222 /**
223  * @ingroup IxOsalTypes
224  * @brief Void function pointer prototype
225  *
226  * @note accepts a void pointer parameter
227  * and does not return a value.
228  */
229 typedef void (*IxOsalVoidFnVoidPtr) (void *);
230
231 typedef void (*IxOsalVoidFnPtr) (void);
232
233
234 /**
235  * @brief Timeval structure
236  *
237  * @note Contain subfields of seconds and nanoseconds..
238  */
239 typedef struct
240 {
241     UINT32 secs;                /**< seconds */
242     UINT32 nsecs;               /**< nanoseconds */
243 } IxOsalTimeval;
244
245
246 /**
247  * @ingroup IxOsalTypes
248  * @brief IxOsalTimer
249  *
250  * @note OSAL timer handle
251  *
252  */
253 typedef UINT32 IxOsalTimer;
254
255
256 /**
257  * @ingroup IxOsalTypes
258  *
259  * @def IX_OSAL_WAIT_FOREVER
260  *
261  * @brief Definition for timeout forever, OS-specific.
262  *
263  */
264 #define IX_OSAL_WAIT_FOREVER IX_OSAL_OS_WAIT_FOREVER
265
266 /**
267  * @ingroup IxOsalTypes
268  *
269  * @def IX_OSAL_WAIT_NONE
270  *
271  * @brief Definition for timeout 0, OS-specific.
272  *
273  */
274 #define IX_OSAL_WAIT_NONE    IX_OSAL_OS_WAIT_NONE
275
276
277 /**
278  * @ingroup IxOsalTypes
279  * @brief IxOsalMutex
280  *
281  * @note Mutex handle, OS-specific
282  *
283  */
284 typedef IxOsalOsMutex IxOsalMutex;
285
286 /**
287  * @ingroup IxOsalTypes
288  * @brief IxOsalFastMutex
289  *
290  * @note FastMutex handle, OS-specific
291  *
292  */
293 typedef IxOsalOsFastMutex IxOsalFastMutex;
294
295 /**
296  * @ingroup IxOsalTypes
297  * @brief IxOsalThread
298  *
299  * @note Thread handle, OS-specific
300  *
301  */
302 typedef IxOsalOsThread IxOsalThread;
303
304 /**
305  * @ingroup IxOsalTypes
306  * @brief IxOsalSemaphore
307  *
308  * @note Semaphore handle, OS-specific
309  *
310  */
311 typedef IxOsalOsSemaphore IxOsalSemaphore;
312
313 /**
314  * @ingroup IxOsalTypes
315  * @brief IxOsalMessageQueue
316  *
317  * @note Message Queue handle, OS-specific
318  *
319  */
320 typedef IxOsalOsMessageQueue IxOsalMessageQueue;
321
322
323 /**
324  * @brief Thread Attribute
325  * @note Default thread attribute
326  */
327 typedef struct
328 {
329     char *name;        /**< name */
330     UINT32 stackSize;  /**< stack size */
331     UINT32 priority;   /**< priority */
332 } IxOsalThreadAttr;
333
334 /**
335  * @ingroup IxOsalTypes
336  *
337  * @def IX_OSAL_THREAD_DEFAULT_STACK_SIZE
338  *
339  * @brief Default thread stack size, OS-specific.
340  *
341  */
342 #define IX_OSAL_THREAD_DEFAULT_STACK_SIZE (IX_OSAL_OS_THREAD_DEFAULT_STACK_SIZE)
343
344 /**
345  * @ingroup IxOsalTypes
346  *
347  * @def IX_OSAL_THREAD_MAX_STACK_SIZE
348  *
349  * @brief Max stack size, OS-specific.
350  *
351  */
352 #define IX_OSAL_THREAD_MAX_STACK_SIZE (IX_OSAL_OS_THREAD_MAX_STACK_SIZE)
353
354 /**
355  * @ingroup IxOsalTypes
356  *
357  * @def IX_OSAL_DEFAULT_THREAD_PRIORITY
358  *
359  * @brief Default thread priority, OS-specific.
360  *
361  */
362 #define IX_OSAL_DEFAULT_THREAD_PRIORITY (IX_OSAL_OS_DEFAULT_THREAD_PRIORITY)
363
364 /**
365  * @ingroup IxOsalTypes
366  *
367  * @def IX_OSAL_MAX_THREAD_PRIORITY
368  *
369  * @brief Max thread priority, OS-specific.
370  *
371  */
372 #define IX_OSAL_MAX_THREAD_PRIORITY (IX_OSAL_OS_MAX_THREAD_PRIORITY)
373
374 /**
375  * @} IxOsalTypes
376  */
377
378
379 #endif /* IxOsalTypes_H */