]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/net/npe/include/IxOsalTypes.h
Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[karo-tx-uboot.git] / 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 #ifndef NUMELEMS
96 #define NUMELEMS(x) (sizeof(x) / sizeof((x)[0]))
97 #endif
98
99
100 /**
101  * @ingroup IxOsalTypes
102  *
103  * @def IX_OSAL_BILLION
104  *
105  * @brief  Alias for 1,000,000,000
106  *
107  */
108 #define IX_OSAL_BILLION (1000000000)
109
110 #ifndef NULL
111 #define NULL       0L
112 #endif
113
114 /**
115  * @ingroup IxOsalTypes
116  *
117  * @def IX_SUCCESS
118  *
119  * @brief Success status
120  *
121  */
122 #ifndef IX_SUCCESS
123 #define IX_SUCCESS 0L /**< #defined as 0L */
124 #endif
125
126 /**
127  * @ingroup IxOsalTypes
128  *
129  * @def IX_FAIL
130  *
131  * @brief Failure status
132  *
133  */
134 #ifndef IX_FAIL
135 #define IX_FAIL    1L /**< #defined as 1L */
136 #endif
137
138
139 #ifndef PRIVATE
140 #ifdef IX_PRIVATE_OFF
141 #define PRIVATE                 /* nothing */
142 #else
143 #define PRIVATE static  /**< #defined as static, except for debug builds */
144 #endif /* IX_PRIVATE_OFF */
145 #endif /* PRIVATE */
146
147
148 /**
149  * @ingroup IxOsalTypes
150  *
151  * @def IX_OSAL_INLINE
152  *
153  * @brief Alias for __inline
154  *
155  */
156 #ifndef IX_OSAL_INLINE
157 #define IX_OSAL_INLINE __inline
158 #endif /* IX_OSAL_INLINE */
159
160
161 #ifndef __inline__
162 #define __inline__      IX_OSAL_INLINE
163 #endif
164
165
166 /* Each OS can define its own PUBLIC, otherwise it will be empty. */
167 #ifndef PUBLIC
168 #define PUBLIC
169 #endif /* PUBLIC */
170
171
172 /**
173  * @ingroup IxOsalTypes
174  *
175  * @def IX_OSAL_INLINE_EXTERN
176  *
177  * @brief Alias for __inline extern
178  *
179  */
180 #ifndef IX_OSAL_INLINE_EXTERN
181 #define IX_OSAL_INLINE_EXTERN IX_OSAL_INLINE extern
182 #endif
183
184 /**
185  * @ingroup IxOsalTypes
186  * @enum IxOsalLogDevice
187  * @brief This is an emum for OSAL log devices.
188  */
189 typedef enum
190 {
191     IX_OSAL_LOG_DEV_STDOUT = 0,        /**< standard output (implemented by default) */
192     IX_OSAL_LOG_DEV_STDERR = 1,        /**< standard error (implemented */
193     IX_OSAL_LOG_DEV_HEX_DISPLAY = 2,   /**< hexadecimal display (not implemented) */
194     IX_OSAL_LOG_DEV_ASCII_DISPLAY = 3  /**< ASCII-capable display (not implemented) */
195 } IxOsalLogDevice;
196
197
198 /**
199  * @ingroup IxOsalTypes
200  *
201  * @def IX_OSAL_LOG_ERROR
202  *
203  * @brief Alias for -1, used as log function error status
204  *
205  */
206 #define IX_OSAL_LOG_ERROR (-1)
207
208 /**
209  * @ingroup IxOsalTypes
210  * @enum IxOsalLogLevel
211  * @brief This is an emum for OSAL log trace level.
212  */
213 typedef enum
214 {
215     IX_OSAL_LOG_LVL_NONE = 0,    /**<No trace level */
216     IX_OSAL_LOG_LVL_USER = 1,    /**<Set trace level to user */
217     IX_OSAL_LOG_LVL_FATAL = 2,   /**<Set trace level to fatal */
218     IX_OSAL_LOG_LVL_ERROR = 3,   /**<Set trace level to error */
219     IX_OSAL_LOG_LVL_WARNING = 4, /**<Set trace level to warning */
220     IX_OSAL_LOG_LVL_MESSAGE = 5, /**<Set trace level to message */
221     IX_OSAL_LOG_LVL_DEBUG1 = 6,  /**<Set trace level to debug1 */
222     IX_OSAL_LOG_LVL_DEBUG2 = 7,  /**<Set trace level to debug2 */
223     IX_OSAL_LOG_LVL_DEBUG3 = 8,  /**<Set trace level to debug3 */
224     IX_OSAL_LOG_LVL_ALL /**<Set trace level to all */
225 } IxOsalLogLevel;
226
227
228 /**
229  * @ingroup IxOsalTypes
230  * @brief Void function pointer prototype
231  *
232  * @note accepts a void pointer parameter
233  * and does not return a value.
234  */
235 typedef void (*IxOsalVoidFnVoidPtr) (void *);
236
237 typedef void (*IxOsalVoidFnPtr) (void);
238
239
240 /**
241  * @brief Timeval structure
242  *
243  * @note Contain subfields of seconds and nanoseconds..
244  */
245 typedef struct
246 {
247     UINT32 secs;                /**< seconds */
248     UINT32 nsecs;               /**< nanoseconds */
249 } IxOsalTimeval;
250
251
252 /**
253  * @ingroup IxOsalTypes
254  * @brief IxOsalTimer
255  *
256  * @note OSAL timer handle
257  *
258  */
259 typedef UINT32 IxOsalTimer;
260
261
262 /**
263  * @ingroup IxOsalTypes
264  *
265  * @def IX_OSAL_WAIT_FOREVER
266  *
267  * @brief Definition for timeout forever, OS-specific.
268  *
269  */
270 #define IX_OSAL_WAIT_FOREVER IX_OSAL_OS_WAIT_FOREVER
271
272 /**
273  * @ingroup IxOsalTypes
274  *
275  * @def IX_OSAL_WAIT_NONE
276  *
277  * @brief Definition for timeout 0, OS-specific.
278  *
279  */
280 #define IX_OSAL_WAIT_NONE    IX_OSAL_OS_WAIT_NONE
281
282
283 /**
284  * @ingroup IxOsalTypes
285  * @brief IxOsalMutex
286  *
287  * @note Mutex handle, OS-specific
288  *
289  */
290 typedef IxOsalOsMutex IxOsalMutex;
291
292 /**
293  * @ingroup IxOsalTypes
294  * @brief IxOsalFastMutex
295  *
296  * @note FastMutex handle, OS-specific
297  *
298  */
299 typedef IxOsalOsFastMutex IxOsalFastMutex;
300
301 /**
302  * @ingroup IxOsalTypes
303  * @brief IxOsalThread
304  *
305  * @note Thread handle, OS-specific
306  *
307  */
308 typedef IxOsalOsThread IxOsalThread;
309
310 /**
311  * @ingroup IxOsalTypes
312  * @brief IxOsalSemaphore
313  *
314  * @note Semaphore handle, OS-specific
315  *
316  */
317 typedef IxOsalOsSemaphore IxOsalSemaphore;
318
319 /**
320  * @ingroup IxOsalTypes
321  * @brief IxOsalMessageQueue
322  *
323  * @note Message Queue handle, OS-specific
324  *
325  */
326 typedef IxOsalOsMessageQueue IxOsalMessageQueue;
327
328
329 /**
330  * @brief Thread Attribute
331  * @note Default thread attribute
332  */
333 typedef struct
334 {
335     char *name;        /**< name */
336     UINT32 stackSize;  /**< stack size */
337     UINT32 priority;   /**< priority */
338 } IxOsalThreadAttr;
339
340 /**
341  * @ingroup IxOsalTypes
342  *
343  * @def IX_OSAL_THREAD_DEFAULT_STACK_SIZE
344  *
345  * @brief Default thread stack size, OS-specific.
346  *
347  */
348 #define IX_OSAL_THREAD_DEFAULT_STACK_SIZE (IX_OSAL_OS_THREAD_DEFAULT_STACK_SIZE)
349
350 /**
351  * @ingroup IxOsalTypes
352  *
353  * @def IX_OSAL_THREAD_MAX_STACK_SIZE
354  *
355  * @brief Max stack size, OS-specific.
356  *
357  */
358 #define IX_OSAL_THREAD_MAX_STACK_SIZE (IX_OSAL_OS_THREAD_MAX_STACK_SIZE)
359
360 /**
361  * @ingroup IxOsalTypes
362  *
363  * @def IX_OSAL_DEFAULT_THREAD_PRIORITY
364  *
365  * @brief Default thread priority, OS-specific.
366  *
367  */
368 #define IX_OSAL_DEFAULT_THREAD_PRIORITY (IX_OSAL_OS_DEFAULT_THREAD_PRIORITY)
369
370 /**
371  * @ingroup IxOsalTypes
372  *
373  * @def IX_OSAL_MAX_THREAD_PRIORITY
374  *
375  * @brief Max thread priority, OS-specific.
376  *
377  */
378 #define IX_OSAL_MAX_THREAD_PRIORITY (IX_OSAL_OS_MAX_THREAD_PRIORITY)
379
380 /**
381  * @} IxOsalTypes
382  */
383
384
385 #endif /* IxOsalTypes_H */