-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenericTypeDefs.h
382 lines (329 loc) · 6.94 KB
/
GenericTypeDefs.h
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
/**
\version: 1.0
\author Suky (Casanova Alejandro)
\web www.micros-designs.com.ar
\date 16/08/10
///////////////////////////////////////////////////////////////////////////
//// ////
//// ////
//// (C) Copyright 2010 www.micros-designs.com.ar ////
//// Este c�digo puede ser usado, modificado y distribuido libremente ////
//// sin eliminar esta cabecera y sin garant�a de ning�n tipo. ////
//// ////
//// ////
///////////////////////////////////////////////////////////////////////////
*- Version Log --------------------------------------------------------------*
* Fecha Autor Comentarios *
*----------------------------------------------------------------------------*
* 16/08/10 Suky Original (Rev 1.0) *
* 20/08/10 Suky Se incluye CodeVisionAVR *
*----------------------------------------------------------------------------* */
#ifndef __GENERIC_TYPE_DEFS_H_
#define __GENERIC_TYPE_DEFS_H_
//#include <stddef.h>
#if defined(__PCH__) || defined(__PCM__)
typedef int1 BOOLEAN_;
typedef signed int SINT;
typedef signed char SINT8;
typedef signed long SINT16;
typedef signed long long SINT32;
typedef unsigned int UINT;
typedef unsigned char UINT8;
typedef unsigned long UINT16;
typedef unsigned long long UINT32;
#endif
#if defined(__18CXX)
typedef enum _BOOLEAN
{
FALSE = 0, TRUE
} BOOLEAN_;
typedef enum _BOOL
{
FALSE = 0, TRUE
} BOOL;
#ifndef NULL
#define NULL 0//((void *)0)
#endif
#define PUBLIC // Function attributes
#define PROTECTED
#define PRIVATE static
typedef unsigned char BYTE; // 8-bit unsigned
typedef unsigned short int WORD; // 16-bit unsigned
typedef unsigned long DWORD; // 32-bit unsigned
typedef unsigned long long QWORD; // 64-bit unsigned
typedef signed char CHAR; // 8-bit signed
typedef signed short int SHORT; // 16-bit signed
typedef signed long LONG; // 32-bit signed
typedef signed long long LONGLONG; // 64-bit signed
/* Alternate definitions */
typedef void VOID;
typedef char CHAR8;
typedef unsigned char UCHAR8;
typedef signed int SINT;
typedef signed char SINT8;
typedef signed short int SINT16;
typedef signed long int SINT32;
typedef unsigned int UINT;
typedef unsigned char UINT8;
typedef unsigned short int UINT16;
typedef unsigned short long UINT24;
typedef unsigned long int UINT32;
#elif defined(HI_TECH_C)
typedef unsigned char BYTE; // 8-bit unsigned
typedef unsigned short int WORD; // 16-bit unsigned
#endif
#if defined (__C30__)
typedef enum _BOOLEAN
{
FALSE = 0, TRUE
} BOOLEAN_;
typedef signed int SINT;
typedef signed char SINT8;
typedef signed int SINT16;
typedef signed long SINT32;
typedef unsigned int UINT;
typedef unsigned char UINT8;
typedef unsigned int UINT16;
typedef unsigned long UINT32;
#endif
#if defined(HI_TECH_C)
typedef bit BOOLEAN_;
typedef signed char SINT;
typedef signed char SINT8;
typedef signed int SINT16;
typedef signed long SINT32;
typedef unsigned char UINT;
typedef unsigned char UINT8;
typedef unsigned int UINT16;
typedef unsigned long UINT32;
#endif
typedef union
{
UINT8 Val;
struct
{
UINT8 b0 : 1;
UINT8 b1 : 1;
UINT8 b2 : 1;
UINT8 b3 : 1;
UINT8 b4 : 1;
UINT8 b5 : 1;
UINT8 b6 : 1;
UINT8 b7 : 1;
};
struct
{
unsigned char b0 : 1;
unsigned char b1 : 1;
unsigned char b2 : 1;
unsigned char b3 : 1;
unsigned char b4 : 1;
unsigned char b5 : 1;
unsigned char b6 : 1;
unsigned char b7 : 1;
} bits;
} UINT8_VAL, UINT8_BITS, BYTE_VAL, BYTE_BITS;
typedef union
{
UINT16 Val;
UINT8 v[2];
struct
{
UINT8 LB;
UINT8 HB;
};
struct
{
UINT8 b0 : 1;
UINT8 b1 : 1;
UINT8 b2 : 1;
UINT8 b3 : 1;
UINT8 b4 : 1;
UINT8 b5 : 1;
UINT8 b6 : 1;
UINT8 b7 : 1;
UINT8 b8 : 1;
UINT8 b9 : 1;
UINT8 b10 : 1;
UINT8 b11 : 1;
UINT8 b12 : 1;
UINT8 b13 : 1;
UINT8 b14 : 1;
UINT8 b15 : 1;
};
struct
{
BYTE LB;
BYTE HB;
} byte;
struct
{
unsigned char b0 : 1;
unsigned char b1 : 1;
unsigned char b2 : 1;
unsigned char b3 : 1;
unsigned char b4 : 1;
unsigned char b5 : 1;
unsigned char b6 : 1;
unsigned char b7 : 1;
unsigned char b8 : 1;
unsigned char b9 : 1;
unsigned char b10 : 1;
unsigned char b11 : 1;
unsigned char b12 : 1;
unsigned char b13 : 1;
unsigned char b14 : 1;
unsigned char b15 : 1;
} bits;
} UINT16_VAL, UINT16_BITS, WORD_VAL, WORD_BITS;
#if defined(__18CXX)
typedef union
{
UINT24 Val;
UINT8 v[3];
struct
{
UINT8 LB;
UINT8 HB;
UINT8 UB;
};
struct
{
UINT8 b0 : 1;
UINT8 b1 : 1;
UINT8 b2 : 1;
UINT8 b3 : 1;
UINT8 b4 : 1;
UINT8 b5 : 1;
UINT8 b6 : 1;
UINT8 b7 : 1;
UINT8 b8 : 1;
UINT8 b9 : 1;
UINT8 b10 : 1;
UINT8 b11 : 1;
UINT8 b12 : 1;
UINT8 b13 : 1;
UINT8 b14 : 1;
UINT8 b15 : 1;
UINT8 b16 : 1;
UINT8 b17 : 1;
UINT8 b18 : 1;
UINT8 b19 : 1;
UINT8 b20 : 1;
UINT8 b21 : 1;
UINT8 b22 : 1;
UINT8 b23 : 1;
};
} UINT24_VAL, UINT24_BITS;
#endif
typedef union
{
UINT32 Val;
UINT16 w[2];
UINT8 v[4];
struct
{
UINT16 LW;
UINT16 HW;
};
struct
{
UINT8 LB;
UINT8 HB;
UINT8 UB;
UINT8 MB;
};
struct
{
UINT16_VAL low;
UINT16_VAL high;
};
struct
{
UINT8 b0 : 1;
UINT8 b1 : 1;
UINT8 b2 : 1;
UINT8 b3 : 1;
UINT8 b4 : 1;
UINT8 b5 : 1;
UINT8 b6 : 1;
UINT8 b7 : 1;
UINT8 b8 : 1;
UINT8 b9 : 1;
UINT8 b10 : 1;
UINT8 b11 : 1;
UINT8 b12 : 1;
UINT8 b13 : 1;
UINT8 b14 : 1;
UINT8 b15 : 1;
UINT8 b16 : 1;
UINT8 b17 : 1;
UINT8 b18 : 1;
UINT8 b19 : 1;
UINT8 b20 : 1;
UINT8 b21 : 1;
UINT8 b22 : 1;
UINT8 b23 : 1;
UINT8 b24 : 1;
UINT8 b25 : 1;
UINT8 b26 : 1;
UINT8 b27 : 1;
UINT8 b28 : 1;
UINT8 b29 : 1;
UINT8 b30 : 1;
UINT8 b31 : 1;
};
struct
{
WORD LW;
WORD HW;
} word;
struct
{
BYTE LB;
BYTE HB;
BYTE UB;
BYTE MB;
} byte;
struct
{
WORD_VAL low;
WORD_VAL high;
} wordUnion;
struct
{
unsigned char b0 : 1;
unsigned char b1 : 1;
unsigned char b2 : 1;
unsigned char b3 : 1;
unsigned char b4 : 1;
unsigned char b5 : 1;
unsigned char b6 : 1;
unsigned char b7 : 1;
unsigned char b8 : 1;
unsigned char b9 : 1;
unsigned char b10 : 1;
unsigned char b11 : 1;
unsigned char b12 : 1;
unsigned char b13 : 1;
unsigned char b14 : 1;
unsigned char b15 : 1;
unsigned char b16 : 1;
unsigned char b17 : 1;
unsigned char b18 : 1;
unsigned char b19 : 1;
unsigned char b20 : 1;
unsigned char b21 : 1;
unsigned char b22 : 1;
unsigned char b23 : 1;
unsigned char b24 : 1;
unsigned char b25 : 1;
unsigned char b26 : 1;
unsigned char b27 : 1;
unsigned char b28 : 1;
unsigned char b29 : 1;
unsigned char b30 : 1;
unsigned char b31 : 1;
} bits;
} UINT32_VAL, DWORD_VAL;
#endif