net: wifi: rockchip: update broadcom drivers for kernel4.4
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / 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 514727 2014-11-12 03:02:48Z $
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
89 #if defined(__sparc__)
90 #define TYPEDEF_ULONG
91 #endif
92
93 /*
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.
99  */
100 #define TYPEDEF_UINT
101 #ifndef TARGETENV_android
102 #define TYPEDEF_USHORT
103 #define TYPEDEF_ULONG
104 #endif /* TARGETENV_android */
105 #ifdef __KERNEL__
106 #include <linux/version.h>
107 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
108 #define TYPEDEF_BOOL
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
114 #define TYPEDEF_BOOL
115 #endif
116 #endif  /* == 2.6.18 */
117 #endif  /* __KERNEL__ */
118
119
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__) */
125
126 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
127  * for signed or unsigned
128  */
129 #if defined(__ICL)
130
131 #define TYPEDEF_INT64
132
133 #if defined(__STDC__)
134 #define TYPEDEF_UINT64
135 #endif
136
137 #endif /* __ICL */
138
139 #if !defined(__DJGPP__)
140
141 /* pick up ushort & uint from standard types.h */
142 #if defined(__KERNEL__)
143
144 /* See note above */
145 #include <linux/types.h>        /* sys/types.h and linux/types.h are oil and water */
146
147 #else
148
149 #include <sys/types.h>
150
151 #endif /* linux && __KERNEL__ */
152
153 #endif 
154
155
156 /* use the default typedefs in the next section of this file */
157 #define USE_TYPEDEF_DEFAULTS
158
159 #endif /* SITE_TYPEDEFS */
160
161
162 /*
163  * Default Typedefs
164  */
165
166 #ifdef USE_TYPEDEF_DEFAULTS
167 #undef USE_TYPEDEF_DEFAULTS
168
169 #ifndef TYPEDEF_BOOL
170 typedef /* @abstract@ */ unsigned char  bool;
171 #endif /* endif TYPEDEF_BOOL */
172
173 /* define uchar, ushort, uint, ulong */
174
175 #ifndef TYPEDEF_UCHAR
176 typedef unsigned char   uchar;
177 #endif
178
179 #ifndef TYPEDEF_USHORT
180 typedef unsigned short  ushort;
181 #endif
182
183 #ifndef TYPEDEF_UINT
184 typedef unsigned int    uint;
185 #endif
186
187 #ifndef TYPEDEF_ULONG
188 typedef unsigned long   ulong;
189 #endif
190
191 /* define [u]int8/16/32/64, uintptr */
192
193 #ifndef TYPEDEF_UINT8
194 typedef unsigned char   uint8;
195 #endif
196
197 #ifndef TYPEDEF_UINT16
198 typedef unsigned short  uint16;
199 #endif
200
201 #ifndef TYPEDEF_UINT32
202 typedef unsigned int    uint32;
203 #endif
204
205 #ifndef TYPEDEF_UINT64
206 typedef unsigned long long uint64;
207 #endif
208
209 #ifndef TYPEDEF_UINTPTR
210 typedef unsigned int    uintptr;
211 #endif
212
213 #ifndef TYPEDEF_INT8
214 typedef signed char     int8;
215 #endif
216
217 #ifndef TYPEDEF_INT16
218 typedef signed short    int16;
219 #endif
220
221 #ifndef TYPEDEF_INT32
222 typedef signed int      int32;
223 #endif
224
225 #ifndef TYPEDEF_INT64
226 typedef signed long long int64;
227 #endif
228
229 /* define float32/64, float_t */
230
231 #ifndef TYPEDEF_FLOAT32
232 typedef float           float32;
233 #endif
234
235 #ifndef TYPEDEF_FLOAT64
236 typedef double          float64;
237 #endif
238
239 /*
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.
243  */
244
245 #ifndef TYPEDEF_FLOAT_T
246
247 #if defined(FLOAT32)
248 typedef float32 float_t;
249 #else /* default to double precision floating point */
250 typedef float64 float_t;
251 #endif
252
253 #endif /* TYPEDEF_FLOAT_T */
254
255 /* define macro values */
256
257 #ifndef FALSE
258 #define FALSE   0
259 #endif
260
261 #ifndef TRUE
262 #define TRUE    1  /* TRUE */
263 #endif
264
265 #ifndef NULL
266 #define NULL    0
267 #endif
268
269 #ifndef OFF
270 #define OFF     0
271 #endif
272
273 #ifndef ON
274 #define ON      1  /* ON = 1 */
275 #endif
276
277 #define AUTO    (-1) /* Auto = -1 */
278
279 /* define PTRSZ, INLINE */
280
281 #ifndef PTRSZ
282 #define PTRSZ   sizeof(char*)
283 #endif
284
285
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
291 #else
292         #error "Unknown compiler!"
293 #endif 
294
295
296 #ifndef INLINE
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
303         #else
304                 #define INLINE
305         #endif 
306 #endif /* INLINE */
307
308 #undef TYPEDEF_BOOL
309 #undef TYPEDEF_UCHAR
310 #undef TYPEDEF_USHORT
311 #undef TYPEDEF_UINT
312 #undef TYPEDEF_ULONG
313 #undef TYPEDEF_UINT8
314 #undef TYPEDEF_UINT16
315 #undef TYPEDEF_UINT32
316 #undef TYPEDEF_UINT64
317 #undef TYPEDEF_UINTPTR
318 #undef TYPEDEF_INT8
319 #undef TYPEDEF_INT16
320 #undef TYPEDEF_INT32
321 #undef TYPEDEF_INT64
322 #undef TYPEDEF_FLOAT32
323 #undef TYPEDEF_FLOAT64
324 #undef TYPEDEF_FLOAT_T
325
326 #endif /* USE_TYPEDEF_DEFAULTS */
327
328 /* Suppress unused parameter warning */
329 #define UNUSED_PARAMETER(x) (void)(x)
330
331 /* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
332 #define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
333
334 /*
335  * Including the bcmdefs.h here, to make sure everyone including typedefs.h
336  * gets this automatically
337 */
338 #include <bcmdefs.h>
339 #endif /* _TYPEDEFS_H_ */