ser_avr.h

Go to the documentation of this file.
00001 
00041 #ifndef DRV_SER_AVR_H
00042 #define DRV_SER_AVR_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_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281
00090     SER_UART0,
00091     SER_UART1,
00092     SER_SPI,
00093 #elif CPU_AVR_ATMEGA103 || CPU_AVR_ATMEGA8
00094     SER_UART0,
00095     SER_SPI,
00096 #else
00097     #error unknown architecture
00098 #endif
00099     SER_CNT  
00100 };
00101 /*\}*/
00102 
00103 #endif /* DRV_SER_AVR_H */