?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*******************************************************************
2  
3 Generic Type Definitions
4  
5 ********************************************************************
6 FileName: GenericTypeDefs.h
7 Dependencies: None
8 Processor: PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC, PIC32
9 Compiler: MPLAB C Compilers for PIC18, PIC24, dsPIC, & PIC32
10 Hi-Tech PICC PRO, Hi-Tech PICC18 PRO
11 Company: Microchip Technology Inc.
12  
13 Software License Agreement
14  
15 The software supplied herewith by Microchip Technology Incorporated
16 (the "Company") is intended and supplied to you, the Company's
17 customer, for use solely and exclusively with products manufactured
18 by the Company.
19  
20 The software is owned by the Company and/or its supplier, and is
21 protected under applicable copyright laws. All rights are reserved.
22 Any use in violation of the foregoing restrictions may subject the
23 user to criminal sanctions under applicable laws, as well as to
24 civil liability for the breach of the terms and conditions of this
25 license.
26  
27 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
28 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
29 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
30 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
31 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
32 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
33  
34 ********************************************************************
35 File Description:
36  
37 Change History:
38 Rev Date Description
39 1.1 09/11/06 Add base signed types
40 1.2 02/28/07 Add QWORD, LONGLONG, QWORD_VAL
41 1.3 02/06/08 Add def's for PIC32
42 1.4 08/08/08 Remove LSB/MSB Macros, adopted by Peripheral lib
43 1.5 08/14/08 Simplify file header
44 2.0 07/13/09 Updated for new release of coding standards
45 *******************************************************************/
46  
47 #ifndef __GENERIC_TYPE_DEFS_H_
48 #define __GENERIC_TYPE_DEFS_H_
49  
50 /* Specify an extension for GCC based compilers */
51 #if defined(__GNUC__)
52 #define __EXTENSION __extension__
53 #else
54 #define __EXTENSION
55 #endif
56  
57 #if !defined(__PACKED)
58 #define __PACKED
59 #endif
60  
61 /* get compiler defined type definitions (NULL, size_t, etc) */
62 #include <stddef.h>
63  
64 typedef enum _BOOL { FALSE = 0, TRUE } BOOL; /* Undefined size */
65 typedef enum _BIT { CLEAR = 0, SET } BIT;
66  
67 #define PUBLIC /* Function attributes */
68 #define PROTECTED
69 #define PRIVATE static
70  
71 /* INT is processor specific in length may vary in size */
72 typedef signed int INT;
73 typedef signed char INT8;
74 typedef signed short int INT16;
75 typedef signed long int INT32;
76  
77 /* MPLAB C Compiler for PIC18 does not support 64-bit integers */
78 #if !defined(__18CXX)
79 __EXTENSION typedef signed long long INT64;
80 #endif
81  
82 /* UINT is processor specific in length may vary in size */
83 typedef unsigned int UINT;
84 typedef unsigned char UINT8;
85 typedef unsigned short int UINT16;
86 /* 24-bit type only available on C18 */
87 #if defined(__18CXX)
88 typedef unsigned short long UINT24;
89 #endif
90 typedef unsigned long int UINT32; /* other name for 32-bit integer */
91 /* MPLAB C Compiler for PIC18 does not support 64-bit integers */
92 #if !defined(__18CXX)
93 __EXTENSION typedef unsigned long long UINT64;
94 #endif
95  
96 typedef union
97 {
98 UINT8 Val;
99 struct
100 {
101 __EXTENSION UINT8 b0:1;
102 __EXTENSION UINT8 b1:1;
103 __EXTENSION UINT8 b2:1;
104 __EXTENSION UINT8 b3:1;
105 __EXTENSION UINT8 b4:1;
106 __EXTENSION UINT8 b5:1;
107 __EXTENSION UINT8 b6:1;
108 __EXTENSION UINT8 b7:1;
109 } bits;
110 } UINT8_VAL, UINT8_BITS;
111  
112 typedef union
113 {
114 UINT16 Val;
115 UINT8 v[2] __PACKED;
116 struct __PACKED
117 {
118 UINT8 LB;
119 UINT8 HB;
120 } byte;
121 struct __PACKED
122 {
123 __EXTENSION UINT8 b0:1;
124 __EXTENSION UINT8 b1:1;
125 __EXTENSION UINT8 b2:1;
126 __EXTENSION UINT8 b3:1;
127 __EXTENSION UINT8 b4:1;
128 __EXTENSION UINT8 b5:1;
129 __EXTENSION UINT8 b6:1;
130 __EXTENSION UINT8 b7:1;
131 __EXTENSION UINT8 b8:1;
132 __EXTENSION UINT8 b9:1;
133 __EXTENSION UINT8 b10:1;
134 __EXTENSION UINT8 b11:1;
135 __EXTENSION UINT8 b12:1;
136 __EXTENSION UINT8 b13:1;
137 __EXTENSION UINT8 b14:1;
138 __EXTENSION UINT8 b15:1;
139 } bits;
140 } UINT16_VAL, UINT16_BITS;
141  
142 /* 24-bit type only available on C18 */
143 #if defined(__18CXX)
144 typedef union
145 {
146 UINT24 Val;
147 UINT8 v[3] __PACKED;
148 struct __PACKED
149 {
150 UINT8 LB;
151 UINT8 HB;
152 UINT8 UB;
153 } byte;
154 struct __PACKED
155 {
156 __EXTENSION UINT8 b0:1;
157 __EXTENSION UINT8 b1:1;
158 __EXTENSION UINT8 b2:1;
159 __EXTENSION UINT8 b3:1;
160 __EXTENSION UINT8 b4:1;
161 __EXTENSION UINT8 b5:1;
162 __EXTENSION UINT8 b6:1;
163 __EXTENSION UINT8 b7:1;
164 __EXTENSION UINT8 b8:1;
165 __EXTENSION UINT8 b9:1;
166 __EXTENSION UINT8 b10:1;
167 __EXTENSION UINT8 b11:1;
168 __EXTENSION UINT8 b12:1;
169 __EXTENSION UINT8 b13:1;
170 __EXTENSION UINT8 b14:1;
171 __EXTENSION UINT8 b15:1;
172 __EXTENSION UINT8 b16:1;
173 __EXTENSION UINT8 b17:1;
174 __EXTENSION UINT8 b18:1;
175 __EXTENSION UINT8 b19:1;
176 __EXTENSION UINT8 b20:1;
177 __EXTENSION UINT8 b21:1;
178 __EXTENSION UINT8 b22:1;
179 __EXTENSION UINT8 b23:1;
180 } bits;
181 } UINT24_VAL, UINT24_BITS;
182 #endif
183  
184 typedef union
185 {
186 UINT32 Val;
187 UINT16 w[2] __PACKED;
188 UINT8 v[4] __PACKED;
189 struct __PACKED
190 {
191 UINT16 LW;
192 UINT16 HW;
193 } word;
194 struct __PACKED
195 {
196 UINT8 LB;
197 UINT8 HB;
198 UINT8 UB;
199 UINT8 MB;
200 } byte;
201 struct __PACKED
202 {
203 UINT16_VAL low;
204 UINT16_VAL high;
205 }wordUnion;
206 struct __PACKED
207 {
208 __EXTENSION UINT8 b0:1;
209 __EXTENSION UINT8 b1:1;
210 __EXTENSION UINT8 b2:1;
211 __EXTENSION UINT8 b3:1;
212 __EXTENSION UINT8 b4:1;
213 __EXTENSION UINT8 b5:1;
214 __EXTENSION UINT8 b6:1;
215 __EXTENSION UINT8 b7:1;
216 __EXTENSION UINT8 b8:1;
217 __EXTENSION UINT8 b9:1;
218 __EXTENSION UINT8 b10:1;
219 __EXTENSION UINT8 b11:1;
220 __EXTENSION UINT8 b12:1;
221 __EXTENSION UINT8 b13:1;
222 __EXTENSION UINT8 b14:1;
223 __EXTENSION UINT8 b15:1;
224 __EXTENSION UINT8 b16:1;
225 __EXTENSION UINT8 b17:1;
226 __EXTENSION UINT8 b18:1;
227 __EXTENSION UINT8 b19:1;
228 __EXTENSION UINT8 b20:1;
229 __EXTENSION UINT8 b21:1;
230 __EXTENSION UINT8 b22:1;
231 __EXTENSION UINT8 b23:1;
232 __EXTENSION UINT8 b24:1;
233 __EXTENSION UINT8 b25:1;
234 __EXTENSION UINT8 b26:1;
235 __EXTENSION UINT8 b27:1;
236 __EXTENSION UINT8 b28:1;
237 __EXTENSION UINT8 b29:1;
238 __EXTENSION UINT8 b30:1;
239 __EXTENSION UINT8 b31:1;
240 } bits;
241 } UINT32_VAL;
242  
243 /* MPLAB C Compiler for PIC18 does not support 64-bit integers */
244 #if !defined(__18CXX)
245 typedef union
246 {
247 UINT64 Val;
248 UINT32 d[2] __PACKED;
249 UINT16 w[4] __PACKED;
250 UINT8 v[8] __PACKED;
251 struct __PACKED
252 {
253 UINT32 LD;
254 UINT32 HD;
255 } dword;
256 struct __PACKED
257 {
258 UINT16 LW;
259 UINT16 HW;
260 UINT16 UW;
261 UINT16 MW;
262 } word;
263 struct __PACKED
264 {
265 __EXTENSION UINT8 b0:1;
266 __EXTENSION UINT8 b1:1;
267 __EXTENSION UINT8 b2:1;
268 __EXTENSION UINT8 b3:1;
269 __EXTENSION UINT8 b4:1;
270 __EXTENSION UINT8 b5:1;
271 __EXTENSION UINT8 b6:1;
272 __EXTENSION UINT8 b7:1;
273 __EXTENSION UINT8 b8:1;
274 __EXTENSION UINT8 b9:1;
275 __EXTENSION UINT8 b10:1;
276 __EXTENSION UINT8 b11:1;
277 __EXTENSION UINT8 b12:1;
278 __EXTENSION UINT8 b13:1;
279 __EXTENSION UINT8 b14:1;
280 __EXTENSION UINT8 b15:1;
281 __EXTENSION UINT8 b16:1;
282 __EXTENSION UINT8 b17:1;
283 __EXTENSION UINT8 b18:1;
284 __EXTENSION UINT8 b19:1;
285 __EXTENSION UINT8 b20:1;
286 __EXTENSION UINT8 b21:1;
287 __EXTENSION UINT8 b22:1;
288 __EXTENSION UINT8 b23:1;
289 __EXTENSION UINT8 b24:1;
290 __EXTENSION UINT8 b25:1;
291 __EXTENSION UINT8 b26:1;
292 __EXTENSION UINT8 b27:1;
293 __EXTENSION UINT8 b28:1;
294 __EXTENSION UINT8 b29:1;
295 __EXTENSION UINT8 b30:1;
296 __EXTENSION UINT8 b31:1;
297 __EXTENSION UINT8 b32:1;
298 __EXTENSION UINT8 b33:1;
299 __EXTENSION UINT8 b34:1;
300 __EXTENSION UINT8 b35:1;
301 __EXTENSION UINT8 b36:1;
302 __EXTENSION UINT8 b37:1;
303 __EXTENSION UINT8 b38:1;
304 __EXTENSION UINT8 b39:1;
305 __EXTENSION UINT8 b40:1;
306 __EXTENSION UINT8 b41:1;
307 __EXTENSION UINT8 b42:1;
308 __EXTENSION UINT8 b43:1;
309 __EXTENSION UINT8 b44:1;
310 __EXTENSION UINT8 b45:1;
311 __EXTENSION UINT8 b46:1;
312 __EXTENSION UINT8 b47:1;
313 __EXTENSION UINT8 b48:1;
314 __EXTENSION UINT8 b49:1;
315 __EXTENSION UINT8 b50:1;
316 __EXTENSION UINT8 b51:1;
317 __EXTENSION UINT8 b52:1;
318 __EXTENSION UINT8 b53:1;
319 __EXTENSION UINT8 b54:1;
320 __EXTENSION UINT8 b55:1;
321 __EXTENSION UINT8 b56:1;
322 __EXTENSION UINT8 b57:1;
323 __EXTENSION UINT8 b58:1;
324 __EXTENSION UINT8 b59:1;
325 __EXTENSION UINT8 b60:1;
326 __EXTENSION UINT8 b61:1;
327 __EXTENSION UINT8 b62:1;
328 __EXTENSION UINT8 b63:1;
329 } bits;
330 } UINT64_VAL;
331 #endif /* __18CXX */
332  
333 /***********************************************************************************/
334  
335 /* Alternate definitions */
336 typedef void VOID;
337  
338 typedef char CHAR8;
339 typedef unsigned char UCHAR8;
340  
341 typedef unsigned char BYTE; /* 8-bit unsigned */
342 typedef unsigned short int WORD; /* 16-bit unsigned */
343 typedef unsigned long DWORD; /* 32-bit unsigned */
344 /* MPLAB C Compiler for PIC18 does not support 64-bit integers */
345 __EXTENSION
346 typedef unsigned long long QWORD; /* 64-bit unsigned */
347 typedef signed char CHAR; /* 8-bit signed */
348 typedef signed short int SHORT; /* 16-bit signed */
349 typedef signed long LONG; /* 32-bit signed */
350 /* MPLAB C Compiler for PIC18 does not support 64-bit integers */
351 __EXTENSION
352 typedef signed long long LONGLONG; /* 64-bit signed */
353 typedef union
354 {
355 BYTE Val;
356 struct __PACKED
357 {
358 __EXTENSION BYTE b0:1;
359 __EXTENSION BYTE b1:1;
360 __EXTENSION BYTE b2:1;
361 __EXTENSION BYTE b3:1;
362 __EXTENSION BYTE b4:1;
363 __EXTENSION BYTE b5:1;
364 __EXTENSION BYTE b6:1;
365 __EXTENSION BYTE b7:1;
366 } bits;
367 } BYTE_VAL, BYTE_BITS;
368  
369 typedef union
370 {
371 WORD Val;
372 BYTE v[2] __PACKED;
373 struct __PACKED
374 {
375 BYTE LB;
376 BYTE HB;
377 } byte;
378 struct __PACKED
379 {
380 __EXTENSION BYTE b0:1;
381 __EXTENSION BYTE b1:1;
382 __EXTENSION BYTE b2:1;
383 __EXTENSION BYTE b3:1;
384 __EXTENSION BYTE b4:1;
385 __EXTENSION BYTE b5:1;
386 __EXTENSION BYTE b6:1;
387 __EXTENSION BYTE b7:1;
388 __EXTENSION BYTE b8:1;
389 __EXTENSION BYTE b9:1;
390 __EXTENSION BYTE b10:1;
391 __EXTENSION BYTE b11:1;
392 __EXTENSION BYTE b12:1;
393 __EXTENSION BYTE b13:1;
394 __EXTENSION BYTE b14:1;
395 __EXTENSION BYTE b15:1;
396 } bits;
397 } WORD_VAL, WORD_BITS;
398  
399 typedef union
400 {
401 DWORD Val;
402 WORD w[2] __PACKED;
403 BYTE v[4] __PACKED;
404 struct __PACKED
405 {
406 WORD LW;
407 WORD HW;
408 } word;
409 struct __PACKED
410 {
411 BYTE LB;
412 BYTE HB;
413 BYTE UB;
414 BYTE MB;
415 } byte;
416 struct __PACKED
417 {
418 WORD_VAL low;
419 WORD_VAL high;
420 }wordUnion;
421 struct __PACKED
422 {
423 __EXTENSION BYTE b0:1;
424 __EXTENSION BYTE b1:1;
425 __EXTENSION BYTE b2:1;
426 __EXTENSION BYTE b3:1;
427 __EXTENSION BYTE b4:1;
428 __EXTENSION BYTE b5:1;
429 __EXTENSION BYTE b6:1;
430 __EXTENSION BYTE b7:1;
431 __EXTENSION BYTE b8:1;
432 __EXTENSION BYTE b9:1;
433 __EXTENSION BYTE b10:1;
434 __EXTENSION BYTE b11:1;
435 __EXTENSION BYTE b12:1;
436 __EXTENSION BYTE b13:1;
437 __EXTENSION BYTE b14:1;
438 __EXTENSION BYTE b15:1;
439 __EXTENSION BYTE b16:1;
440 __EXTENSION BYTE b17:1;
441 __EXTENSION BYTE b18:1;
442 __EXTENSION BYTE b19:1;
443 __EXTENSION BYTE b20:1;
444 __EXTENSION BYTE b21:1;
445 __EXTENSION BYTE b22:1;
446 __EXTENSION BYTE b23:1;
447 __EXTENSION BYTE b24:1;
448 __EXTENSION BYTE b25:1;
449 __EXTENSION BYTE b26:1;
450 __EXTENSION BYTE b27:1;
451 __EXTENSION BYTE b28:1;
452 __EXTENSION BYTE b29:1;
453 __EXTENSION BYTE b30:1;
454 __EXTENSION BYTE b31:1;
455 } bits;
456 } DWORD_VAL;
457  
458 /* MPLAB C Compiler for PIC18 does not support 64-bit integers */
459 typedef union
460 {
461 QWORD Val;
462 DWORD d[2] __PACKED;
463 WORD w[4] __PACKED;
464 BYTE v[8] __PACKED;
465 struct __PACKED
466 {
467 DWORD LD;
468 DWORD HD;
469 } dword;
470 struct __PACKED
471 {
472 WORD LW;
473 WORD HW;
474 WORD UW;
475 WORD MW;
476 } word;
477 struct __PACKED
478 {
479 __EXTENSION BYTE b0:1;
480 __EXTENSION BYTE b1:1;
481 __EXTENSION BYTE b2:1;
482 __EXTENSION BYTE b3:1;
483 __EXTENSION BYTE b4:1;
484 __EXTENSION BYTE b5:1;
485 __EXTENSION BYTE b6:1;
486 __EXTENSION BYTE b7:1;
487 __EXTENSION BYTE b8:1;
488 __EXTENSION BYTE b9:1;
489 __EXTENSION BYTE b10:1;
490 __EXTENSION BYTE b11:1;
491 __EXTENSION BYTE b12:1;
492 __EXTENSION BYTE b13:1;
493 __EXTENSION BYTE b14:1;
494 __EXTENSION BYTE b15:1;
495 __EXTENSION BYTE b16:1;
496 __EXTENSION BYTE b17:1;
497 __EXTENSION BYTE b18:1;
498 __EXTENSION BYTE b19:1;
499 __EXTENSION BYTE b20:1;
500 __EXTENSION BYTE b21:1;
501 __EXTENSION BYTE b22:1;
502 __EXTENSION BYTE b23:1;
503 __EXTENSION BYTE b24:1;
504 __EXTENSION BYTE b25:1;
505 __EXTENSION BYTE b26:1;
506 __EXTENSION BYTE b27:1;
507 __EXTENSION BYTE b28:1;
508 __EXTENSION BYTE b29:1;
509 __EXTENSION BYTE b30:1;
510 __EXTENSION BYTE b31:1;
511 __EXTENSION BYTE b32:1;
512 __EXTENSION BYTE b33:1;
513 __EXTENSION BYTE b34:1;
514 __EXTENSION BYTE b35:1;
515 __EXTENSION BYTE b36:1;
516 __EXTENSION BYTE b37:1;
517 __EXTENSION BYTE b38:1;
518 __EXTENSION BYTE b39:1;
519 __EXTENSION BYTE b40:1;
520 __EXTENSION BYTE b41:1;
521 __EXTENSION BYTE b42:1;
522 __EXTENSION BYTE b43:1;
523 __EXTENSION BYTE b44:1;
524 __EXTENSION BYTE b45:1;
525 __EXTENSION BYTE b46:1;
526 __EXTENSION BYTE b47:1;
527 __EXTENSION BYTE b48:1;
528 __EXTENSION BYTE b49:1;
529 __EXTENSION BYTE b50:1;
530 __EXTENSION BYTE b51:1;
531 __EXTENSION BYTE b52:1;
532 __EXTENSION BYTE b53:1;
533 __EXTENSION BYTE b54:1;
534 __EXTENSION BYTE b55:1;
535 __EXTENSION BYTE b56:1;
536 __EXTENSION BYTE b57:1;
537 __EXTENSION BYTE b58:1;
538 __EXTENSION BYTE b59:1;
539 __EXTENSION BYTE b60:1;
540 __EXTENSION BYTE b61:1;
541 __EXTENSION BYTE b62:1;
542 __EXTENSION BYTE b63:1;
543 } bits;
544 } QWORD_VAL;
545  
546 #undef __EXTENSION
547  
548 #endif /* __GENERIC_TYPE_DEFS_H_ */
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3