Go to the documentation of this file.
45 #ifndef COMPILER_AVR_H
46 #define COMPILER_AVR_H
50 #define F_CPU 2000000UL
58 #define AVR_ENTER_CRITICAL_REGION( ) uint8_t volatile saved_sreg = SREG; \
64 #define AVR_LEAVE_CRITICAL_REGION( ) SREG = saved_sreg;
66 #if defined( __ICCAVR__ )
70 #include <intrinsics.h>
74 #define _MEMATTR __flash
76 #define _MEMATTR __farflash
89 #define delay_us( us ) ( __delay_cycles( ( F_CPU / 1000000UL ) * ( us ) ) )
104 #define PRAGMA(x) _Pragma( #x )
105 #define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void)
106 #define sei( ) (__enable_interrupt( ))
107 #define cli( ) (__disable_interrupt( ))
110 #define nop( ) (__no_operation())
113 #define watchdog_reset( ) (__watchdog_reset( ))
116 #define INLINE PRAGMA( inline=forced ) static
118 #define FLASH_DECLARE(x) _MEMATTR x
119 #define FLASH_STRING(x) ((_MEMATTR const char *)(x))
120 #define FLASH_STRING_T char const _MEMATTR *
121 #define FLASH_BYTE_ARRAY_T uint8_t const _MEMATTR *
122 #define PGM_READ_BYTE(x) *(x)
123 #define PGM_READ_WORD(x) *(x)
127 #elif defined( __GNUC__ )
130 #include <avr/interrupt.h>
131 #include <avr/pgmspace.h>
132 #include <util/delay.h>
135 #define delay_us( us ) (_delay_us( us ))
137 #define INLINE static inline
140 #define nop() do { __asm__ __volatile__ ("nop"); } while (0)
142 #define MAIN_TASK_PROLOGUE int
145 #define MAIN_TASK_EPILOGUE() return -1;
147 #define SHORTENUM __attribute__ ((packed))
150 #error Compiler not supported.