Rev 1145 Rev 1858
1 /*! \file avrlibtypes.h \brief AVRlib global types and typedefines. */ 1 /*! \file avrlibtypes.h \brief AVRlib global types and typedefines. */
2 //***************************************************************************** 2 //*****************************************************************************
3 // 3 //
4 // File Name : 'avrlibtypes.h' 4 // File Name : 'avrlibtypes.h'
5 // Title : AVRlib global types and typedefines include file 5 // Title : AVRlib global types and typedefines include file
6 // Author : Pascal Stang 6 // Author : Pascal Stang
7 // Created : 7/12/2001 7 // Created : 7/12/2001
8 // Revised : 9/30/2002 8 // Revised : 9/30/2002
9 // Version : 1.0 9 // Version : 1.0
10 // Target MCU : Atmel AVR series 10 // Target MCU : Atmel AVR series
11 // Editor Tabs : 4 11 // Editor Tabs : 4
12 // 12 //
13 // Description : Type-defines required and used by AVRlib. Most types are also 13 // Description : Type-defines required and used by AVRlib. Most types are also
14 // generally useful. 14 // generally useful.
15 // 15 //
16 // This code is distributed under the GNU Public License 16 // This code is distributed under the GNU Public License
17 // which can be found at http://www.gnu.org/licenses/gpl.txt 17 // which can be found at http://www.gnu.org/licenses/gpl.txt
18 // 18 //
19 //***************************************************************************** 19 //*****************************************************************************
20   20  
21   21  
22 #ifndef AVRLIBTYPES_H 22 #ifndef AVRLIBTYPES_H
23 #define AVRLIBTYPES_H 23 #define AVRLIBTYPES_H
24   24  
25 #ifndef WIN32 25 #ifndef WIN32
26 // true/false defines 26 // true/false defines
27 #define FALSE 0 27 #define FALSE 0
28 #define TRUE -1 28 #define TRUE -1
29 #endif 29 #endif
30   30  
31 // datatype definitions macros 31 // datatype definitions macros
32 typedef unsigned char u08; 32 typedef unsigned char u08;
33 typedef signed char s08; 33 typedef signed char s08;
34 typedef unsigned short u16; 34 typedef unsigned short u16;
35 typedef signed short s16; 35 typedef signed short s16;
36 typedef unsigned long u32; 36 typedef unsigned long u32;
37 typedef signed long s32; 37 typedef signed long s32;
38 typedef unsigned long long u64; 38 typedef unsigned long long u64;
39 typedef signed long long s64; 39 typedef signed long long s64;
40   40  
41 /* use inttypes.h instead 41 /* use inttypes.h instead
42 // C99 standard integer type definitions 42 // C99 standard integer type definitions
43 typedef unsigned char uint8_t; 43 typedef unsigned char uint8_t;
44 typedef signed char int8_t; 44 typedef signed char int8_t;
45 typedef unsigned short uint16_t; 45 typedef unsigned short uint16_t;
46 typedef signed short int16_t; 46 typedef signed short int16_t;
47 typedef unsigned long uint32_t; 47 typedef unsigned long uint32_t;
48 typedef signed long int32_t; 48 typedef signed long int32_t;
49 typedef unsigned long uint64_t; 49 typedef unsigned long uint64_t;
50 typedef signed long int64_t; 50 typedef signed long int64_t;
51 */ 51 */
52 // maximum value that can be held 52 // maximum value that can be held
53 // by unsigned data types (8,16,32bits) 53 // by unsigned data types (8,16,32bits)
54 #define MAX_U08 255 54 #define MAX_U08 255
55 #define MAX_U16 65535 55 #define MAX_U16 65535
56 #define MAX_U32 4294967295 56 #define MAX_U32 4294967295
57   57  
58 // maximum values that can be held 58 // maximum values that can be held
59 // by signed data types (8,16,32bits) 59 // by signed data types (8,16,32bits)
60 #define MIN_S08 -128 60 #define MIN_S08 -128
61 #define MAX_S08 127 61 #define MAX_S08 127
62 #define MIN_S16 -32768 62 #define MIN_S16 -32768
63 #define MAX_S16 32767 63 #define MAX_S16 32767
64 #define MIN_S32 -2147483648 64 #define MIN_S32 -2147483648
65 #define MAX_S32 2147483647 65 #define MAX_S32 2147483647
66   66  
67 #ifndef WIN32 67 #ifndef WIN32
68 // more type redefinitions 68 // more type redefinitions
69 typedef unsigned char BOOL; 69 typedef unsigned char BOOL;
70 typedef unsigned char BYTE; 70 typedef unsigned char BYTE;
71 typedef unsigned int WORD; 71 typedef unsigned int WORD;
72 typedef unsigned long DWORD; 72 typedef unsigned long DWORD;
73   73  
74 typedef unsigned char UCHAR; 74 typedef unsigned char UCHAR;
75 typedef unsigned int UINT; 75 typedef unsigned int UINT;
76 typedef unsigned short USHORT; 76 typedef unsigned short USHORT;
77 typedef unsigned long ULONG; 77 typedef unsigned long ULONG;
78   78  
79 typedef char CHAR; 79 typedef char CHAR;
80 typedef int INT; 80 typedef int INT;
81 typedef long LONG; 81 typedef long LONG;
82 #endif 82 #endif
83   83  
84 #endif 84 #endif