2 * Copyright (c) 2010 Broadcom Corporation
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.
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.
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.
26 #if defined(__x86_64__)
27 #define TYPEDEF_UINTPTR
28 typedef unsigned long long int uintptr;
31 #if defined(_NEED_SIZE_T_)
32 typedef long unsigned int size_t;
36 #define TYPEDEF_USHORT
38 #include <linux/version.h>
41 /* Do not support the (u)int64 types with strict ansi for GNU C */
42 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
44 #define TYPEDEF_UINT64
47 #include <linux/types.h>
53 typedef /* @abstract@ */ unsigned char bool;
56 /* define uchar, ushort, uint, ulong */
59 typedef unsigned char uchar;
62 #ifndef TYPEDEF_USHORT
63 typedef unsigned short ushort;
67 typedef unsigned int uint;
71 typedef unsigned long ulong;
74 /* define [u]int8/16/32/64, uintptr */
77 typedef unsigned char uint8;
80 #ifndef TYPEDEF_UINT16
81 typedef unsigned short uint16;
84 #ifndef TYPEDEF_UINT32
85 typedef unsigned int uint32;
88 #ifndef TYPEDEF_UINT64
89 typedef unsigned long long uint64;
92 #ifndef TYPEDEF_UINTPTR
93 typedef unsigned int uintptr;
97 typedef signed char int8;
100 #ifndef TYPEDEF_INT16
101 typedef signed short int16;
104 #ifndef TYPEDEF_INT32
105 typedef signed int int32;
108 #ifndef TYPEDEF_INT64
109 typedef signed long long int64;
112 /* define float32/64, float_t */
114 #ifndef TYPEDEF_FLOAT32
115 typedef float float32;
118 #ifndef TYPEDEF_FLOAT64
119 typedef double float64;
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.
128 #ifndef TYPEDEF_FLOAT_T
131 typedef float32 float_t;
132 #else /* default to double precision floating point */
133 typedef float64 float_t;
136 #endif /* TYPEDEF_FLOAT_T */
138 /* define macro values */
145 #define TRUE 1 /* TRUE */
157 #define ON 1 /* ON = 1 */
160 #define AUTO (-1) /* Auto = -1 */
162 /* define PTRSZ, INLINE */
165 #define PTRSZ sizeof(char*)
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
174 #error "Unknown compiler!"
178 #if defined(BWL_COMPILER_GNU)
179 #define INLINE __inline__
180 #elif defined(BWL_COMPILER_ARMCC)
181 #define INLINE __inline
189 #undef TYPEDEF_USHORT
193 #undef TYPEDEF_UINT16
194 #undef TYPEDEF_UINT32
195 #undef TYPEDEF_UINT64
196 #undef TYPEDEF_UINTPTR
201 #undef TYPEDEF_FLOAT32
202 #undef TYPEDEF_FLOAT64
203 #undef TYPEDEF_FLOAT_T
205 /* Suppress unused parameter warning */
206 #define UNUSED_PARAMETER(x) (void)(x)
209 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
210 * gets this automatically
214 #endif /* _TYPEDEFS_H_ */