00001 #ifndef _ARCH_AVR_GCC_H_
00002 #define _ARCH_AVR_GCC_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 #define CONST const
00065 #define INLINE inline
00066
00067
00068 #include <avr/io.h>
00069 #include <avr/interrupt.h>
00070 #if __AVR_LIBC_VERSION__ < 10400UL
00071 #include <avr/signal.h>
00072 #endif
00073 #include <avr/eeprom.h>
00074 #include <avr/pgmspace.h>
00075 #include <avr/sleep.h>
00076 #include <stdlib.h>
00077
00078
00079
00080
00081
00082
00083 #ifdef eeprom_rb
00084 #include <avr/twi.h>
00085 #else
00086 #include <compat/twi.h>
00087 #endif
00088
00089 #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
00090 #if !defined(TXC)
00091 #define TXC TXC0
00092 #endif
00093 #if !defined(TXB8)
00094 #define TXB8 TXB80
00095 #endif
00096 #if !defined(UMSEL)
00097 #define UMSEL UMSEL00
00098 #endif
00099 #if !defined(U2X)
00100 #define U2X U2X0
00101 #endif
00102 #if !defined(UCSZ0)
00103 #define UCSZ0 UCSZ00
00104 #endif
00105 #if !defined(UCSZ1)
00106 #define UCSZ1 UCSZ01
00107 #endif
00108 #if !defined(UCSZ2)
00109 #define UCSZ2 UCSZ02
00110 #endif
00111 #if !defined(UPM0)
00112 #define UPM0 UPM00
00113 #endif
00114 #if !defined(UPM1)
00115 #define UPM1 UPM01
00116 #endif
00117
00118 #if !defined(USBS)
00119 #define USBS USBS0
00120 #endif
00121 #if !defined(UPE)
00122 #define UPE UPE0
00123 #endif
00124 #if !defined(MPCM)
00125 #define MPCM MPCM0
00126 #endif
00127 #if !defined(UCPOL)
00128 #define UCPOL UCPOL0
00129 #endif
00130 #endif
00131
00132 #ifndef __SFR_OFFSET
00133 #define __SFR_OFFSET 0
00134 #endif
00135
00136 #define COMPRESS_DISABLE
00137 #define COMPRESS_REENABLE
00138
00139 #ifndef _NOP
00140 #define _NOP() __asm__ __volatile__ ("nop")
00141 #endif
00142
00143 #ifndef atof
00144 #define atof(s) strtod(s, 0)
00145 #endif
00146
00147 #define EEPROMReadBytes(addr, ptr, size) eeprom_read_block((char *)(addr), ptr, size)
00148
00151 #define EEPROM_READ(addr, dst) eeprom_read_block((char *)(addr), &dst, sizeof(dst))
00152 #define EEPROMread(addr) eeprom_read_byte((char *)(addr))
00153
00157 #define EEPROM_WRITE(addr, src) \
00158 { \
00159 unsigned short __i; \
00160 for(__i = 0; __i < sizeof(src); __i++) \
00161 eeprom_write_byte(((char *)(addr)) + __i, *(((char *)(&(src))) + __i)); \
00162 }
00163
00164 #define EEPROMWriteBytes(addr, ptr, size) \
00165 { \
00166 unsigned short __i; \
00167 for(__i = 0; __i < size; __i++) \
00168 eeprom_write_byte(((char *)(addr)) + __i, *(((char *)(ptr)) + __i)); \
00169 }
00170
00171 #define main NutAppMain
00172
00173
00174 #ifndef _SLEEP_MODE_MASK
00175 #if defined(SM) && !defined(SM0) && !defined(SM1) && !defined(SM2)
00176 #define _SLEEP_MODE_MASK _BV(SM)
00177 #elif !defined(SM) && defined(SM0) && defined(SM1) && !defined(SM2)
00178 #define _SLEEP_MODE_MASK (_BV(SM0) | _BV(SM1))
00179 #elif !defined(SM) && defined(SM0) && defined(SM1) && defined(SM2)
00180 #define _SLEEP_MODE_MASK (_BV(SM0) | _BV(SM1) | _BV(SM2))
00181 #endif
00182 #endif
00183
00184 #endif
00185