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 613162 2016-01-18 02:14:00Z $
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;
88 #if defined(__FreeBSD__)
89 #include <sys/param.h>
91 #if !defined(__bool_true_false_are_defined)
94 #endif /* (defined(__FreeBSD__)) */
96 #if defined(__sparc__)
101 * If this is either a Linux hybrid build or the per-port code of a hybrid build
102 * then use the Linux header files to get some of the typedefs. Otherwise, define
103 * them entirely in this file. We can't always define the types because we get
104 * a duplicate typedef error; there is no way to "undefine" a typedef.
105 * We know when it's per-port code because each file defines LINUX_PORT at the top.
108 #ifndef TARGETENV_android
109 #define TYPEDEF_USHORT
110 #define TYPEDEF_ULONG
111 #endif /* TARGETENV_android */
113 #include <linux/version.h>
114 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
116 #endif /* >= 2.6.19 */
117 /* special detection for 2.6.18-128.7.1.0.1.el5 */
118 #if (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18))
119 #include <linux/compiler.h>
120 #ifdef noinline_for_stack
123 #endif /* == 2.6.18 */
124 #endif /* __KERNEL__ */
127 /* Do not support the (u)int64 types with strict ansi for GNU C */
128 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
129 #if !defined(__FreeBSD__)
130 #define TYPEDEF_INT64
131 #define TYPEDEF_UINT64
132 #endif /* !defined(__FreeBSD__) */
133 #endif /* defined(__GNUC__) && defined(__STRICT_ANSI__) */
135 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
136 * for signed or unsigned
140 #define TYPEDEF_INT64
142 #if defined(__STDC__)
143 #define TYPEDEF_UINT64
148 #if !defined(__DJGPP__)
150 /* pick up ushort & uint from standard types.h */
151 #if defined(__KERNEL__)
154 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
158 #include <sys/types.h>
160 #endif /* linux && __KERNEL__ */
166 /* use the default typedefs in the next section of this file */
167 #define USE_TYPEDEF_DEFAULTS
169 #endif /* SITE_TYPEDEFS */
176 #ifdef USE_TYPEDEF_DEFAULTS
177 #undef USE_TYPEDEF_DEFAULTS
180 typedef /* @abstract@ */ unsigned char bool;
181 #endif /* endif TYPEDEF_BOOL */
183 /* define uchar, ushort, uint, ulong */
185 #ifndef TYPEDEF_UCHAR
186 typedef unsigned char uchar
;
189 #ifndef TYPEDEF_USHORT
190 typedef unsigned short ushort
;
194 typedef unsigned int uint
;
197 #ifndef TYPEDEF_ULONG
198 typedef unsigned long ulong
;
201 /* define [u]int8/16/32/64, uintptr */
203 #ifndef TYPEDEF_UINT8
204 typedef unsigned char uint8
;
207 #ifndef TYPEDEF_UINT16
208 typedef unsigned short uint16
;
211 #ifndef TYPEDEF_UINT32
212 typedef unsigned int uint32
;
215 #ifndef TYPEDEF_UINT64
216 typedef unsigned long long uint64
;
219 #ifndef TYPEDEF_UINTPTR
220 typedef unsigned int uintptr
;
224 typedef signed char int8
;
227 #ifndef TYPEDEF_INT16
228 typedef signed short int16
;
231 #ifndef TYPEDEF_INT32
232 typedef signed int int32
;
235 #ifndef TYPEDEF_INT64
236 typedef signed long long int64
;
239 /* define float32/64, float_t */
241 #ifndef TYPEDEF_FLOAT32
242 typedef float float32
;
245 #ifndef TYPEDEF_FLOAT64
246 typedef double float64
;
250 * abstracted floating point type allows for compile time selection of
251 * single or double precision arithmetic. Compiling with -DFLOAT32
252 * selects single precision; the default is double precision.
255 #ifndef TYPEDEF_FLOAT_T
258 typedef float32 float_t
;
259 #else /* default to double precision floating point */
260 typedef float64 float_t
;
263 #endif /* TYPEDEF_FLOAT_T */
265 /* define macro values */
272 #define TRUE 1 /* TRUE */
284 #define ON 1 /* ON = 1 */
287 #define AUTO (-1) /* Auto = -1 */
289 /* define PTRSZ, INLINE */
292 #define PTRSZ sizeof(char*)
296 /* Detect compiler type. */
297 #if defined(__GNUC__) || defined(__lint)
298 #define BWL_COMPILER_GNU
299 #elif defined(__CC_ARM) && __CC_ARM
300 #define BWL_COMPILER_ARMCC
302 #error "Unknown compiler!"
307 #if defined(BWL_COMPILER_MICROSOFT)
308 #define INLINE __inline
309 #elif defined(BWL_COMPILER_GNU)
310 #define INLINE __inline__
311 #elif defined(BWL_COMPILER_ARMCC)
312 #define INLINE __inline
320 #undef TYPEDEF_USHORT
324 #undef TYPEDEF_UINT16
325 #undef TYPEDEF_UINT32
326 #undef TYPEDEF_UINT64
327 #undef TYPEDEF_UINTPTR
332 #undef TYPEDEF_FLOAT32
333 #undef TYPEDEF_FLOAT64
334 #undef TYPEDEF_FLOAT_T
336 #endif /* USE_TYPEDEF_DEFAULTS */
338 /* Suppress unused parameter warning */
339 #define UNUSED_PARAMETER(x) (void)(x)
341 /* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
342 #define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
345 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
346 * gets this automatically
349 #endif /* _TYPEDEFS_H_ */