# BRCM_VERSION=3
[bcm963xx.git] / bcmdrivers / broadcom / net / wl / impl1 / include / typedefs.h
1 /*
2  * Copyright 2005, Broadcom Corporation      
3  * All Rights Reserved.      
4  *       
5  * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY      
6  * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM      
7  * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS      
8  * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.      
9  * $Id: typedefs.h,v 1.1.1.1 2005/04/29 01:40:04 echo Exp $
10  */
11
12 #ifndef _TYPEDEFS_H_
13 #define _TYPEDEFS_H_
14
15
16 /* Define 'SITE_TYPEDEFS' in the compile to include a site specific
17  * typedef file "site_typedefs.h".
18  *
19  * If 'SITE_TYPEDEFS' is not defined, then the "Inferred Typedefs"
20  * section of this file makes inferences about the compile environment
21  * based on defined symbols and possibly compiler pragmas.
22  *
23  * Following these two sections is the "Default Typedefs"
24  * section. This section is only prcessed if 'USE_TYPEDEF_DEFAULTS' is
25  * defined. This section has a default set of typedefs and a few
26  * proprocessor symbols (TRUE, FALSE, NULL, ...).
27  */
28
29 #ifdef SITE_TYPEDEFS
30
31 /*******************************************************************************
32  * Site Specific Typedefs
33  *******************************************************************************/
34
35 #include "site_typedefs.h"
36
37 #else
38
39 /*******************************************************************************
40  * Inferred Typedefs
41  *******************************************************************************/
42
43 /* Infer the compile environment based on preprocessor symbols and pramas.
44  * Override type definitions as needed, and include configuration dependent
45  * header files to define types.
46  */
47
48 #ifdef __cplusplus
49
50 #define TYPEDEF_BOOL
51 #ifndef FALSE
52 #define FALSE   false
53 #endif
54 #ifndef TRUE
55 #define TRUE    true
56 #endif
57
58 #else   /* ! __cplusplus */
59
60 #if defined(_WIN32)
61
62 #define TYPEDEF_BOOL
63 typedef unsigned char   bool;                   /* consistent w/BOOL */
64
65 #endif /* _WIN32 */
66
67 #endif  /* ! __cplusplus */
68
69 /* use the Windows ULONG_PTR type when compiling for 64 bit */
70 #if defined(_WIN64)
71 #include <basetsd.h>
72 #define TYPEDEF_UINTPTR
73 typedef ULONG_PTR       uintptr;
74 #endif
75
76 #ifdef _MSC_VER     /* Microsoft C */
77 #define TYPEDEF_INT64
78 #define TYPEDEF_UINT64
79 typedef signed __int64  int64;
80 typedef unsigned __int64 uint64;
81 #endif
82
83 #if defined(MACOSX) && defined(KERNEL)
84 #define TYPEDEF_BOOL
85 #endif
86
87
88 #if defined(linux)
89 #define TYPEDEF_UINT
90 #define TYPEDEF_USHORT
91 #define TYPEDEF_ULONG
92 #endif
93
94 #if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
95 #define TYPEDEF_UINT
96 #define TYPEDEF_USHORT
97 #endif
98
99
100 /* Do not support the (u)int64 types with strict ansi for GNU C */
101 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
102 #define TYPEDEF_INT64
103 #define TYPEDEF_UINT64
104 #endif
105
106 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
107  * for singned or unsigned */
108 #if defined(__ICL)
109
110 #define TYPEDEF_INT64
111
112 #if defined(__STDC__)
113 #define TYPEDEF_UINT64
114 #endif
115
116 #endif /* __ICL */
117
118
119 #if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
120
121 /* pick up ushort & uint from standard types.h */
122 #if defined(linux) && defined(__KERNEL__)
123
124 #include <linux/types.h>        /* sys/types.h and linux/types.h are oil and water */
125
126 #else
127
128 #include <sys/types.h>  
129
130 #endif
131
132 #endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_  && !_MINOSL_ */
133
134 #if defined(MACOSX) && defined(KERNEL)
135 #include <IOKit/IOTypes.h>
136 #endif
137
138
139 /* use the default typedefs in the next section of this file */
140 #define USE_TYPEDEF_DEFAULTS
141
142 #endif /* SITE_TYPEDEFS */
143
144
145 /*******************************************************************************
146  * Default Typedefs
147  *******************************************************************************/
148
149 #ifdef USE_TYPEDEF_DEFAULTS
150 #undef USE_TYPEDEF_DEFAULTS
151
152 #ifndef TYPEDEF_BOOL
153 typedef /*@abstract@*/ unsigned char    bool;
154 #endif
155
156 /*----------------------- define uchar, ushort, uint, ulong ------------------*/
157
158 #ifndef TYPEDEF_UCHAR
159 typedef unsigned char   uchar;
160 #endif
161
162 #ifndef TYPEDEF_USHORT
163 typedef unsigned short  ushort;
164 #endif
165
166 #ifndef TYPEDEF_UINT
167 typedef unsigned int    uint;
168 #endif
169
170 #ifndef TYPEDEF_ULONG
171 typedef unsigned long   ulong;
172 #endif
173
174 /*----------------------- define [u]int8/16/32/64, uintptr --------------------*/
175
176 #ifndef TYPEDEF_UINT8
177 typedef unsigned char   uint8;
178 #endif
179
180 #ifndef TYPEDEF_UINT16
181 typedef unsigned short  uint16;
182 #endif
183
184 #ifndef TYPEDEF_UINT32
185 typedef unsigned int    uint32;
186 #endif
187
188 #ifndef TYPEDEF_UINT64
189 typedef unsigned long long uint64;
190 #endif
191
192 #ifndef TYPEDEF_UINTPTR
193 typedef unsigned int    uintptr;
194 #endif
195
196 #ifndef TYPEDEF_INT8
197 typedef signed char     int8;
198 #endif
199
200 #ifndef TYPEDEF_INT16
201 typedef signed short    int16;
202 #endif
203
204 #ifndef TYPEDEF_INT32
205 typedef signed int      int32;
206 #endif
207
208 #ifndef TYPEDEF_INT64
209 typedef signed long long int64;
210 #endif
211
212 /*----------------------- define float32/64, float_t -----------------------*/
213
214 #ifndef TYPEDEF_FLOAT32
215 typedef float           float32;
216 #endif
217
218 #ifndef TYPEDEF_FLOAT64
219 typedef double          float64;
220 #endif
221
222 /*
223  * abstracted floating point type allows for compile time selection of
224  * single or double precision arithmetic.  Compiling with -DFLOAT32
225  * selects single precision; the default is double precision.
226  */
227
228 #ifndef TYPEDEF_FLOAT_T
229
230 #if defined(FLOAT32)
231 typedef float32 float_t;
232 #else /* default to double precision floating point */
233 typedef float64 float_t;
234 #endif
235
236 #endif /* TYPEDEF_FLOAT_T */
237
238 /*----------------------- define macro values -----------------------------*/
239
240 #ifndef FALSE
241 #define FALSE   0
242 #endif
243
244 #ifndef TRUE
245 #define TRUE    1
246 #endif
247
248 #ifndef NULL
249 #define NULL    0
250 #endif
251
252 #ifndef OFF
253 #define OFF     0
254 #endif
255
256 #ifndef ON
257 #define ON      1
258 #endif
259
260 #define AUTO    (-1)
261
262 /* Reclaiming text and data :
263    The following macros specify special linker sections that can be reclaimed
264    after a system is considered 'up'.
265  */ 
266 #if defined(__GNUC__) && defined(BCMRECLAIM)
267 extern bool     bcmreclaimed;
268 #define BCMINITDATA(_data)      __attribute__ ((__section__ (".dataini." #_data))) _data##_ini          
269 #define BCMINITFN(_fn)          __attribute__ ((__section__ (".textini." #_fn))) _fn##_ini
270 #define BCMINIT(_id)            _id##_ini
271 #else 
272 #define BCMINITDATA(_data)      _data           
273 #define BCMINITFN(_fn)          _fn
274 #define BCMINIT(_id)            _id
275 #define bcmreclaimed            0
276 #endif
277
278 /*----------------------- define PTRSZ, INLINE ----------------------------*/
279
280 #ifndef PTRSZ
281 #define PTRSZ   sizeof (char*)
282 #endif
283
284 #ifndef INLINE
285
286 #ifdef _MSC_VER
287
288 #define INLINE __inline
289
290 #elif __GNUC__
291
292 #define INLINE __inline__
293
294 #else
295
296 #define INLINE
297
298 #endif /* _MSC_VER */
299
300 #endif /* INLINE */
301
302 #undef TYPEDEF_BOOL
303 #undef TYPEDEF_UCHAR
304 #undef TYPEDEF_USHORT
305 #undef TYPEDEF_UINT
306 #undef TYPEDEF_ULONG
307 #undef TYPEDEF_UINT8
308 #undef TYPEDEF_UINT16
309 #undef TYPEDEF_UINT32
310 #undef TYPEDEF_UINT64
311 #undef TYPEDEF_UINTPTR
312 #undef TYPEDEF_INT8
313 #undef TYPEDEF_INT16
314 #undef TYPEDEF_INT32
315 #undef TYPEDEF_INT64
316 #undef TYPEDEF_FLOAT32
317 #undef TYPEDEF_FLOAT64
318 #undef TYPEDEF_FLOAT_T
319
320 #endif /* USE_TYPEDEF_DEFAULTS */
321
322 #endif /* _TYPEDEFS_H_ */