397a343fff7b9f5d01ee55b6edab2312bc8cf71a
2 * Copyright (C) 1999-2018, Broadcom.
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 742663 2018-01-23 06:57:52Z $
31 #if (!defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)) || \
32 !defined(BWL_NO_INTERNAL_STDLIB_SUPPORT)
37 * Define SITE_TYPEDEFS in the compile to include a site-specific
38 * typedef file "site_typedefs.h".
40 * If SITE_TYPEDEFS is not defined, then the code section below makes
41 * inferences about the compile environment based on defined symbols and
42 * possibly compiler pragmas.
44 * Following these two sections is the Default Typedefs section.
45 * This section is only processed if USE_TYPEDEF_DEFAULTS is
46 * defined. This section has a default set of typedefs and a few
47 * preprocessor symbols (TRUE, FALSE, NULL, ...).
50 #include "site_typedefs.h"
55 * Infer the compile environment based on preprocessor symbols and pragmas.
56 * Override type definitions as needed, and include configuration-dependent
57 * header files to define types.
70 #else /* ! __cplusplus */
72 #endif /* ! __cplusplus */
74 #if !defined(TYPEDEF_UINTPTR)
76 #define TYPEDEF_UINTPTR
77 typedef unsigned long long int uintptr
;
79 #endif /* TYPEDEF_UINTPTR */
81 /* float_t types conflict with the same typedefs from the standard ANSI-C
82 ** math.h header file. Don't re-typedef them here.
85 #if defined(_NEED_SIZE_T_)
86 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__ */
119 /* Do not support the (u)int64 types with strict ansi for GNU C */
120 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
121 #define TYPEDEF_INT64
122 #define TYPEDEF_UINT64
123 #endif /* defined(__GNUC__) && defined(__STRICT_ANSI__) */
125 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
126 * for signed or unsigned
130 #define TYPEDEF_INT64
132 #if defined(__STDC__)
133 #define TYPEDEF_UINT64
138 #if !defined(__DJGPP__)
140 /* pick up ushort & uint from standard types.h */
141 #if defined(__KERNEL__)
144 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
148 #include <sys/types.h>
150 #endif /* linux && __KERNEL__ */
154 /* use the default typedefs in the next section of this file */
155 #define USE_TYPEDEF_DEFAULTS
157 #endif /* SITE_TYPEDEFS */
163 #ifdef USE_TYPEDEF_DEFAULTS
164 #undef USE_TYPEDEF_DEFAULTS
167 typedef /* @abstract@ */ unsigned char bool;
168 #endif /* endif TYPEDEF_BOOL */
170 /* define uchar, ushort, uint, ulong */
172 #ifndef TYPEDEF_UCHAR
173 typedef unsigned char uchar
;
176 #ifndef TYPEDEF_USHORT
177 typedef unsigned short ushort
;
181 typedef unsigned int uint
;
184 #ifndef TYPEDEF_ULONG
185 typedef unsigned long ulong
;
188 /* define [u]int8/16/32/64, uintptr */
190 #ifndef TYPEDEF_UINT8
191 typedef unsigned char uint8
;
194 #ifndef TYPEDEF_UINT16
195 typedef unsigned short uint16
;
198 #ifndef TYPEDEF_UINT32
199 typedef unsigned int uint32
;
202 #ifndef TYPEDEF_UINT64
203 typedef unsigned long long uint64
;
206 #ifndef TYPEDEF_UINTPTR
207 typedef unsigned int uintptr
;
211 typedef signed char int8
;
214 #ifndef TYPEDEF_INT16
215 typedef signed short int16
;
218 #ifndef TYPEDEF_INT32
219 typedef signed int int32
;
222 #ifndef TYPEDEF_INT64
223 typedef signed long long int64
;
226 /* define float32/64, float_t */
228 #ifndef TYPEDEF_FLOAT32
229 typedef float float32
;
232 #ifndef TYPEDEF_FLOAT64
233 typedef double float64
;
237 * abstracted floating point type allows for compile time selection of
238 * single or double precision arithmetic. Compiling with -DFLOAT32
239 * selects single precision; the default is double precision.
242 #ifndef TYPEDEF_FLOAT_T
245 typedef float32 float_t
;
246 #else /* default to double precision floating point */
247 typedef float64 float_t
;
250 #endif /* TYPEDEF_FLOAT_T */
252 /* define macro values */
259 #define TRUE 1 /* TRUE */
271 #define ON 1 /* ON = 1 */
274 #define AUTO (-1) /* Auto = -1 */
276 /* define PTRSZ, INLINE */
279 #define PTRSZ sizeof(char*)
282 /* Detect compiler type. */
283 #if defined(__GNUC__) || defined(__lint)
284 #define BWL_COMPILER_GNU
285 #elif defined(__CC_ARM) && __CC_ARM
286 #define BWL_COMPILER_ARMCC
288 #error "Unknown compiler!"
292 #if defined(BWL_COMPILER_MICROSOFT)
293 #define INLINE __inline
294 #elif defined(BWL_COMPILER_GNU)
295 #define INLINE __inline__
296 #elif defined(BWL_COMPILER_ARMCC)
297 #define INLINE __inline
305 #undef TYPEDEF_USHORT
309 #undef TYPEDEF_UINT16
310 #undef TYPEDEF_UINT32
311 #undef TYPEDEF_UINT64
312 #undef TYPEDEF_UINTPTR
317 #undef TYPEDEF_FLOAT32
318 #undef TYPEDEF_FLOAT64
319 #undef TYPEDEF_FLOAT_T
321 #endif /* USE_TYPEDEF_DEFAULTS */
323 /* Suppress unused parameter warning */
324 #define UNUSED_PARAMETER(x) (void)(x)
326 /* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
327 #define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
329 #else /* !EDK_RELEASE_VERSION || (EDK_RELEASE_VERSION < 0x00020000) */
331 #include <sys/types.h>
337 #define stderr stdout
341 typedef UINT16 uint16
;
342 typedef UINT32 uint32
;
343 typedef UINT64 uint64
;
349 typedef BOOLEAN
bool;
350 typedef unsigned char uchar
;
351 typedef UINTN uintptr
;
353 #define UNUSED_PARAMETER(x) (void)(x)
354 #define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
356 #define AUTO (-1) /* Auto = -1 */
357 #define ON 1 /* ON = 1 */
360 #endif /* !EDK_RELEASE_VERSION || (EDK_RELEASE_VERSION < 0x00020000) */
363 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
364 * gets this automatically
367 #endif /* _TYPEDEFS_H_ */