00001 00002 //***************************************************************************** 00003 // 00004 // File Name : 'avrlibtypes.h' 00005 // Title : AVRlib global types and typedefines include file 00006 // Author : Pascal Stang 00007 // Created : 7/12/2001 00008 // Revised : 9/30/2002 00009 // Version : 1.0 00010 // Target MCU : Atmel AVR series 00011 // Editor Tabs : 4 00012 // 00013 // Description : Type-defines required and used by AVRlib. Most types are also 00014 // generally useful. 00015 // 00016 // This code is distributed under the GNU Public License 00017 // which can be found at http://www.gnu.org/licenses/gpl.txt 00018 // 00019 //***************************************************************************** 00020 00021 00022 #ifndef AVRLIBTYPES_H 00023 #define AVRLIBTYPES_H 00024 00025 #ifndef WIN32 00026 // true/false defines 00027 #ifndef FALSE 00028 #define FALSE 0 00029 #define TRUE 1 00030 #endif 00031 #endif 00032 00033 // datatype definitions macros 00034 typedef unsigned char u08; 00035 typedef signed char s08; 00036 typedef unsigned short u16; 00037 typedef signed short s16; 00038 typedef unsigned long u32; 00039 typedef signed long s32; 00040 typedef unsigned long long u64; 00041 typedef signed long long s64; 00042 00043 /* use inttypes.h instead 00044 // C99 standard integer type definitions 00045 typedef unsigned char uint8_t; 00046 typedef signed char int8_t; 00047 typedef unsigned short uint16_t; 00048 typedef signed short int16_t; 00049 typedef unsigned long uint32_t; 00050 typedef signed long int32_t; 00051 typedef unsigned long uint64_t; 00052 typedef signed long int64_t; 00053 */ 00054 // maximum value that can be held 00055 // by unsigned data types (8,16,32bits) 00056 #define MAX_U08 255 00057 #define MAX_U16 65535 00058 #define MAX_U32 4294967295 00059 00060 // maximum values that can be held 00061 // by signed data types (8,16,32bits) 00062 #define MIN_S08 -128 00063 #define MAX_S08 127 00064 #define MIN_S16 -32768 00065 #define MAX_S16 32767 00066 #define MIN_S32 -2147483648 00067 #define MAX_S32 2147483647 00068 00069 #ifndef _INTEGER 00070 00071 /* These types must be 16-bit, 32-bit or larger integer */ 00072 typedef int INT; 00073 typedef unsigned int UINT; 00074 00075 /* These types must be 8-bit integer */ 00076 typedef signed char CHAR; 00077 typedef unsigned char UCHAR; 00078 typedef unsigned char BYTE; 00079 00080 /* These types must be 16-bit integer */ 00081 typedef short SHORT; 00082 typedef unsigned short USHORT; 00083 typedef unsigned short WORD; 00084 00085 /* These types must be 32-bit integer */ 00086 typedef long LONG; 00087 typedef unsigned long ULONG; 00088 typedef unsigned long DWORD; 00089 00090 /* Boolean type */ 00091 //typedef enum { FALSE = 0, TRUE } BOOL; 00092 00093 #define _INTEGER 00094 #endif 00095 00096 /* 00097 #ifndef WIN32 00098 // more type redefinitions 00099 typedef unsigned char BOOL; 00100 typedef unsigned char BYTE; 00101 typedef unsigned int WORD; 00102 typedef unsigned long DWORD; 00103 00104 typedef unsigned char UCHAR; 00105 typedef unsigned int UINT; 00106 typedef unsigned short USHORT; 00107 typedef unsigned long ULONG; 00108 00109 typedef char CHAR; 00110 typedef int INT; 00111 typedef long LONG; 00112 #endif 00113 */ 00114 00115 #endif