00001
00050 #ifndef COMPILER_AVR_H
00051 #define COMPILER_AVR_H
00052
00054 #define AVR_ENTER_CRITICAL_REGION( ) uint8_t volatile saved_sreg = SREG; cli( );
00055
00058 #define AVR_LEAVE_CRITICAL_REGION( ) SREG = saved_sreg;
00059
00060 #if defined( __ICCAVR__ )
00061
00062 #include <inavr.h>
00063 #include <ioavr.h>
00064 #include "crc16.h"
00065
00077 #define delay_us( us ) ( __delay_cycles( ( F_CPU / 1000000UL ) * ( us ) ) )
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 #define PRAGMA(x) _Pragma( #x )
00092 #define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void)
00093 #define sei( ) (__enable_interrupt( ))
00094 #define cli( ) (__disable_interrupt( ))
00095
00096 #define INLINE PRAGMA( inline=forced ) static
00097
00098 #elif defined( __GNUC__ )
00099
00100 #include <avr/io.h>
00101 #include <avr/interrupt.h>
00102
00103 #include <util/crc16.h>
00104 #include <util/delay.h>
00105
00106 #define delay_us( us ) (_delay_us( us ))
00107
00108 #define INLINE static inline
00109 #define crc_ccitt_update( crc, data ) _crc_ccitt_update( crc, data )
00110
00111 #define __z
00112 #else
00113 #error Compiler not supported.
00114 #endif
00115 #endif