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