ser_avr.h

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