BeRTOS
|
00001 00041 #ifndef DRV_SER_MEGA_H 00042 #define DRV_SER_MEGA_H 00043 00044 #include <cfg/macros.h> /* BV() */ 00045 #include <cfg/compiler.h> /* uint32_t */ 00046 00047 typedef uint8_t serstatus_t; 00048 00049 /* Software errors */ 00050 #define SERRF_RXFIFOOVERRUN BV(0) 00051 #define SERRF_RXTIMEOUT BV(5) 00052 #define SERRF_TXTIMEOUT BV(6) 00054 /* 00055 * Hardware errors. 00056 * These flags map directly to the AVR UART Status Register (USR). 00057 */ 00058 #define SERRF_RXSROVERRUN BV(3) 00059 #define SERRF_FRAMEERROR BV(4) 00060 #define SERRF_PARITYERROR BV(7) 00061 #define SERRF_NOISEERROR 0 00070 #define SPI_NORMAL_LOW 0 00071 #define SPI_NORMAL_HIGH 1 00072 00079 #define SPI_SAMPLE_ON_FIRST_EDGE 0 00080 #define SPI_SAMPLE_ON_SECOND_EDGE 1 00081 00087 enum 00088 { 00089 #if CPU_AVR_ATMEGA1280 || CPU_AVR_ATMEGA2560 00090 SER_UART0, 00091 SER_UART1, 00092 SER_UART2, 00093 SER_UART3, 00094 SER_SPI, 00095 #elif CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281 00096 SER_UART0, 00097 SER_UART1, 00098 SER_SPI, 00099 #elif CPU_AVR_ATMEGA103 || CPU_AVR_ATMEGA8 || CPU_AVR_ATMEGA32 || CPU_AVR_ATMEGA168 \ 00100 || CPU_AVR_ATMEGA328P 00101 SER_UART0, 00102 SER_SPI, 00103 #else 00104 #error unknown architecture 00105 #endif 00106 SER_CNT 00107 }; 00108 /*\}*/ 00109 00110 #endif /* DRV_SER_MEGA_H */