hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
/*
 * Copyright (C) 2020, Broadcom.
 *
 *      Unless you and Broadcom execute a separate written software license
 * agreement governing use of this software, this software is licensed to you
 * under the terms of the GNU General Public License version 2 (the "GPL"),
 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
 * following added to such license:
 *
 *      As a special exception, the copyright holders of this software give you
 * permission to link this software with independent modules, and to copy and
 * distribute the resulting executable under terms of your choice, provided that
 * you also meet, for each linked independent module, the terms and conditions of
 * the license of that module.  An independent module is a module which is not
 * derived from this software.  The special exception does not apply to any
 * modifications of the software.
 *
 *
 * <<Broadcom-WL-IPTag/Dual:>>
 */
 
#ifndef _TYPEDEFS_H_
#define _TYPEDEFS_H_
 
#if (!defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)) || \
       !defined(BWL_NO_INTERNAL_STDLIB_SUPPORT)
 
#ifdef SITE_TYPEDEFS
 
/*
 * Define SITE_TYPEDEFS in the compile to include a site-specific
 * typedef file "site_typedefs.h".
 *
 * If SITE_TYPEDEFS is not defined, then the code section below makes
 * inferences about the compile environment based on defined symbols and
 * possibly compiler pragmas.
 *
 * Following these two sections is the Default Typedefs section.
 * This section is only processed if USE_TYPEDEF_DEFAULTS is
 * defined. This section has a default set of typedefs and a few
 * preprocessor symbols (TRUE, FALSE, NULL, ...).
 */
 
#include "site_typedefs.h"
 
#else
 
/*
 * Infer the compile environment based on preprocessor symbols and pragmas.
 * Override type definitions as needed, and include configuration-dependent
 * header files to define types.
 */
 
#ifdef __cplusplus
 
#define TYPEDEF_BOOL
#ifndef FALSE
#define FALSE    false
#endif
#ifndef TRUE
#define TRUE    true
#endif
 
#else    /* ! __cplusplus */
 
#if defined(_WIN32)
 
#define TYPEDEF_BOOL
typedef    unsigned char    bool;            /* consistent w/BOOL */
 
#endif /* _WIN32 */
 
#endif    /* ! __cplusplus */
 
#if defined(EFI) && !defined(EFI_WINBLD) && !defined(__size_t__)
typedef long unsigned int size_t;
#endif /* EFI */
 
#if !defined(TYPEDEF_UINTPTR)
#if defined(_WIN64) && !defined(EFI)
/* use the Windows ULONG_PTR type when compiling for 64 bit */
#include <basetsd.h>
#define TYPEDEF_UINTPTR
typedef ULONG_PTR uintptr;
#elif defined(__LP64__)
#define TYPEDEF_UINTPTR
typedef unsigned long long int uintptr;
#endif
#endif /* TYPEDEF_UINTPTR */
 
#if defined(_RTE_)
#define _NEED_SIZE_T_
#endif
 
/* float_t types conflict with the same typedefs from the standard ANSI-C
** math.h header file. Don't re-typedef them here.
*/
 
#if defined(MACOSX)
#define TYPEDEF_FLOAT_T
#endif /* MACOSX */
 
#if defined(_NEED_SIZE_T_)
typedef long unsigned int size_t;
#endif
 
#ifdef _MSC_VER    /* Microsoft C */
#define TYPEDEF_INT64
#define TYPEDEF_UINT64
typedef signed __int64    int64;
typedef unsigned __int64 uint64;
#endif
 
#if defined(__sparc__)
#define TYPEDEF_ULONG
#endif
 
#if defined(__linux__) && !defined(EFI)
/*
 * If this is either a Linux hybrid build or the per-port code of a hybrid build
 * then use the Linux header files to get some of the typedefs.  Otherwise, define
 * them entirely in this file.  We can't always define the types because we get
 * a duplicate typedef error; there is no way to "undefine" a typedef.
 * We know when it's per-port code because each file defines LINUX_PORT at the top.
 */
