00001
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef _AVR32_USART_H_
00050 #define _AVR32_USART_H_
00051
00052 #ifdef __GNUC__
00053 #include <avr32/io.h>
00054 #elif __ICCAVR32__
00055 #include <avr32/ioap7000.h>
00056 #else
00057 #error No know compiler used
00058 #endif
00059
00061 #define USART_OK 0
00062
00064 #define USART_FAILURE -1
00065
00066 #define USART_ERROR_ARGUMENT 1
00067
00068 #define USART_TX_BUSY 2
00069
00070 #define USART_RX_EMPTY 3
00071
00072 #define USART_RX_ERROR 4
00073
00075 #define USART_MODE_FAULT 5
00076
00078 #define USART_ADDR_RECEIVED 1
00079
00081 #define USART_DEFAULT_TIMEOUT 10000
00082
00084 #define USART_EVEN_PARITY 0
00085
00086 #define USART_ODD_PARITY 1
00087
00088 #define USART_SPACE_PARITY 2
00089
00090 #define USART_MARK_PARITY 3
00091
00092 #define USART_NO_PARITY 4
00093
00094 #define USART_MULTIDROP_PARITY 6
00095
00097 #define USART_MODE_NORMAL 0x00
00098
00099 #define USART_MODE_RS485 0x01
00100
00101 #define USART_MODE_HW_HSH 0x02
00102
00103 #define USART_MODE_MODEM 0x03
00104
00105 #define USART_MODE_ISO7816_T0 0x04
00106
00107 #define USART_MODE_ISO7816_T1 0x06
00108
00109 #define USART_MODE_IRDA 0x08
00110
00111 #define USART_MODE_SW_HSH 0x0C
00112
00114 #define USART_NORMAL_CHMODE 0
00115
00116 #define USART_AUTO_ECHO 1
00117
00118 #define USART_LOCAL_LOOPBACK 2
00119
00120 #define USART_REMOTE_LOOPBACK 3
00121
00123 #define USART_1_STOPBIT 0
00124
00125 #define USART_1_5_STOPBITS 1
00126
00127 #define USART_2_STOPBITS 2
00128
00130 struct usart_options_t
00131 {
00133 unsigned long baudrate;
00134
00136 unsigned char charlength;
00137
00146 unsigned char paritytype;
00147
00155 unsigned short stopbits;
00156
00163 unsigned char channelmode;
00164 };
00165
00166 void usart_reset(volatile struct avr32_usart_t * usart);
00167
00168 int usart_linit(volatile struct avr32_usart_t * usart,
00169 const struct usart_options_t * opt,
00170 const long cpuHz);
00171
00172 int usart_putchar(volatile struct avr32_usart_t * usart, const int character);
00173
00174 int usart_lwriteLine(volatile struct avr32_usart_t * usart, const char * string);
00175
00176 #endif
00177