convert brcm-2.4 to the new target structure
[openwrt/staging/yousong.git] / target / linux / brcm-2.4 / files / arch / mips / bcm947xx / include / typedefs.h
1 /*
2 * Copyright 2006, 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.12 2006/04/08 06:13:40 honor 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
36 #include "site_typedefs.h"
37
38 #else
39
40 /*
41 * Inferred Typedefs
42 *
43 */
44
45 /* Infer the compile environment based on preprocessor symbols and pramas.
46 * Override type definitions as needed, and include configuration dependent
47 * header files to define types.
48 */
49
50 #ifdef __cplusplus
51
52 #define TYPEDEF_BOOL
53 #ifndef FALSE
54 #define FALSE false
55 #endif
56 #ifndef TRUE
57 #define TRUE true
58 #endif
59
60 #else /* ! __cplusplus */
61
62 #if defined(_WIN32)
63
64 #define TYPEDEF_BOOL
65 typedef unsigned char bool; /* consistent w/BOOL */
66
67 #endif /* _WIN32 */
68
69 #endif /* ! __cplusplus */
70
71 /* use the Windows ULONG_PTR type when compiling for 64 bit */
72 #if defined(_WIN64)
73 #include <basetsd.h>
74 #define TYPEDEF_UINTPTR
75 typedef ULONG_PTR uintptr;
76 #endif
77
78
79 #if defined(_MINOSL_)
80 #define _NEED_SIZE_T_
81 #endif
82
83 #if defined(_NEED_SIZE_T_)
84 typedef long unsigned int size_t;
85 #endif
86
87 #ifdef __DJGPP__
88 typedef long unsigned int size_t;
89 #endif /* __DJGPP__ */
90
91 #ifdef _MSC_VER /* Microsoft C */
92 #define TYPEDEF_INT64
93 #define TYPEDEF_UINT64
94 typedef signed __int64 int64;
95 typedef unsigned __int64 uint64;
96 #endif
97
98 #if defined(MACOSX)
99 #define TYPEDEF_BOOL
100 #endif
101
102 #if defined(__NetBSD__)
103 #define TYPEDEF_ULONG
104 #endif
105
106
107 #if defined(linux)
108 #define TYPEDEF_UINT
109 #define TYPEDEF_USHORT
110 #define TYPEDEF_ULONG
111 #endif
112
113 #if !defined(linux) && !defined(_WIN32) && !defined(_CFE_) && \
114 !defined(_HNDRTE_) && !defined(_MINOSL_) && !defined(__DJGPP__)
115 #define TYPEDEF_UINT
116 #define TYPEDEF_USHORT
117 #endif
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
125
126 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
127 * for singned 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(_WIN32) && !defined(_CFE_) && !defined(_MINOSL_) && \
140 !defined(__DJGPP__)
141
142 /* pick up ushort & uint from standard types.h */
143 #if defined(linux) && defined(__KERNEL__)
144
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
152
153 #endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_ && !_MINOSL_ && !__DJGPP__ */
154
155 #if defined(MACOSX)
156
157 #ifdef __BIG_ENDIAN__
158 #define IL_BIGENDIAN
159 #else
160 #ifdef IL_BIGENDIAN
161 #error "IL_BIGENDIAN was defined for a little-endian compile"
162 #endif
163 #endif /* __BIG_ENDIAN__ */
164
165 #if !defined(__cplusplus)
166
167 #if defined(__i386__)
168 typedef unsigned char bool;
169 #else
170 typedef unsigned int bool;
171 #endif
172 #define TYPE_BOOL 1
173 enum {
174 false = 0,
175 true = 1
176 };
177
178 #if defined(KERNEL)
179 #include <IOKit/IOTypes.h>
180 #endif /* KERNEL */
181
182 #endif /* __cplusplus */
183
184 #endif /* MACOSX */
185
186
187 /* use the default typedefs in the next section of this file */
188 #define USE_TYPEDEF_DEFAULTS
189
190 #endif /* SITE_TYPEDEFS */
191
192
193 /*
194 * Default Typedefs
195 *
196 */
197
198 #ifdef USE_TYPEDEF_DEFAULTS
199 #undef USE_TYPEDEF_DEFAULTS
200
201 #ifndef TYPEDEF_BOOL
202 typedef /* @abstract@ */ unsigned char bool;
203 #endif
204
205 /* define uchar, ushort, uint, ulong */
206
207 #ifndef TYPEDEF_UCHAR
208 typedef unsigned char uchar;
209 #endif
210
211 #ifndef TYPEDEF_USHORT
212 typedef unsigned short ushort;
213 #endif
214
215 #ifndef TYPEDEF_UINT
216 typedef unsigned int uint;
217 #endif
218
219 #ifndef TYPEDEF_ULONG
220 typedef unsigned long ulong;
221 #endif
222
223 /* define [u]int8/16/32/64, uintptr */
224
225 #ifndef TYPEDEF_UINT8
226 typedef unsigned char uint8;
227 #endif
228
229 #ifndef TYPEDEF_UINT16
230 typedef unsigned short uint16;
231 #endif
232
233 #ifndef TYPEDEF_UINT32
234 typedef unsigned int uint32;
235 #endif
236
237 #ifndef TYPEDEF_UINT64
238 typedef unsigned long long uint64;
239 #endif
240
241 #ifndef TYPEDEF_UINTPTR
242 typedef unsigned int uintptr;
243 #endif
244
245 #ifndef TYPEDEF_INT8
246 typedef signed char int8;
247 #endif
248
249 #ifndef TYPEDEF_INT16
250 typedef signed short int16;
251 #endif
252
253 #ifndef TYPEDEF_INT32
254 typedef signed int int32;
255 #endif
256
257 #ifndef TYPEDEF_INT64
258 typedef signed long long int64;
259 #endif
260
261 /* define float32/64, float_t */
262
263 #ifndef TYPEDEF_FLOAT32
264 typedef float float32;
265 #endif
266
267 #ifndef TYPEDEF_FLOAT64
268 typedef double float64;
269 #endif
270
271 /*
272 * abstracted floating point type allows for compile time selection of
273 * single or double precision arithmetic. Compiling with -DFLOAT32
274 * selects single precision; the default is double precision.
275 */
276
277 #ifndef TYPEDEF_FLOAT_T
278
279 #if defined(FLOAT32)
280 typedef float32 float_t;
281 #else /* default to double precision floating point */
282 typedef float64 float_t;
283 #endif
284
285 #endif /* TYPEDEF_FLOAT_T */
286
287 /* define macro values */
288
289 #ifndef FALSE
290 #define FALSE 0
291 #endif
292
293 #ifndef TRUE
294 #define TRUE 1 /* TRUE */
295 #endif
296
297 #ifndef NULL
298 #define NULL 0
299 #endif
300
301 #ifndef OFF
302 #define OFF 0
303 #endif
304
305 #ifndef ON
306 #define ON 1 /* ON = 1 */
307 #endif
308
309 #define AUTO (-1) /* Auto = -1 */
310
311 /* define PTRSZ, INLINE */
312
313 #ifndef PTRSZ
314 #define PTRSZ sizeof(char*)
315 #endif
316
317 #ifndef INLINE
318
319 #ifdef _MSC_VER
320
321 #define INLINE __inline
322
323 #elif __GNUC__
324
325 #define INLINE __inline__
326
327 #else
328
329 #define INLINE
330
331 #endif /* _MSC_VER */
332
333 #endif /* INLINE */
334
335 #undef TYPEDEF_BOOL
336 #undef TYPEDEF_UCHAR
337 #undef TYPEDEF_USHORT
338 #undef TYPEDEF_UINT
339 #undef TYPEDEF_ULONG
340 #undef TYPEDEF_UINT8
341 #undef TYPEDEF_UINT16
342 #undef TYPEDEF_UINT32
343 #undef TYPEDEF_UINT64
344 #undef TYPEDEF_UINTPTR
345 #undef TYPEDEF_INT8
346 #undef TYPEDEF_INT16
347 #undef TYPEDEF_INT32
348 #undef TYPEDEF_INT64
349 #undef TYPEDEF_FLOAT32
350 #undef TYPEDEF_FLOAT64
351 #undef TYPEDEF_FLOAT_T
352
353 #endif /* USE_TYPEDEF_DEFAULTS */
354
355 /*
356 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
357 * gets this automatically
358 */
359 #include "bcmdefs.h"
360
361 #endif /* _TYPEDEFS_H_ */