Commit | Line | Data |
---|---|---|
a9533e7e HP |
1 | /* |
2 | * Copyright (c) 2010 Broadcom Corporation | |
3 | * | |
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. | |
7 | * | |
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. | |
15 | */ | |
16 | ||
17 | #ifndef _TYPEDEFS_H_ | |
18 | #define _TYPEDEFS_H_ | |
19 | ||
20 | /* | |
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. | |
24 | */ | |
25 | ||
26 | #if defined(__x86_64__) | |
27 | #define TYPEDEF_UINTPTR | |
28 | typedef unsigned long long int uintptr; | |
29 | #endif | |
30 | ||
a9533e7e HP |
31 | #define TYPEDEF_UINT |
32 | #define TYPEDEF_USHORT | |
33 | #define TYPEDEF_ULONG | |
34 | #include <linux/version.h> | |
a9533e7e HP |
35 | |
36 | /* Do not support the (u)int64 types with strict ansi for GNU C */ | |
37 | #if defined(__GNUC__) && defined(__STRICT_ANSI__) | |
38 | #define TYPEDEF_INT64 | |
39 | #define TYPEDEF_UINT64 | |
40 | #endif | |
41 | ||
42 | #include <linux/types.h> | |
43 | ||
44 | /* | |
45 | * Default Typedefs | |
46 | */ | |
a9533e7e HP |
47 | |
48 | /* define uchar, ushort, uint, ulong */ | |
49 | ||
50 | #ifndef TYPEDEF_UCHAR | |
51 | typedef unsigned char uchar; | |
52 | #endif | |
53 | ||
54 | #ifndef TYPEDEF_USHORT | |
55 | typedef unsigned short ushort; | |
56 | #endif | |
57 | ||
58 | #ifndef TYPEDEF_UINT | |
59 | typedef unsigned int uint; | |
60 | #endif | |
61 | ||
62 | #ifndef TYPEDEF_ULONG | |
63 | typedef unsigned long ulong; | |
64 | #endif | |
65 | ||
66 | /* define [u]int8/16/32/64, uintptr */ | |
67 | ||
68 | #ifndef TYPEDEF_UINT8 | |
69 | typedef unsigned char uint8; | |
70 | #endif | |
71 | ||
72 | #ifndef TYPEDEF_UINT16 | |
73 | typedef unsigned short uint16; | |
74 | #endif | |
75 | ||
76 | #ifndef TYPEDEF_UINT32 | |
77 | typedef unsigned int uint32; | |
78 | #endif | |
79 | ||
80 | #ifndef TYPEDEF_UINT64 | |
81 | typedef unsigned long long uint64; | |
82 | #endif | |
83 | ||
84 | #ifndef TYPEDEF_UINTPTR | |
85 | typedef unsigned int uintptr; | |
86 | #endif | |
87 | ||
88 | #ifndef TYPEDEF_INT8 | |
89 | typedef signed char int8; | |
90 | #endif | |
91 | ||
92 | #ifndef TYPEDEF_INT16 | |
93 | typedef signed short int16; | |
94 | #endif | |
95 | ||
96 | #ifndef TYPEDEF_INT32 | |
97 | typedef signed int int32; | |
98 | #endif | |
99 | ||
100 | #ifndef TYPEDEF_INT64 | |
101 | typedef signed long long int64; | |
102 | #endif | |
103 | ||
a9533e7e HP |
104 | |
105 | /* define macro values */ | |
106 | ||
107 | #ifndef FALSE | |
108 | #define FALSE 0 | |
109 | #endif | |
110 | ||
111 | #ifndef TRUE | |
112 | #define TRUE 1 /* TRUE */ | |
113 | #endif | |
114 | ||
115 | #ifndef NULL | |
116 | #define NULL 0 | |
117 | #endif | |
118 | ||
119 | #ifndef OFF | |
120 | #define OFF 0 | |
121 | #endif | |
122 | ||
123 | #ifndef ON | |
124 | #define ON 1 /* ON = 1 */ | |
125 | #endif | |
126 | ||
127 | #define AUTO (-1) /* Auto = -1 */ | |
128 | ||
a9533e7e HP |
129 | #undef TYPEDEF_UCHAR |
130 | #undef TYPEDEF_USHORT | |
131 | #undef TYPEDEF_UINT | |
132 | #undef TYPEDEF_ULONG | |
133 | #undef TYPEDEF_UINT8 | |
134 | #undef TYPEDEF_UINT16 | |
135 | #undef TYPEDEF_UINT32 | |
136 | #undef TYPEDEF_UINT64 | |
137 | #undef TYPEDEF_UINTPTR | |
138 | #undef TYPEDEF_INT8 | |
139 | #undef TYPEDEF_INT16 | |
140 | #undef TYPEDEF_INT32 | |
141 | #undef TYPEDEF_INT64 | |
142 | #undef TYPEDEF_FLOAT32 | |
143 | #undef TYPEDEF_FLOAT64 | |
144 | #undef TYPEDEF_FLOAT_T | |
145 | ||
a9533e7e HP |
146 | /* |
147 | * Including the bcmdefs.h here, to make sure everyone including typedefs.h | |
148 | * gets this automatically | |
149 | */ | |
150 | #include <bcmdefs.h> | |
151 | ||
152 | #endif /* _TYPEDEFS_H_ */ |