2 * Copyright (C) 1999-2016, 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.
23 * <<Broadcom-WL-IPTag/Open:>>
25 * $Id: typedefs.h 514727 2014-11-12 03:02:48Z $
34 * Define SITE_TYPEDEFS in the compile to include a site-specific
35 * typedef file "site_typedefs.h".
37 * If SITE_TYPEDEFS is not defined, then the code section below makes
38 * inferences about the compile environment based on defined symbols and
39 * possibly compiler pragmas.
41 * Following these two sections is the Default Typedefs section.
42 * This section is only processed if USE_TYPEDEF_DEFAULTS is
43 * defined. This section has a default set of typedefs and a few
44 * preprocessor symbols (TRUE, FALSE, NULL, ...).
47 #include "site_typedefs.h"
52 * Infer the compile environment based on preprocessor symbols and pragmas.
53 * Override type definitions as needed, and include configuration-dependent
54 * header files to define types.
67 #else /* ! __cplusplus */
70 #endif /* ! __cplusplus */
73 #define TYPEDEF_UINTPTR
74 typedef unsigned long long int uintptr;
81 #if defined(_NEED_SIZE_T_)
82 typedef long unsigned int size_t;
89 #if defined(__sparc__)
94 * If this is either a Linux hybrid build or the per-port code of a hybrid build
95 * then use the Linux header files to get some of the typedefs. Otherwise, define
96 * them entirely in this file. We can't always define the types because we get
97 * a duplicate typedef error; there is no way to "undefine" a typedef.
98 * We know when it's per-port code because each file defines LINUX_PORT at the top.
101 #ifndef TARGETENV_android
102 #define TYPEDEF_USHORT
103 #define TYPEDEF_ULONG
104 #endif /* TARGETENV_android */
106 #include <linux/version.h>
107 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
109 #endif /* >= 2.6.19 */
110 /* special detection for 2.6.18-128.7.1.0.1.el5 */
111 #if (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18))
112 #include <linux/compiler.h>
113 #ifdef noinline_for_stack
116 #endif /* == 2.6.18 */
117 #endif /* __KERNEL__ */
120 /* Do not support the (u)int64 types with strict ansi for GNU C */
121 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
122 #define TYPEDEF_INT64
123 #define TYPEDEF_UINT64
124 #endif /* defined(__GNUC__) && defined(__STRICT_ANSI__) */
126 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
127 * for signed or unsigned
131 #define TYPEDEF_INT64
133 #if defined(__STDC__)
134 #define TYPEDEF_UINT64
139 #if !defined(__DJGPP__)
141 /* pick up ushort & uint from standard types.h */
142 #if defined(__KERNEL__)
145 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
149 #include <sys/types.h>
151 #endif /* linux && __KERNEL__ */
156 /* use the default typedefs in the next section of this file */
157 #define USE_TYPEDEF_DEFAULTS
159 #endif /* SITE_TYPEDEFS */
166 #ifdef USE_TYPEDEF_DEFAULTS
167 #undef USE_TYPEDEF_DEFAULTS
170 typedef /* @abstract@ */ unsigned char bool;
171 #endif /* endif TYPEDEF_BOOL */
173 /* define uchar, ushort, uint, ulong */
175 #ifndef TYPEDEF_UCHAR
176 typedef unsigned char uchar;
179 #ifndef TYPEDEF_USHORT
180 typedef unsigned short ushort;
184 typedef unsigned int uint;
187 #ifndef TYPEDEF_ULONG
188 typedef unsigned long ulong;
191 /* define [u]int8/16/32/64, uintptr */
193 #ifndef TYPEDEF_UINT8
194 typedef unsigned char uint8;
197 #ifndef TYPEDEF_UINT16
198 typedef unsigned short uint16;
201 #ifndef TYPEDEF_UINT32
202 typedef unsigned int uint32;
205 #ifndef TYPEDEF_UINT64
206 typedef unsigned long long uint64;
209 #ifndef TYPEDEF_UINTPTR
210 typedef unsigned int uintptr;
214 typedef signed char int8;
217 #ifndef TYPEDEF_INT16
218 typedef signed short int16;
221 #ifndef TYPEDEF_INT32
222 typedef signed int int32;
225 #ifndef TYPEDEF_INT64
226 typedef signed long long int64;
229 /* define float32/64, float_t */
231 #ifndef TYPEDEF_FLOAT32
232 typedef float float32;
235 #ifndef TYPEDEF_FLOAT64
236 typedef double float64;
240 * abstracted floating point type allows for compile time selection of
241 * single or double precision arithmetic. Compiling with -DFLOAT32
242 * selects single precision; the default is double precision.
245 #ifndef TYPEDEF_FLOAT_T
248 typedef float32 float_t;
249 #else /* default to double precision floating point */
250 typedef float64 float_t;
253 #endif /* TYPEDEF_FLOAT_T */
255 /* define macro values */
262 #define TRUE 1 /* TRUE */
274 #define ON 1 /* ON = 1 */
277 #define AUTO (-1) /* Auto = -1 */
279 /* define PTRSZ, INLINE */
282 #define PTRSZ sizeof(char*)
286 /* Detect compiler type. */
287 #if defined(__GNUC__) || defined(__lint)
288 #define BWL_COMPILER_GNU
289 #elif defined(__CC_ARM) && __CC_ARM
290 #define BWL_COMPILER_ARMCC
292 #error "Unknown compiler!"
297 #if defined(BWL_COMPILER_MICROSOFT)
298 #define INLINE __inline
299 #elif defined(BWL_COMPILER_GNU)
300 #define INLINE __inline__
301 #elif defined(BWL_COMPILER_ARMCC)
302 #define INLINE __inline
310 #undef TYPEDEF_USHORT
314 #undef TYPEDEF_UINT16
315 #undef TYPEDEF_UINT32
316 #undef TYPEDEF_UINT64
317 #undef TYPEDEF_UINTPTR
322 #undef TYPEDEF_FLOAT32
323 #undef TYPEDEF_FLOAT64
324 #undef TYPEDEF_FLOAT_T
326 #endif /* USE_TYPEDEF_DEFAULTS */
328 /* Suppress unused parameter warning */
329 #define UNUSED_PARAMETER(x) (void)(x)
331 /* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
332 #define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
335 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
336 * gets this automatically
339 #endif /* _TYPEDEFS_H_ */