2 * Copyright (C) 1999-2011, Broadcom Corporation
4 * Unless you and Broadcom execute a separate written software license
5 * agreement governing use of this software, this software is licensed to you
6 * under the terms of the GNU General Public License version 2 (the "GPL"),
7 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
8 * following added to such license:
10 * As a special exception, the copyright holders of this software give you
11 * permission to link this software with independent modules, and to copy and
12 * distribute the resulting executable under terms of your choice, provided that
13 * you also meet, for each linked independent module, the terms and conditions of
14 * the license of that module. An independent module is a module which is not
15 * derived from this software. The special exception does not apply to any
16 * modifications of the software.
18 * Notwithstanding the above, under no circumstances may you combine this
19 * software in any way with any other Broadcom software provided under a license
20 * other than the GPL, without Broadcom's express prior written consent.
21 * $Id: typedefs.h,v 1.103.2.1 2010-05-11 18:19:28 $
30 * Define SITE_TYPEDEFS in the compile to include a site-specific
31 * typedef file "site_typedefs.h".
33 * If SITE_TYPEDEFS is not defined, then the code section below makes
34 * inferences about the compile environment based on defined symbols and
35 * possibly compiler pragmas.
37 * Following these two sections is the Default Typedefs section.
38 * This section is only processed if USE_TYPEDEF_DEFAULTS is
39 * defined. This section has a default set of typedefs and a few
40 * preprocessor symbols (TRUE, FALSE, NULL, ...).
43 #include "site_typedefs.h"
48 * Infer the compile environment based on preprocessor symbols and pragmas.
49 * Override type definitions as needed, and include configuration-dependent
50 * header files to define types.
63 #else /* ! __cplusplus */
66 #endif /* ! __cplusplus */
68 #if defined(__x86_64__)
69 #define TYPEDEF_UINTPTR
70 typedef unsigned long long int uintptr;
77 #if defined(_NEED_SIZE_T_)
78 typedef long unsigned int size_t;
85 #if defined(__sparc__)
91 * If this is either a Linux hybrid build or the per-port code of a hybrid build
92 * then use the Linux header files to get some of the typedefs. Otherwise, define
93 * them entirely in this file. We can't always define the types because we get
94 * a duplicate typedef error; there is no way to "undefine" a typedef.
95 * We know when it's per-port code because each file defines LINUX_PORT at the top.
97 #if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
99 #ifndef TARGETENV_android
100 #define TYPEDEF_USHORT
101 #define TYPEDEF_ULONG
102 #endif /* TARGETENV_android */
104 #include <linux/version.h>
105 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
107 #endif /* >= 2.6.19 */
108 #endif /* __KERNEL__ */
109 #endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
114 /* Do not support the (u)int64 types with strict ansi for GNU C */
115 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
116 #define TYPEDEF_INT64
117 #define TYPEDEF_UINT64
120 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
121 * for signed or unsigned
125 #define TYPEDEF_INT64
127 #if defined(__STDC__)
128 #define TYPEDEF_UINT64
133 #if !defined(__DJGPP__)
135 /* pick up ushort & uint from standard types.h */
136 #if defined(__KERNEL__)
139 #if !defined(LINUX_HYBRID) || defined(LINUX_PORT)
140 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
141 #endif /* !defined(LINUX_HYBRID) || defined(LINUX_PORT) */
146 #include <sys/types.h>
148 #endif /* linux && __KERNEL__ */
154 /* use the default typedefs in the next section of this file */
155 #define USE_TYPEDEF_DEFAULTS
157 #endif /* SITE_TYPEDEFS */
164 #ifdef USE_TYPEDEF_DEFAULTS
165 #undef USE_TYPEDEF_DEFAULTS
168 typedef /* @abstract@ */ unsigned char bool;
171 /* define uchar, ushort, uint, ulong */
173 #ifndef TYPEDEF_UCHAR
174 typedef unsigned char uchar;
177 #ifndef TYPEDEF_USHORT
178 typedef unsigned short ushort;
182 typedef unsigned int uint;
185 #ifndef TYPEDEF_ULONG
186 typedef unsigned long ulong;
189 /* define [u]int8/16/32/64, uintptr */
191 #ifndef TYPEDEF_UINT8
192 typedef unsigned char uint8;
195 #ifndef TYPEDEF_UINT16
196 typedef unsigned short uint16;
199 #ifndef TYPEDEF_UINT32
200 typedef unsigned int uint32;
203 #ifndef TYPEDEF_UINT64
204 typedef unsigned long long uint64;
207 #ifndef TYPEDEF_UINTPTR
208 typedef unsigned int uintptr;
212 typedef signed char int8;
215 #ifndef TYPEDEF_INT16
216 typedef signed short int16;
219 #ifndef TYPEDEF_INT32
220 typedef signed int int32;
223 #ifndef TYPEDEF_INT64
224 typedef signed long long int64;
227 /* define float32/64, float_t */
229 #ifndef TYPEDEF_FLOAT32
230 typedef float float32;
233 #ifndef TYPEDEF_FLOAT64
234 typedef double float64;
238 * abstracted floating point type allows for compile time selection of
239 * single or double precision arithmetic. Compiling with -DFLOAT32
240 * selects single precision; the default is double precision.
243 #ifndef TYPEDEF_FLOAT_T
246 typedef float32 float_t;
247 #else /* default to double precision floating point */
248 typedef float64 float_t;
251 #endif /* TYPEDEF_FLOAT_T */
253 /* define macro values */
260 #define TRUE 1 /* TRUE */
272 #define ON 1 /* ON = 1 */
275 #define AUTO (-1) /* Auto = -1 */
277 /* define PTRSZ, INLINE */
280 #define PTRSZ sizeof(char*)
284 /* Detect compiler type. */
285 #if defined(__GNUC__)
286 #define BWL_COMPILER_GNU
287 #elif defined(__CC_ARM) && __CC_ARM
288 #define BWL_COMPILER_ARMCC
290 #error "Unknown compiler!"
295 #if defined(BWL_COMPILER_MICROSOFT)
296 #define INLINE __inline
297 #elif defined(BWL_COMPILER_GNU)
298 #define INLINE __inline__
299 #elif defined(BWL_COMPILER_ARMCC)
300 #define INLINE __inline
303 #endif /* _MSC_VER */
308 #undef TYPEDEF_USHORT
312 #undef TYPEDEF_UINT16
313 #undef TYPEDEF_UINT32
314 #undef TYPEDEF_UINT64
315 #undef TYPEDEF_UINTPTR
320 #undef TYPEDEF_FLOAT32
321 #undef TYPEDEF_FLOAT64
322 #undef TYPEDEF_FLOAT_T
324 #endif /* USE_TYPEDEF_DEFAULTS */
326 /* Suppress unused parameter warning */
327 #define UNUSED_PARAMETER(x) (void)(x)
330 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
331 * gets this automatically
334 #endif /* _TYPEDEFS_H_ */