adt3-S dhd_driver source code [1/1]
[GitHub/LineageOS/G12/android_hardware_amlogic_kernel-modules_dhd-driver.git] / bcmdhd-usb.1.363.110.17.x / include / typedefs.h
1 /*
2 * Copyright (C) 1999-2016, Broadcom Corporation
3 *
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:
9 *
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.
17 *
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 *
22 *
23 * <<Broadcom-WL-IPTag/Open:>>
24 *
25 * $Id: typedefs.h 613162 2016-01-18 02:14:00Z $
26 */
27
28 #ifndef _TYPEDEFS_H_
29 #define _TYPEDEFS_H_
30
31 #ifdef SITE_TYPEDEFS
32
33 /*
34 * Define SITE_TYPEDEFS in the compile to include a site-specific
35 * typedef file "site_typedefs.h".
36 *
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.
40 *
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, ...).
45 */
46
47 #include "site_typedefs.h"
48
49 #else
50
51 /*
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.
55 */
56
57 #ifdef __cplusplus
58
59 #define TYPEDEF_BOOL
60 #ifndef FALSE
61 #define FALSE false
62 #endif
63 #ifndef TRUE
64 #define TRUE true
65 #endif
66
67 #else /* ! __cplusplus */
68
69
70 #endif /* ! __cplusplus */
71
72 #if defined(__LP64__)
73 #define TYPEDEF_UINTPTR
74 typedef unsigned long long int uintptr;
75 #endif
76
77
78
79
80
81 #if defined(_NEED_SIZE_T_)
82 typedef long unsigned int size_t;
83 #endif
84
85
86
87
88 #if defined(__FreeBSD__)
89 #include <sys/param.h>
90 #define TYPEDEF_BOOL
91 #if !defined(__bool_true_false_are_defined)
92 typedef int bool;
93 #endif
94 #endif /* (defined(__FreeBSD__)) */
95
96 #if defined(__sparc__)
97 #define TYPEDEF_ULONG
98 #endif
99
100 /*
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.
106 */
107 #define TYPEDEF_UINT
108 #ifndef TARGETENV_android
109 #define TYPEDEF_USHORT
110 #define TYPEDEF_ULONG
111 #endif /* TARGETENV_android */
112 #ifdef __KERNEL__
113 #include <linux/version.h>
114 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
115 #define TYPEDEF_BOOL
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
121 #define TYPEDEF_BOOL
122 #endif
123 #endif /* == 2.6.18 */
124 #endif /* __KERNEL__ */
125
126
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__) */
134
135 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
136 * for signed or unsigned
137 */
138 #if defined(__ICL)
139
140 #define TYPEDEF_INT64
141
142 #if defined(__STDC__)
143 #define TYPEDEF_UINT64
144 #endif
145
146 #endif /* __ICL */
147
148 #if !defined(__DJGPP__)
149
150 /* pick up ushort & uint from standard types.h */
151 #if defined(__KERNEL__)
152
153 /* See note above */
154 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
155
156 #else
157
158 #include <sys/types.h>
159
160 #endif /* linux && __KERNEL__ */
161
162 #endif
163
164
165
166 /* use the default typedefs in the next section of this file */
167 #define USE_TYPEDEF_DEFAULTS
168
169 #endif /* SITE_TYPEDEFS */
170
171
172 /*
173 * Default Typedefs
174 */
175
176 #ifdef USE_TYPEDEF_DEFAULTS
177 #undef USE_TYPEDEF_DEFAULTS
178
179 #ifndef TYPEDEF_BOOL
180 typedef /* @abstract@ */ unsigned char bool;
181 #endif /* endif TYPEDEF_BOOL */
182
183 /* define uchar, ushort, uint, ulong */
184
185 #ifndef TYPEDEF_UCHAR
186 typedef unsigned char uchar;
187 #endif
188
189 #ifndef TYPEDEF_USHORT
190 typedef unsigned short ushort;
191 #endif
192
193 #ifndef TYPEDEF_UINT
194 typedef unsigned int uint;
195 #endif
196
197 #ifndef TYPEDEF_ULONG
198 typedef unsigned long ulong;
199 #endif
200
201 /* define [u]int8/16/32/64, uintptr */
202
203 #ifndef TYPEDEF_UINT8
204 typedef unsigned char uint8;
205 #endif
206
207 #ifndef TYPEDEF_UINT16
208 typedef unsigned short uint16;
209 #endif
210
211 #ifndef TYPEDEF_UINT32
212 typedef unsigned int uint32;
213 #endif
214
215 #ifndef TYPEDEF_UINT64
216 typedef unsigned long long uint64;
217 #endif
218
219 #ifndef TYPEDEF_UINTPTR
220 typedef unsigned int uintptr;
221 #endif
222
223 #ifndef TYPEDEF_INT8
224 typedef signed char int8;
225 #endif
226
227 #ifndef TYPEDEF_INT16
228 typedef signed short int16;
229 #endif
230
231 #ifndef TYPEDEF_INT32
232 typedef signed int int32;
233 #endif
234
235 #ifndef TYPEDEF_INT64
236 typedef signed long long int64;
237 #endif
238
239 /* define float32/64, float_t */
240
241 #ifndef TYPEDEF_FLOAT32
242 typedef float float32;
243 #endif
244
245 #ifndef TYPEDEF_FLOAT64
246 typedef double float64;
247 #endif
248
249 /*
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.
253 */
254
255 #ifndef TYPEDEF_FLOAT_T
256
257 #if defined(FLOAT32)
258 typedef float32 float_t;
259 #else /* default to double precision floating point */
260 typedef float64 float_t;
261 #endif
262
263 #endif /* TYPEDEF_FLOAT_T */
264
265 /* define macro values */
266
267 #ifndef FALSE
268 #define FALSE 0
269 #endif
270
271 #ifndef TRUE
272 #define TRUE 1 /* TRUE */
273 #endif
274
275 #ifndef NULL
276 #define NULL 0
277 #endif
278
279 #ifndef OFF
280 #define OFF 0
281 #endif
282
283 #ifndef ON
284 #define ON 1 /* ON = 1 */
285 #endif
286
287 #define AUTO (-1) /* Auto = -1 */
288
289 /* define PTRSZ, INLINE */
290
291 #ifndef PTRSZ
292 #define PTRSZ sizeof(char*)
293 #endif
294
295
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
301 #else
302 #error "Unknown compiler!"
303 #endif
304
305
306 #ifndef INLINE
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
313 #else
314 #define INLINE
315 #endif
316 #endif /* INLINE */
317
318 #undef TYPEDEF_BOOL
319 #undef TYPEDEF_UCHAR
320 #undef TYPEDEF_USHORT
321 #undef TYPEDEF_UINT
322 #undef TYPEDEF_ULONG
323 #undef TYPEDEF_UINT8
324 #undef TYPEDEF_UINT16
325 #undef TYPEDEF_UINT32
326 #undef TYPEDEF_UINT64
327 #undef TYPEDEF_UINTPTR
328 #undef TYPEDEF_INT8
329 #undef TYPEDEF_INT16
330 #undef TYPEDEF_INT32
331 #undef TYPEDEF_INT64
332 #undef TYPEDEF_FLOAT32
333 #undef TYPEDEF_FLOAT64
334 #undef TYPEDEF_FLOAT_T
335
336 #endif /* USE_TYPEDEF_DEFAULTS */
337
338 /* Suppress unused parameter warning */
339 #define UNUSED_PARAMETER(x) (void)(x)
340
341 /* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
342 #define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
343
344 /*
345 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
346 * gets this automatically
347 */
348 #include <bcmdefs.h>
349 #endif /* _TYPEDEFS_H_ */