#define TYPEDEF_UINT
#ifndef TARGETENV_android
#define TYPEDEF_USHORT
#define TYPEDEF_ULONG
#endif /* TARGETENV_android */
#ifdef __KERNEL__
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
#define TYPEDEF_BOOL
#endif    /* >= 2.6.19 */
/* special detection for 2.6.18-128.7.1.0.1.el5 */
#if (LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18))
#include <linux/compiler.h>
#ifdef noinline_for_stack
#define TYPEDEF_BOOL
#endif
#endif    /* == 2.6.18 */
#endif    /* __KERNEL__ */
#endif    /* linux && !EFI */
 
#if !defined(__linux__) && !defined(_WIN32) && \
   !defined(_RTE_) && !defined(__DJGPP__) && \
   !defined(__BOB__) && !defined(EFI)
#define TYPEDEF_UINT
#define TYPEDEF_USHORT
#endif
 
/* Do not support the (u)int64 types with strict ansi for GNU C */
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
#define TYPEDEF_INT64
#define TYPEDEF_UINT64
#endif /* defined(__GNUC__) && defined(__STRICT_ANSI__) */
 
/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode
 * for signed or unsigned
 */
#if defined(__ICL)
 
#define TYPEDEF_INT64
 
#if defined(__STDC__)
#define TYPEDEF_UINT64
#endif
 
#endif /* __ICL */
 
#if !defined(_WIN32) && !defined(_RTE_) && \
   !defined(__DJGPP__) && !defined(__BOB__) && !defined(EFI)
 
/* pick up ushort & uint from standard types.h */
#if defined(__linux__) && defined(__KERNEL__)
 
/* See note above */
#ifdef USER_MODE
#include <sys/types.h>
#else
#include <linux/types.h>    /* sys/types.h and linux/types.h are oil and water */
#endif /* USER_MODE */
 
#else
 
#include <sys/types.h>
 
#endif /* linux && __KERNEL__ */
 
#endif /* !_WIN32 && !_RTE_  && !__DJGPP__ */
 
/* use the default typedefs in the next section of this file */
#define USE_TYPEDEF_DEFAULTS
 
#endif /* SITE_TYPEDEFS */
 
/*
 * Default Typedefs
 */
 
#ifdef USE_TYPEDEF_DEFAULTS
#undef USE_TYPEDEF_DEFAULTS
 
#ifndef TYPEDEF_BOOL
typedef    /* @abstract@ */ unsigned char    bool;
#endif /* endif TYPEDEF_BOOL */
 
/* define uchar, ushort, uint, ulong */
 
#ifndef TYPEDEF_UCHAR
typedef unsigned char    uchar;
#endif
 
#ifndef TYPEDEF_USHORT
typedef unsigned short    ushort;
#endif
 
#ifndef TYPEDEF_UINT
typedef unsigned int    uint;
#endif
 
#ifndef TYPEDEF_ULONG
typedef unsigned long    ulong;
#endif
 
/* define [u]int8/16/32/64, uintptr */
 
#ifndef TYPEDEF_UINT8
typedef unsigned char    uint8;
#endif
 
#ifndef TYPEDEF_UINT16
typedef unsigned short    uint16;
#endif
 
#ifndef TYPEDEF_UINT32
typedef unsigned int    uint32;
#endif
 
#ifndef TYPEDEF_UINT64
typedef unsigned long long uint64;
#endif
 
#ifndef TYPEDEF_UINTPTR
typedef unsigned int    uintptr;
#endif
 
#ifndef TYPEDEF_INT8
typedef signed char    int8;
#endif
 
#ifndef TYPEDEF_INT16
typedef signed short    int16;
#endif
 
#ifndef TYPEDEF_INT32
typedef signed int    int32;
#endif
 
#ifndef TYPEDEF_INT64
typedef signed long long int64;
#endif
 
/* define float32/64, float_t */
 
#ifndef TYPEDEF_FLOAT32
typedef float        float32;
#endif
 
#ifndef TYPEDEF_FLOAT64
typedef double        float64;
#endif
 
