|
MEGA-1284P Xplained Example Application
|
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/ 00045 #ifndef COMPILER_AVR_H 00046 #define COMPILER_AVR_H 00047 00048 #ifndef F_CPU 00049 00050 #define F_CPU 11059200UL 00051 #endif 00052 00053 #include <stdint.h> 00054 #include <stdbool.h> 00055 #include <stdlib.h> 00056 #include <string.h> 00057 #include <stdio.h> 00058 00060 #define AVR_ENTER_CRITICAL_REGION( ) uint8_t volatile saved_sreg = SREG; \ 00061 cli(); 00062 00066 #define AVR_LEAVE_CRITICAL_REGION( ) SREG = saved_sreg; 00067 00068 #if defined( __ICCAVR__ ) 00069 00070 #include <inavr.h> 00071 #include <ioavr.h> 00072 #include <intrinsics.h> 00073 #include <pgmspace.h> 00074 00075 #ifndef __HAS_ELPM__ 00076 #define _MEMATTR __flash 00077 #else /* __HAS_ELPM__ */ 00078 #define _MEMATTR __farflash 00079 #endif /* __HAS_ELPM__ */ 00080 00091 #define delay_us( us ) ( __delay_cycles( ( F_CPU / 1000000UL ) * ( us ) ) ) 00092 00106 #define PRAGMA(x) _Pragma( #x ) 00107 #define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void) 00108 #define sei( ) (__enable_interrupt( )) 00109 #define cli( ) (__disable_interrupt( )) 00110 00112 #define nop( ) (__no_operation()) 00113 00115 #define watchdog_reset( ) (__watchdog_reset( )) 00116 00118 #define sleep_enter() __sleep() 00119 00120 #define INLINE PRAGMA( inline=forced ) static 00121 00122 #define FLASH_DECLARE(x) _MEMATTR x 00123 #define FLASH_STRING(x) ((_MEMATTR const char *)(x)) 00124 #define FLASH_STRING_T char const _MEMATTR * 00125 #define FLASH_BYTE_ARRAY_T uint8_t const _MEMATTR * 00126 #define PGM_READ_BYTE(x) *(x) 00127 #define PGM_READ_WORD(x) *(x) 00128 00129 #define SHORTENUM 00130 00131 #elif defined( __GNUC__ ) 00132 00133 #include <avr/io.h> 00134 #include <avr/interrupt.h> 00135 #include <avr/pgmspace.h> 00136 #include <util/delay.h> 00137 #include <avr/sleep.h> 00138 00139 00141 #define sleep_enter() sleep_cpu() 00142 00144 #define delay_us( us ) (_delay_us( us )) 00145 00146 #define INLINE static inline 00147 00149 #define nop() do { __asm__ __volatile__ ("nop"); } while (0) 00150 00151 #define MAIN_TASK_PROLOGUE int 00152 00153 00154 #define MAIN_TASK_EPILOGUE() return -1; 00155 00156 #define SHORTENUM __attribute__ ((packed)) 00157 00158 #else 00159 #error Compiler not supported. 00160 #endif 00161 00162 #endif 00163
1.7.3