source: SVN/cambria/redboot/packages/devs/eth/intel/npe/common/current/include/osal/IxOsalTypes.h @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 9.1 KB
Line 
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.3
10 *
11 * -- Copyright Notice --
12 *
13 * @par
14 * Copyright (c) 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 *
31 * @par
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
36 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 * SUCH DAMAGE.
43 *
44 *
45 * @par
46 * -- End of Copyright Notice --
47 */
48
49
50#ifndef IxOsalTypes_H
51#define IxOsalTypes_H
52
53
54/*
55 * Include the OS-specific type definitions
56 */
57#include "IxOsalOsTypes.h"
58/**
59 * @defgroup IxOsalTypes Osal basic data types.
60 *
61 * @brief Basic data types for Osal
62 *
63 * @{
64 */
65
66/**
67 * @brief OSAL status
68 *
69 * @note Possible OSAL return status include IX_SUCCESS and IX_FAIL.
70 */
71typedef UINT32 IX_STATUS; 
72
73/**
74 * @brief VUINT32
75 *
76 * @note volatile UINT32
77 */
78typedef volatile UINT32 VUINT32;
79
80/**
81 * @brief VINT32
82 *
83 * @note volatile INT32
84 */
85typedef volatile INT32 VINT32;
86
87
88#ifndef NUMELEMS
89#define NUMELEMS(x) (sizeof(x) / sizeof((x)[0]))
90#endif
91
92
93/**
94 * @ingroup IxOsalTypes
95 *
96 * @def IX_OSAL_BILLION
97 *
98 * @brief  Alias for 1,000,000,000
99 *
100 */
101#define IX_OSAL_BILLION (1000000000)
102
103#ifndef TRUE
104#define TRUE       1L
105#endif
106
107#if TRUE != 1
108#error TRUE is not defined to 1
109#endif
110
111#ifndef FALSE
112#define FALSE      0L
113#endif
114
115#if FALSE != 0
116#error FALSE is not defined to 0
117#endif
118
119#ifndef NULL
120#define NULL       0L
121#endif
122
123/**
124 * @ingroup IxOsalTypes
125 *
126 * @def IX_SUCCESS
127 *
128 * @brief Success status
129 *
130 */
131#ifndef IX_SUCCESS
132#define IX_SUCCESS 0L /**< #defined as 0L */
133#endif
134
135/**
136 * @ingroup IxOsalTypes
137 *
138 * @def IX_FAIL
139 *
140 * @brief Failure status
141 *
142 */
143#ifndef IX_FAIL
144#define IX_FAIL    1L /**< #defined as 1L */
145#endif
146
147
148#ifndef PRIVATE
149#ifdef IX_PRIVATE_OFF
150#define PRIVATE                 /* nothing */
151#else
152#define PRIVATE static  /**< #defined as static, except for debug builds */
153#endif /* IX_PRIVATE_OFF */
154#endif /* PRIVATE */
155
156
157/**
158 * @ingroup IxOsalTypes
159 *
160 * @def IX_OSAL_INLINE
161 *
162 * @brief Alias for __inline
163 *
164 */
165#ifndef _DIAB_TOOL
166
167#ifndef IX_OSAL_INLINE
168#define IX_OSAL_INLINE __inline
169#endif /* IX_OSAL_INLINE */
170
171#ifndef __inline__
172#define __inline__   IX_OSAL_INLINE
173#endif
174
175#else
176
177#ifndef IX_OSAL_INLINE
178#define IX_OSAL_INLINE __inline__  /* Diab Compiler uses __inline__ (compiler di
179                                      rective) */
180#endif /* IX_OSAL_INLINE */
181
182#endif /*_DIAB_TOOL*/
183
184
185/* Each OS can define its own PUBLIC, otherwise it will be empty. */
186#ifndef PUBLIC
187#define PUBLIC
188#endif /* PUBLIC */
189
190
191/**
192 * @ingroup IxOsalTypes
193 *
194 * @def IX_OSAL_INLINE_EXTERN
195 *
196 * @brief Alias for __inline extern
197 *
198 */
199#ifndef IX_OSAL_INLINE_EXTERN
200#define IX_OSAL_INLINE_EXTERN IX_OSAL_INLINE extern
201#endif
202
203/**
204 * @ingroup IxOsalTypes
205 *
206 * @def IX_OSAL_ATTRIBUTE_PACKED
207 *
208 * @brief Defining packed attribute type in compiler/OS that supports it.
209 *
210 */
211#ifndef IX_OSAL_ATTRIBUTE_PACKED
212#define IX_OSAL_ATTRIBUTE_PACKED
213#endif
214
215
216/**
217 * @ingroup IxOsalTypes
218 * @enum IxOsalLogDevice
219 * @brief This is an emum for OSAL log devices.
220 */
221typedef enum
222{
223    IX_OSAL_LOG_DEV_STDOUT = 0,        /**< standard output (implemented by default) */
224    IX_OSAL_LOG_DEV_STDERR = 1,        /**< standard error (implemented */
225    IX_OSAL_LOG_DEV_HEX_DISPLAY = 2,   /**< hexadecimal display (not implemented) */
226    IX_OSAL_LOG_DEV_ASCII_DISPLAY = 3  /**< ASCII-capable display (not implemented) */
227} IxOsalLogDevice;
228
229
230/**
231 * @ingroup IxOsalTypes
232 *
233 * @def IX_OSAL_LOG_ERROR
234 *
235 * @brief Alias for -1, used as log function error status
236 *
237 */
238#define IX_OSAL_LOG_ERROR (-1)
239
240/**
241 * @ingroup IxOsalTypes
242 * @enum IxOsalLogLevel
243 * @brief This is an emum for OSAL log trace level.
244 */
245typedef enum
246{
247    IX_OSAL_LOG_LVL_NONE = 0,    /**<No trace level */
248    IX_OSAL_LOG_LVL_USER = 1,    /**<Set trace level to user */
249    IX_OSAL_LOG_LVL_FATAL = 2,   /**<Set trace level to fatal */
250    IX_OSAL_LOG_LVL_ERROR = 3,   /**<Set trace level to error */
251    IX_OSAL_LOG_LVL_WARNING = 4, /**<Set trace level to warning */
252    IX_OSAL_LOG_LVL_MESSAGE = 5, /**<Set trace level to message */
253    IX_OSAL_LOG_LVL_DEBUG1 = 6,  /**<Set trace level to debug1 */
254    IX_OSAL_LOG_LVL_DEBUG2 = 7,  /**<Set trace level to debug2 */
255    IX_OSAL_LOG_LVL_DEBUG3 = 8,  /**<Set trace level to debug3 */
256    IX_OSAL_LOG_LVL_ALL /**<Set trace level to all */
257} IxOsalLogLevel;
258
259
260/**
261 * @ingroup IxOsalTypes
262 * @brief Void function pointer prototype
263 *
264 * @note accepts a void pointer parameter
265 * and does not return a value.
266 */
267typedef void (*IxOsalVoidFnVoidPtr) (void *);
268
269typedef void (*IxOsalVoidFnPtr) (void);
270
271
272/**
273 * @brief Timeval structure
274 *
275 * @note Contain subfields of seconds and nanoseconds..
276 */
277typedef struct
278{
279    UINT32 secs;                /**< seconds */
280    UINT32 nsecs;               /**< nanoseconds */
281} IxOsalTimeval;
282
283
284/**
285 * @ingroup IxOsalTypes
286 * @brief IxOsalTimer
287 *
288 * @note OSAL timer handle
289 *
290 */
291typedef UINT32 IxOsalTimer;
292
293
294/**
295 * @ingroup IxOsalTypes
296 *
297 * @def IX_OSAL_WAIT_FOREVER
298 *
299 * @brief Definition for timeout forever, OS-specific.
300 *
301 */
302#define IX_OSAL_WAIT_FOREVER IX_OSAL_OS_WAIT_FOREVER
303
304/**
305 * @ingroup IxOsalTypes
306 *
307 * @def IX_OSAL_WAIT_NONE
308 *
309 * @brief Definition for timeout 0, OS-specific.
310 *
311 */
312#define IX_OSAL_WAIT_NONE    IX_OSAL_OS_WAIT_NONE
313
314
315/**
316 * @ingroup IxOsalTypes
317 * @brief IxOsalMutex
318 *
319 * @note Mutex handle, OS-specific
320 *
321 */
322typedef IxOsalOsMutex IxOsalMutex;
323
324/**
325 * @ingroup IxOsalTypes
326 * @brief IxOsalFastMutex
327 *
328 * @note FastMutex handle, OS-specific
329 *
330 */
331typedef IxOsalOsFastMutex IxOsalFastMutex;
332
333/**
334 * @ingroup IxOsalTypes
335 * @brief IxOsalThread
336 *
337 * @note Thread handle, OS-specific
338 *
339 */
340typedef IxOsalOsThread IxOsalThread;
341
342/**
343 * @ingroup IxOsalTypes
344 * @brief IxOsalSemaphore
345 *
346 * @note Semaphore handle, OS-specific
347 *
348 */
349typedef IxOsalOsSemaphore IxOsalSemaphore;
350
351/**
352 * @ingroup IxOsalTypes
353 * @brief IxOsalMessageQueue
354 *
355 * @note Message Queue handle, OS-specific
356 *
357 */
358typedef IxOsalOsMessageQueue IxOsalMessageQueue;
359
360
361/**
362 * @brief Thread Attribute
363 * @note Default thread attribute
364 */
365typedef struct
366{
367    char *name;        /**< name */
368    UINT32 stackSize;  /**< stack size */
369    UINT32 priority;   /**< priority */
370} IxOsalThreadAttr;
371
372/**
373 * @ingroup IxOsalTypes
374 *
375 * @def IX_OSAL_THREAD_DEFAULT_SCHED_POLICY
376 *
377 * @brief Default Thread Scheduling Policy, OS-specific.
378 *
379 */
380#define IX_OSAL_THREAD_DEFAULT_SCHED_POLICY (IX_OSAL_OS_THREAD_DEFAULT_SCHED_POLICY)
381
382
383/**
384 * @ingroup IxOsalTypes
385 *
386 * @def IX_OSAL_THREAD_DEFAULT_STACK_SIZE
387 *
388 * @brief Default thread stack size, OS-specific.
389 *
390 */
391#define IX_OSAL_THREAD_DEFAULT_STACK_SIZE (IX_OSAL_OS_THREAD_DEFAULT_STACK_SIZE)
392
393/**
394 * @ingroup IxOsalTypes
395 *
396 * @def IX_OSAL_THREAD_MAX_STACK_SIZE
397 *
398 * @brief Max stack size, OS-specific.
399 *
400 */
401#define IX_OSAL_THREAD_MAX_STACK_SIZE (IX_OSAL_OS_THREAD_MAX_STACK_SIZE)
402
403/**
404 * @ingroup IxOsalTypes
405 *
406 * @def IX_OSAL_MAX_THREAD_NAME_LEN
407 *
408 * @brief Max size of thread name
409 *
410 */
411#define IX_OSAL_MAX_THREAD_NAME_LEN  16
412
413/**
414 * @ingroup IxOsalTypes
415 *
416 * @def IX_OSAL_MIN_THREAD_PRIORITY
417 *
418 * @brief Min thread priority, OS-specific.
419 *
420 */
421#ifdef IX_OSAL_OS_MIN_THREAD_PRIORITY
422#define IX_OSAL_MIN_THREAD_PRIORITY     (IX_OSAL_OS_MIN_THREAD_PRIORITY)
423#else
424#define IX_OSAL_MIN_THREAD_PRIORITY     0
425#endif
426
427/**
428 * @ingroup IxOsalTypes
429 *
430 * @def IX_OSAL_DEFAULT_THREAD_PRIORITY
431 *
432 * @brief Default thread priority, OS-specific.
433 *
434 */
435#define IX_OSAL_DEFAULT_THREAD_PRIORITY (IX_OSAL_OS_DEFAULT_THREAD_PRIORITY)
436
437/**
438 * @ingroup IxOsalTypes
439 *
440 * @def IX_OSAL_MAX_THREAD_PRIORITY
441 *
442 * @brief Max thread priority, OS-specific.
443 *
444 */
445#define IX_OSAL_MAX_THREAD_PRIORITY (IX_OSAL_OS_MAX_THREAD_PRIORITY)
446
447/**
448 * @ingroup IxOsalTypes
449 *
450 * @def IxOsalPciDev
451 *
452 * @brief This is a data type that serves as a handle for allocated PCI device.
453 *
454 */
455typedef UINT8 *IxOsalPciDev;
456
457#endif /* IxOsalTypes_H */
Note: See TracBrowser for help on using the repository browser.