]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/brcm80211/include/typedefs.h
f7d1a5e7efc05567f144f7a4489366b9a81799cd
[karo-tx-linux.git] / drivers / staging / brcm80211 / include / typedefs.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _TYPEDEFS_H_
18 #define _TYPEDEFS_H_
19
20 /*
21  * Infer the compile environment based on preprocessor symbols and pragmas.
22  * Override type definitions as needed, and include configuration-dependent
23  * header files to define types.
24  */
25
26 #if defined(__x86_64__)
27 #define TYPEDEF_UINTPTR
28 typedef unsigned long long int uintptr;
29 #endif
30
31 #if defined(_NEED_SIZE_T_)
32 typedef long unsigned int size_t;
33 #endif
34
35 #define TYPEDEF_UINT
36 #define TYPEDEF_USHORT
37 #define TYPEDEF_ULONG
38 #include <linux/version.h>
39 #define TYPEDEF_BOOL
40
41 /* Do not support the (u)int64 types with strict ansi for GNU C */
42 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
43 #define TYPEDEF_INT64
44 #define TYPEDEF_UINT64
45 #endif
46
47 #include <linux/types.h>
48
49 /*
50  * Default Typedefs
51  */
52 #ifndef TYPEDEF_BOOL
53 typedef /* @abstract@ */ unsigned char bool;
54 #endif
55
56 /* define uchar, ushort, uint, ulong */
57
58 #ifndef TYPEDEF_UCHAR
59 typedef unsigned char uchar;
60 #endif
61
62 #ifndef TYPEDEF_USHORT
63 typedef unsigned short ushort;
64 #endif
65
66 #ifndef TYPEDEF_UINT
67 typedef unsigned int uint;
68 #endif
69
70 #ifndef TYPEDEF_ULONG
71 typedef unsigned long ulong;
72 #endif
73
74 /* define [u]int8/16/32/64, uintptr */
75
76 #ifndef TYPEDEF_UINT8
77 typedef unsigned char uint8;
78 #endif
79
80 #ifndef TYPEDEF_UINT16
81 typedef unsigned short uint16;
82 #endif
83
84 #ifndef TYPEDEF_UINT32
85 typedef unsigned int uint32;
86 #endif
87
88 #ifndef TYPEDEF_UINT64
89 typedef unsigned long long uint64;
90 #endif
91
92 #ifndef TYPEDEF_UINTPTR
93 typedef unsigned int uintptr;
94 #endif
95
96 #ifndef TYPEDEF_INT8
97 typedef signed char int8;
98 #endif
99
100 #ifndef TYPEDEF_INT16
101 typedef signed short int16;
102 #endif
103
104 #ifndef TYPEDEF_INT32
105 typedef signed int int32;
106 #endif
107
108 #ifndef TYPEDEF_INT64
109 typedef signed long long int64;
110 #endif
111
112 /* define float32/64, float_t */
113
114 #ifndef TYPEDEF_FLOAT32
115 typedef float float32;
116 #endif
117
118 #ifndef TYPEDEF_FLOAT64
119 typedef double float64;
120 #endif
121
122 /*
123  * abstracted floating point type allows for compile time selection of
124  * single or double precision arithmetic.  Compiling with -DFLOAT32
125  * selects single precision; the default is double precision.
126  */
127
128 #ifndef TYPEDEF_FLOAT_T
129
130 #if defined(FLOAT32)
131 typedef float32 float_t;
132 #else                           /* default to double precision floating point */
133 typedef float64 float_t;
134 #endif
135
136 #endif                          /* TYPEDEF_FLOAT_T */
137
138 /* define macro values */
139
140 #ifndef FALSE
141 #define FALSE   0
142 #endif
143
144 #ifndef TRUE
145 #define TRUE    1               /* TRUE */
146 #endif
147
148 #ifndef NULL
149 #define NULL    0
150 #endif
151
152 #ifndef OFF
153 #define OFF     0
154 #endif
155
156 #ifndef ON
157 #define ON      1               /* ON = 1 */
158 #endif
159
160 #define AUTO    (-1)            /* Auto = -1 */
161
162 /* define PTRSZ, INLINE */
163
164 #ifndef PTRSZ
165 #define PTRSZ   sizeof(char*)
166 #endif
167
168 /* Detect compiler type. */
169 #if defined(__GNUC__)
170 #define BWL_COMPILER_GNU
171 #elif defined(__CC_ARM) && __CC_ARM
172 #define BWL_COMPILER_ARMCC
173 #else
174 #error "Unknown compiler!"
175 #endif
176
177 #ifndef INLINE
178 #if defined(BWL_COMPILER_GNU)
179 #define INLINE __inline__
180 #elif defined(BWL_COMPILER_ARMCC)
181 #define INLINE  __inline
182 #else
183 #define INLINE
184 #endif
185 #endif                          /* INLINE */
186
187 #undef TYPEDEF_BOOL
188 #undef TYPEDEF_UCHAR
189 #undef TYPEDEF_USHORT
190 #undef TYPEDEF_UINT
191 #undef TYPEDEF_ULONG
192 #undef TYPEDEF_UINT8
193 #undef TYPEDEF_UINT16
194 #undef TYPEDEF_UINT32
195 #undef TYPEDEF_UINT64
196 #undef TYPEDEF_UINTPTR
197 #undef TYPEDEF_INT8
198 #undef TYPEDEF_INT16
199 #undef TYPEDEF_INT32
200 #undef TYPEDEF_INT64
201 #undef TYPEDEF_FLOAT32
202 #undef TYPEDEF_FLOAT64
203 #undef TYPEDEF_FLOAT_T
204
205 /* Suppress unused parameter warning */
206 #define UNUSED_PARAMETER(x) (void)(x)
207
208 /*
209  * Including the bcmdefs.h here, to make sure everyone including typedefs.h
210  * gets this automatically
211 */
212 #include <bcmdefs.h>
213
214 #endif                          /* _TYPEDEFS_H_ */