added files
[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$
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 _HNDRTE_
77 typedef long unsigned int size_t;
78 #endif
79
80 #ifdef _MSC_VER     /* Microsoft C */
81 #define TYPEDEF_INT64
82 #define TYPEDEF_UINT64
83 typedef signed __int64  int64;
84 typedef unsigned __int64 uint64;
85 #endif
86
87 #if defined(MACOSX) && defined(KERNEL)
88 #define TYPEDEF_BOOL
89 #endif
90
91
92 #if defined(linux)
93 #define TYPEDEF_UINT
94 #define TYPEDEF_USHORT
95 #define TYPEDEF_ULONG
96 #endif
97
98 #if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
99 #define TYPEDEF_UINT
100 #define TYPEDEF_USHORT
101 #endif
102
103
104 /* Do not support the (u)int64 types with strict ansi for GNU C */
105 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
106 #define TYPEDEF_INT64
107 #define TYPEDEF_UINT64
108 #endif
109
110 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
111  * for singned or unsigned */
112 #if defined(__ICL)
113
114 #define TYPEDEF_INT64
115
116 #if defined(__STDC__)
117 #define TYPEDEF_UINT64
118 #endif
119
120 #endif /* __ICL */
121
122
123 #if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
124
125 /* pick up ushort & uint from standard types.h */
126 #if defined(linux) && defined(__KERNEL__)
127
128 #include <linux/types.h>        /* sys/types.h and linux/types.h are oil and water */
129
130 #else
131
132 #include <sys/types.h>  
133
134 #endif
135
136 #endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_  && !_MINOSL_ */
137
138 #if defined(MACOSX) && defined(KERNEL)
139 #include <IOKit/IOTypes.h>
140 #endif
141
142
143 /* use the default typedefs in the next section of this file */
144 #define USE_TYPEDEF_DEFAULTS
145
146 #endif /* SITE_TYPEDEFS */
147
148
149 /*******************************************************************************
150  * Default Typedefs
151  *******************************************************************************/
152
153 #ifdef USE_TYPEDEF_DEFAULTS
154 #undef USE_TYPEDEF_DEFAULTS
155
156 #ifndef TYPEDEF_BOOL
157 typedef /*@abstract@*/ unsigned char    bool;
158 #endif
159
160 /*----------------------- define uchar, ushort, uint, ulong ------------------*/
161
162 #ifndef TYPEDEF_UCHAR
163 typedef unsigned char   uchar;
164 #endif
165
166 #ifndef TYPEDEF_USHORT
167 typedef unsigned short  ushort;
168 #endif
169
170 #ifndef TYPEDEF_UINT
171 typedef unsigned int    uint;
172 #endif
173
174 #ifndef TYPEDEF_ULONG
175 typedef unsigned long   ulong;
176 #endif
177
178 /*----------------------- define [u]int8/16/32/64, uintptr --------------------*/
179
180 #ifndef TYPEDEF_UINT8
181 typedef unsigned char   uint8;
182 #endif
183
184 #ifndef TYPEDEF_UINT16
185 typedef unsigned short  uint16;
186 #endif
187
188 #ifndef TYPEDEF_UINT32
189 typedef unsigned int    uint32;
190 #endif
191
192 #ifndef TYPEDEF_UINT64
193 typedef unsigned long long uint64;
194 #endif
195
196 #ifndef TYPEDEF_UINTPTR
197 typedef unsigned int    uintptr;
198 #endif
199
200 #ifndef TYPEDEF_INT8
201 typedef signed char     int8;
202 #endif
203
204 #ifndef TYPEDEF_INT16
205 typedef signed short    int16;
206 #endif
207
208 #ifndef TYPEDEF_INT32
209 typedef signed int      int32;
210 #endif
211
212 #ifndef TYPEDEF_INT64
213 typedef signed long long int64;
214 #endif
215
216 /*----------------------- define float32/64, float_t -----------------------*/
217
218 #ifndef TYPEDEF_FLOAT32
219 typedef float           float32;
220 #endif
221
222 #ifndef TYPEDEF_FLOAT64
223 typedef double          float64;
224 #endif
225
226 /*
227  * abstracted floating point type allows for compile time selection of
228  * single or double precision arithmetic.  Compiling with -DFLOAT32
229  * selects single precision; the default is double precision.
230  */
231
232 #ifndef TYPEDEF_FLOAT_T
233
234 #if defined(FLOAT32)
235 typedef float32 float_t;
236 #else /* default to double precision floating point */
237 typedef float64 float_t;
238 #endif
239
240 #endif /* TYPEDEF_FLOAT_T */
241
242 /*----------------------- define macro values -----------------------------*/
243
244 #ifndef FALSE
245 #define FALSE   0
246 #endif
247
248 #ifndef TRUE
249 #define TRUE    1
250 #endif
251
252 #ifndef NULL
253 #define NULL    0
254 #endif
255
256 #ifndef OFF
257 #define OFF     0
258 #endif
259
260 #ifndef ON
261 #define ON      1
262 #endif
263
264 #define AUTO    (-1)
265
266 /* Reclaiming text and data :
267    The following macros specify special linker sections that can be reclaimed
268    after a system is considered 'up'.
269  */ 
270 #if defined(__GNUC__) && defined(BCMRECLAIM)
271 extern bool     bcmreclaimed;
272 #define BCMINITDATA(_data)      __attribute__ ((__section__ (".dataini." #_data))) _data##_ini          
273 #define BCMINITFN(_fn)          __attribute__ ((__section__ (".textini." #_fn))) _fn##_ini
274 #define BCMINIT(_id)            _id##_ini
275 #else 
276 #define BCMINITDATA(_data)      _data           
277 #define BCMINITFN(_fn)          _fn
278 #define BCMINIT(_id)            _id
279 #define bcmreclaimed            0
280 #endif
281
282 /*----------------------- define PTRSZ, INLINE ----------------------------*/
283
284 #ifndef PTRSZ
285 #define PTRSZ   sizeof (char*)
286 #endif
287
288 #ifndef INLINE
289
290 #ifdef _MSC_VER
291
292 #define INLINE __inline
293
294 #elif __GNUC__
295
296 #define INLINE __inline__
297
298 #else
299
300 #define INLINE
301
302 #endif /* _MSC_VER */
303
304 #endif /* INLINE */
305
306 #undef TYPEDEF_BOOL
307 #undef TYPEDEF_UCHAR
308 #undef TYPEDEF_USHORT
309 #undef TYPEDEF_UINT
310 #undef TYPEDEF_ULONG
311 #undef TYPEDEF_UINT8
312 #undef TYPEDEF_UINT16
313 #undef TYPEDEF_UINT32
314 #undef TYPEDEF_UINT64
315 #undef TYPEDEF_UINTPTR
316 #undef TYPEDEF_INT8
317 #undef TYPEDEF_INT16
318 #undef TYPEDEF_INT32
319 #undef TYPEDEF_INT64
320 #undef TYPEDEF_FLOAT32
321 #undef TYPEDEF_FLOAT64
322 #undef TYPEDEF_FLOAT_T
323
324 #endif /* USE_TYPEDEF_DEFAULTS */
325
326 #endif /* _TYPEDEFS_H_ */