2 * Copyright 2005, Broadcom Corporation
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.
16 /* Define 'SITE_TYPEDEFS' in the compile to include a site specific
17 * typedef file "site_typedefs.h".
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.
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, ...).
31 /*******************************************************************************
32 * Site Specific Typedefs
33 *******************************************************************************/
35 #include "site_typedefs.h"
39 /*******************************************************************************
41 *******************************************************************************/
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.
58 #else /* ! __cplusplus */
63 typedef unsigned char bool; /* consistent w/BOOL */
67 #endif /* ! __cplusplus */
69 /* use the Windows ULONG_PTR type when compiling for 64 bit */
72 #define TYPEDEF_UINTPTR
73 typedef ULONG_PTR uintptr;
77 typedef long unsigned int size_t;
80 #ifdef _MSC_VER /* Microsoft C */
82 #define TYPEDEF_UINT64
83 typedef signed __int64 int64;
84 typedef unsigned __int64 uint64;
87 #if defined(MACOSX) && defined(KERNEL)
94 #define TYPEDEF_USHORT
98 #if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
100 #define TYPEDEF_USHORT
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
110 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
111 * for singned or unsigned */
114 #define TYPEDEF_INT64
116 #if defined(__STDC__)
117 #define TYPEDEF_UINT64
123 #if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
125 /* pick up ushort & uint from standard types.h */
126 #if defined(linux) && defined(__KERNEL__)
128 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
132 #include <sys/types.h>
136 #endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_ && !_MINOSL_ */
138 #if defined(MACOSX) && defined(KERNEL)
139 #include <IOKit/IOTypes.h>
143 /* use the default typedefs in the next section of this file */
144 #define USE_TYPEDEF_DEFAULTS
146 #endif /* SITE_TYPEDEFS */
149 /*******************************************************************************
151 *******************************************************************************/
153 #ifdef USE_TYPEDEF_DEFAULTS
154 #undef USE_TYPEDEF_DEFAULTS
157 typedef /*@abstract@*/ unsigned char bool;
160 /*----------------------- define uchar, ushort, uint, ulong ------------------*/
162 #ifndef TYPEDEF_UCHAR
163 typedef unsigned char uchar;
166 #ifndef TYPEDEF_USHORT
167 typedef unsigned short ushort;
171 typedef unsigned int uint;
174 #ifndef TYPEDEF_ULONG
175 typedef unsigned long ulong;
178 /*----------------------- define [u]int8/16/32/64, uintptr --------------------*/
180 #ifndef TYPEDEF_UINT8
181 typedef unsigned char uint8;
184 #ifndef TYPEDEF_UINT16
185 typedef unsigned short uint16;
188 #ifndef TYPEDEF_UINT32
189 typedef unsigned int uint32;
192 #ifndef TYPEDEF_UINT64
193 typedef unsigned long long uint64;
196 #ifndef TYPEDEF_UINTPTR
197 typedef unsigned int uintptr;
201 typedef signed char int8;
204 #ifndef TYPEDEF_INT16
205 typedef signed short int16;
208 #ifndef TYPEDEF_INT32
209 typedef signed int int32;
212 #ifndef TYPEDEF_INT64
213 typedef signed long long int64;
216 /*----------------------- define float32/64, float_t -----------------------*/
218 #ifndef TYPEDEF_FLOAT32
219 typedef float float32;
222 #ifndef TYPEDEF_FLOAT64
223 typedef double float64;
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.
232 #ifndef TYPEDEF_FLOAT_T
235 typedef float32 float_t;
236 #else /* default to double precision floating point */
237 typedef float64 float_t;
240 #endif /* TYPEDEF_FLOAT_T */
242 /*----------------------- define macro values -----------------------------*/
266 /* Reclaiming text and data :
267 The following macros specify special linker sections that can be reclaimed
268 after a system is considered 'up'.
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
276 #define BCMINITDATA(_data) _data
277 #define BCMINITFN(_fn) _fn
278 #define BCMINIT(_id) _id
279 #define bcmreclaimed 0
282 /*----------------------- define PTRSZ, INLINE ----------------------------*/
285 #define PTRSZ sizeof (char*)
292 #define INLINE __inline
296 #define INLINE __inline__
302 #endif /* _MSC_VER */
308 #undef TYPEDEF_USHORT
312 #undef TYPEDEF_UINT16
313 #undef TYPEDEF_UINT32
314 #undef TYPEDEF_UINT64
315 #undef TYPEDEF_UINTPTR
320 #undef TYPEDEF_FLOAT32
321 #undef TYPEDEF_FLOAT64
322 #undef TYPEDEF_FLOAT_T
324 #endif /* USE_TYPEDEF_DEFAULTS */
326 #endif /* _TYPEDEFS_H_ */