usart.h

Go to the documentation of this file.
00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
00022 /* Copyright (c) 2006, Atmel Corporation All rights reserved.
00023  *
00024  * Redistribution and use in source and binary forms, with or without
00025  * modification, are permitted provided that the following conditions are met:
00026  *
00027  * 1. Redistributions of source code must retain the above copyright notice,
00028  * this list of conditions and the following disclaimer.
00029  *
00030  * 2. Redistributions in binary form must reproduce the above copyright notice,
00031  * this list of conditions and the following disclaimer in the documentation
00032  * and/or other materials provided with the distribution.
00033  *
00034  * 3. The name of ATMEL may not be used to endorse or promote products derived
00035  * from this software without specific prior written permission.
00036  *
00037  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
00038  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00039  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
00040  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00041  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00042  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00043  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00045  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00046  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 /* _AVR32_USART_H_ */
00177 

Generated on Wed May 10 15:03:12 2006 for AVR32108 - Peripheral Direct Memory Access Driver by  doxygen 1.4.6-NO