| 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 | */ |
| 10 | |
| 11 | #ifndef _TYPEDEFS_H_ |
| 12 | #define _TYPEDEFS_H_ |
| 13 | |
| 14 | /* |
| 15 | * Inferred Typedefs |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | /* Infer the compile environment based on preprocessor symbols and pramas. |
| 20 | * Override type definitions as needed, and include configuration dependent |
| 21 | * header files to define types. |
| 22 | */ |
| 23 | |
| 24 | #ifdef __cplusplus |
| 25 | |
| 26 | #define TYPEDEF_BOOL |
| 27 | #ifndef FALSE |
| 28 | #define FALSE false |
| 29 | #endif |
| 30 | #ifndef TRUE |
| 31 | #define TRUE true |
| 32 | #endif |
| 33 | |
| 34 | #endif /* __cplusplus */ |
| 35 | |
| 36 | #if defined(_NEED_SIZE_T_) |
| 37 | typedef long unsigned int size_t; |
| 38 | #endif |
| 39 | |
| 40 | #define TYPEDEF_UINT |
| 41 | #define TYPEDEF_USHORT |
| 42 | #define TYPEDEF_ULONG |
| 43 | |
| 44 | |
| 45 | /* Do not support the (u)int64 types with strict ansi for GNU C */ |
| 46 | #if defined(__GNUC__) && defined(__STRICT_ANSI__) |
| 47 | #define TYPEDEF_INT64 |
| 48 | #define TYPEDEF_UINT64 |
| 49 | #endif |
| 50 | |
| 51 | /* pick up ushort & uint from standard types.h */ |
| 52 | #if defined(linux) && defined(__KERNEL__) |
| 53 | #include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */ |
| 54 | #else |
| 55 | #include <sys/types.h> |
| 56 | #endif |
| 57 | |
| 58 | /* use the default typedefs in the next section of this file */ |
| 59 | #define USE_TYPEDEF_DEFAULTS |
| 60 | |
| 61 | /* |
| 62 | * Default Typedefs |
| 63 | * |
| 64 | */ |
| 65 | |
| 66 | #ifdef USE_TYPEDEF_DEFAULTS |
| 67 | #undef USE_TYPEDEF_DEFAULTS |
| 68 | |
| 69 | #ifndef TYPEDEF_BOOL |
| 70 | typedef /* @abstract@ */ unsigned char bool; |
| 71 | #endif |
| 72 | |
| 73 | /* define uchar, ushort, uint, ulong */ |
| 74 | |
| 75 | #ifndef TYPEDEF_UCHAR |
| 76 | typedef unsigned char uchar; |
| 77 | #endif |
| 78 | |
| 79 | #ifndef TYPEDEF_USHORT |
| 80 | typedef unsigned short ushort; |
| 81 | #endif |
| 82 | |
| 83 | #ifndef TYPEDEF_UINT |
| 84 | typedef unsigned int uint; |
| 85 | #endif |
| 86 | |
| 87 | #ifndef TYPEDEF_ULONG |
| 88 | typedef unsigned long ulong; |
| 89 | #endif |
| 90 | |
| 91 | /* define [u]int8/16/32/64, uintptr */ |
| 92 | |
| 93 | #ifndef TYPEDEF_UINT8 |
| 94 | typedef unsigned char uint8; |
| 95 | #endif |
| 96 | |
| 97 | #ifndef TYPEDEF_UINT16 |
| 98 | typedef unsigned short uint16; |
| 99 | #endif |
| 100 | |
| 101 | #ifndef TYPEDEF_UINT32 |
| 102 | typedef unsigned int uint32; |
| 103 | #endif |
| 104 | |
| 105 | #ifndef TYPEDEF_UINT64 |
| 106 | typedef unsigned long long uint64; |
| 107 | #endif |
| 108 | |
| 109 | #ifndef TYPEDEF_UINTPTR |
| 110 | typedef unsigned int uintptr; |
| 111 | #endif |
| 112 | |
| 113 | #ifndef TYPEDEF_INT8 |
| 114 | typedef signed char int8; |
| 115 | #endif |
| 116 | |
| 117 | #ifndef TYPEDEF_INT16 |
| 118 | typedef signed short int16; |
| 119 | #endif |
| 120 | |
| 121 | #ifndef TYPEDEF_INT32 |
| 122 | typedef signed int int32; |
| 123 | #endif |
| 124 | |
| 125 | #ifndef TYPEDEF_INT64 |
| 126 | typedef signed long long int64; |
| 127 | #endif |
| 128 | |
| 129 | /* define float32/64, float_t */ |
| 130 | |
| 131 | #ifndef TYPEDEF_FLOAT32 |
| 132 | typedef float float32; |
| 133 | #endif |
| 134 | |
| 135 | #ifndef TYPEDEF_FLOAT64 |
| 136 | typedef double float64; |
| 137 | #endif |
| 138 | |
| 139 | /* |
| 140 | * abstracted floating point type allows for compile time selection of |
| 141 | * single or double precision arithmetic. Compiling with -DFLOAT32 |
| 142 | * selects single precision; the default is double precision. |
| 143 | */ |
| 144 | |
| 145 | #ifndef TYPEDEF_FLOAT_T |
| 146 | |
| 147 | #if defined(FLOAT32) |
| 148 | typedef float32 float_t; |
| 149 | #else /* default to double precision floating point */ |
| 150 | typedef float64 float_t; |
| 151 | #endif |
| 152 | |
| 153 | #endif /* TYPEDEF_FLOAT_T */ |
| 154 | |
| 155 | /* define macro values */ |
| 156 | |
| 157 | #ifndef FALSE |
| 158 | #define FALSE 0 |
| 159 | #endif |
| 160 | |
| 161 | #ifndef TRUE |
| 162 | #define TRUE 1 /* TRUE */ |
| 163 | #endif |
| 164 | |
| 165 | #ifndef NULL |
| 166 | #define NULL 0 |
| 167 | #endif |
| 168 | |
| 169 | #ifndef OFF |
| 170 | #define OFF 0 |
| 171 | #endif |
| 172 | |
| 173 | #ifndef ON |
| 174 | #define ON 1 /* ON = 1 */ |
| 175 | #endif |
| 176 | |
| 177 | #define AUTO (-1) /* Auto = -1 */ |
| 178 | |
| 179 | /* define PTRSZ, INLINE */ |
| 180 | |
| 181 | #ifndef PTRSZ |
| 182 | #define PTRSZ sizeof(char*) |
| 183 | #endif |
| 184 | |
| 185 | #ifndef INLINE |
| 186 | |
| 187 | #ifdef _MSC_VER |
| 188 | |
| 189 | #define INLINE __inline |
| 190 | |
| 191 | #elif __GNUC__ |
| 192 | |
| 193 | #define INLINE __inline__ |
| 194 | |
| 195 | #else |
| 196 | |
| 197 | #define INLINE |
| 198 | |
| 199 | #endif /* _MSC_VER */ |
| 200 | |
| 201 | #endif /* INLINE */ |
| 202 | |
| 203 | #undef TYPEDEF_BOOL |
| 204 | #undef TYPEDEF_UCHAR |
| 205 | #undef TYPEDEF_USHORT |
| 206 | #undef TYPEDEF_UINT |
| 207 | #undef TYPEDEF_ULONG |
| 208 | #undef TYPEDEF_UINT8 |
| 209 | #undef TYPEDEF_UINT16 |
| 210 | #undef TYPEDEF_UINT32 |
| 211 | #undef TYPEDEF_UINT64 |
| 212 | #undef TYPEDEF_UINTPTR |
| 213 | #undef TYPEDEF_INT8 |
| 214 | #undef TYPEDEF_INT16 |
| 215 | #undef TYPEDEF_INT32 |
| 216 | #undef TYPEDEF_INT64 |
| 217 | #undef TYPEDEF_FLOAT32 |
| 218 | #undef TYPEDEF_FLOAT64 |
| 219 | #undef TYPEDEF_FLOAT_T |
| 220 | |
| 221 | #endif /* USE_TYPEDEF_DEFAULTS */ |
| 222 | |
| 223 | /* |
| 224 | * Including the bcmdefs.h here, to make sure everyone including typedefs.h |
| 225 | * gets this automatically |
| 226 | */ |
| 227 | #include <bcmdefs.h> |
| 228 | |
| 229 | #endif /* _TYPEDEFS_H_ */ |
| 230 | |