/*
 * abstracted floating point type allows for compile time selection of
 * single or double precision arithmetic.  Compiling with -DFLOAT32
 * selects single precision; the default is double precision.
 */
 
#ifndef TYPEDEF_FLOAT_T
 
#if defined(FLOAT32)
typedef float32 float_t;
#else /* default to double precision floating point */
typedef float64 float_t;
#endif
 
#endif /* TYPEDEF_FLOAT_T */
 
/* define macro values */
 
#ifndef FALSE
#define FALSE    0
#endif
 
#ifndef TRUE
#define TRUE    1  /* TRUE */
#endif
 
#ifndef NULL
#define    NULL    0
#endif
 
#ifndef OFF
#define    OFF    0
#endif
 
#ifndef ON
#define    ON    1  /* ON = 1 */
#endif
 
#define    AUTO    (-1) /* Auto = -1 */
 
/* define PTRSZ, INLINE */
 
#ifndef PTRSZ
#define    PTRSZ    sizeof(char*)
#endif
 
/* Detect compiler type. */
#ifdef _MSC_VER
   #define BWL_COMPILER_MICROSOFT
#elif defined(__GNUC__) || defined(__lint)
   #define BWL_COMPILER_GNU
#elif defined(__CC_ARM) && __CC_ARM
   #define BWL_COMPILER_ARMCC
#else
   #error "Unknown compiler!"
#endif /* _MSC_VER */
 
#ifndef INLINE
#if defined(BWL_COMPILER_MICROSOFT)
   #define INLINE __inline
#elif defined(BWL_COMPILER_GNU)
   #define INLINE __inline__
#elif defined(BWL_COMPILER_ARMCC)
   #define INLINE    __inline
#else
   #define INLINE
#endif /* _MSC_VER */
#endif /* INLINE */
 
#undef TYPEDEF_BOOL
#undef TYPEDEF_UCHAR
#undef TYPEDEF_USHORT
#undef TYPEDEF_UINT
#undef TYPEDEF_ULONG
#undef TYPEDEF_UINT8
#undef TYPEDEF_UINT16
#undef TYPEDEF_UINT32
#undef TYPEDEF_UINT64
#undef TYPEDEF_UINTPTR
#undef TYPEDEF_INT8
#undef TYPEDEF_INT16
#undef TYPEDEF_INT32
#undef TYPEDEF_INT64
#undef TYPEDEF_FLOAT32
#undef TYPEDEF_FLOAT64
#undef TYPEDEF_FLOAT_T
 
#endif /* USE_TYPEDEF_DEFAULTS */
 
/* Suppress unused parameter warning */
#define UNUSED_PARAMETER(x) (void)(x)
 
/* Avoid warning for discarded const or volatile qualifier in special cases (-Wcast-qual) */
#define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
 
#else /* !EDK_RELEASE_VERSION || (EDK_RELEASE_VERSION < 0x00020000) */
 
#include <sys/types.h>
#include <strings.h>
#include <stdlib.h>
 
#ifdef stderr
#undef stderr
#define stderr stdout
#endif
 
typedef UINT8   uint8;
typedef UINT16  uint16;
typedef UINT32  uint32;
typedef UINT64  uint64;
typedef INT8    int8;
typedef INT16   int16;
typedef INT32   int32;
typedef INT64   int64;
 
typedef BOOLEAN       bool;
typedef unsigned char uchar;
typedef UINTN         uintptr;
 
#define UNUSED_PARAMETER(x) (void)(x)
#define DISCARD_QUAL(ptr, type) ((type *)(uintptr)(ptr))
#define INLINE
#define    AUTO    (-1) /* Auto = -1 */
#define    ON    1  /* ON = 1 */
#define    OFF    0
 
#endif /* !EDK_RELEASE_VERSION || (EDK_RELEASE_VERSION < 0x00020000) */
 
/*
 * Including the bcmdefs.h here, to make sure everyone including typedefs.h
 * gets this automatically
*/
#include <bcmdefs.h>
#endif /* _TYPEDEFS_H_ */