2 * Copyright 2004, 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
;
76 #ifdef _MSC_VER /* Microsoft C */
78 #define TYPEDEF_UINT64
79 typedef signed __int64 int64
;
80 typedef unsigned __int64 uint64
;
83 #if defined(MACOSX) && defined(KERNEL)
90 #define TYPEDEF_USHORT
94 #if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
96 #define TYPEDEF_USHORT
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
106 /* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
107 * for singned or unsigned */
110 #define TYPEDEF_INT64
112 #if defined(__STDC__)
113 #define TYPEDEF_UINT64
119 #if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) && !defined(_HNDRTE_) && !defined(_MINOSL_)
121 /* pick up ushort & uint from standard types.h */
122 #if defined(linux) && defined(__KERNEL__)
124 #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
128 #include <sys/types.h>
132 #endif /* !_WIN32 && !PMON && !_CFE_ && !_HNDRTE_ && !_MINOSL_ */
134 #if defined(MACOSX) && defined(KERNEL)
135 #include <IOKit/IOTypes.h>
139 /* use the default typedefs in the next section of this file */
140 #define USE_TYPEDEF_DEFAULTS
142 #endif /* SITE_TYPEDEFS */
145 /*******************************************************************************
147 *******************************************************************************/
149 #ifdef USE_TYPEDEF_DEFAULTS
150 #undef USE_TYPEDEF_DEFAULTS
153 typedef /*@abstract@*/ unsigned char bool;
156 /*----------------------- define uchar, ushort, uint, ulong ------------------*/
158 #ifndef TYPEDEF_UCHAR
159 typedef unsigned char uchar
;
162 #ifndef TYPEDEF_USHORT
163 typedef unsigned short ushort
;
167 typedef unsigned int uint
;
170 #ifndef TYPEDEF_ULONG
171 typedef unsigned long ulong
;
174 /*----------------------- define [u]int8/16/32/64, uintptr --------------------*/
176 #ifndef TYPEDEF_UINT8
177 typedef unsigned char uint8
;
180 #ifndef TYPEDEF_UINT16
181 typedef unsigned short uint16
;
184 #ifndef TYPEDEF_UINT32
185 typedef unsigned int uint32
;
188 #ifndef TYPEDEF_UINT64
189 typedef unsigned long long uint64
;
192 #ifndef TYPEDEF_UINTPTR
193 typedef unsigned int uintptr
;
197 typedef signed char int8
;
200 #ifndef TYPEDEF_INT16
201 typedef signed short int16
;
204 #ifndef TYPEDEF_INT32
205 typedef signed int int32
;
208 #ifndef TYPEDEF_INT64
209 typedef signed long long int64
;
212 /*----------------------- define float32/64, float_t -----------------------*/
214 #ifndef TYPEDEF_FLOAT32
215 typedef float float32
;
218 #ifndef TYPEDEF_FLOAT64
219 typedef double float64
;
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.
228 #ifndef TYPEDEF_FLOAT_T
231 typedef float32 float_t
;
232 #else /* default to double precision floating point */
233 typedef float64 float_t
;
236 #endif /* TYPEDEF_FLOAT_T */
238 /*----------------------- define macro values -----------------------------*/
262 /* Reclaiming text and data :
263 The following macros specify special linker sections that can be reclaimed
264 after a system is considered 'up'.
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
272 #define BCMINITDATA(_data) _data
273 #define BCMINITFN(_fn) _fn
274 #define BCMINIT(_id) _id
275 #define bcmreclaimed 0
278 /*----------------------- define PTRSZ, INLINE ----------------------------*/
281 #define PTRSZ sizeof (char*)
288 #define INLINE __inline
292 #define INLINE __inline__
298 #endif /* _MSC_VER */
304 #undef TYPEDEF_USHORT
308 #undef TYPEDEF_UINT16
309 #undef TYPEDEF_UINT32
310 #undef TYPEDEF_UINT64
311 #undef TYPEDEF_UINTPTR
316 #undef TYPEDEF_FLOAT32
317 #undef TYPEDEF_FLOAT64
318 #undef TYPEDEF_FLOAT_T
320 #endif /* USE_TYPEDEF_DEFAULTS */
322 #endif /* _TYPEDEFS_H_ */