usart.h

Go to the documentation of this file.
00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
00023 /* Copyright (c) 2006, Atmel Corporation All rights reserved.
00024  *
00025  * Redistribution and use in source and binary forms, with or without
00026  * modification, are permitted provided that the following conditions are met:
00027  *
00028  * 1. Redistributions of source code must retain the above copyright notice,
00029  * this list of conditions and the following disclaimer.
00030  *
00031  * 2. Redistributions in binary form must reproduce the above copyright notice,
00032  * this list of conditions and the following disclaimer in the documentation
00033  * and/or other materials provided with the distribution.
00034  *
00035  * 3. The name of ATMEL may not be used to endorse or promote products derived
00036  * from this software without specific prior written permission.
00037  *
00038  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
00039  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00040  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
00041  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00042  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00043  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00044  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00045  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00046  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00047  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00048  */
00049 
00050 #ifndef _AVR32_USART_H_
00051 #define _AVR32_USART_H_
00052 
00053 #include <avr32/io.h>
00054 #include <stdio.h>
00055 #include "settings.h"
00056 
00058 #define USART_OK 0
00059 
00062 #define USART_FAILURE -1
00063 
00065 #define USART_ERROR_ARGUMENT 1
00066 
00067 #define USART_TX_BUSY  2
00068 
00069 #define USART_RX_EMPTY 3
00070 
00071 #define USART_RX_ERROR 4
00072 
00075 #define USART_MODE_FAULT 5
00076 
00079 #define USART_ADDR_RECEIVED 1
00080 
00082 #define USART_DEFAULT_TIMEOUT  10000
00083 
00085 #define USART_EVEN_PARITY   0
00086 
00087 #define USART_ODD_PARITY    1
00088 
00089 #define USART_SPACE_PARITY  2
00090 
00091 #define USART_MARK_PARITY   3
00092 
00093 #define USART_NO_PARITY     4
00094 
00095 #define USART_MULTIDROP_PARITY  6
00096 
00098 #define USART_MODE_NORMAL   0x00
00099 
00100 #define USART_MODE_RS485    0x01
00101 
00102 #define USART_MODE_HW_HSH   0x02
00103 
00104 #define USART_MODE_MODEM    0x03
00105 
00106 #define USART_MODE_ISO7816_T0   0x04
00107 
00108 #define USART_MODE_ISO7816_T1   0x06
00109 
00110 #define USART_MODE_IRDA     0x08
00111 
00112 #define USART_MODE_SW_HSH   0x0C
00113 
00115 #define USART_NORMAL_CHMODE 0
00116 
00117 #define USART_AUTO_ECHO     1
00118 
00119 #define USART_LOCAL_LOOPBACK    2
00120 
00121 #define USART_REMOTE_LOOPBACK   3
00122 
00124 #define USART_1_STOPBIT     0
00125 
00126 #define USART_1_5_STOPBITS  1
00127 
00128 #define USART_2_STOPBITS    2
00129 
00131 struct usart_options_t
00132 {
00134     unsigned long baudrate;
00135 
00137     unsigned char charlength;
00138 
00147     unsigned char paritytype;
00148 
00156     unsigned short stopbits;
00157 
00164     unsigned char channelmode;
00165 };
00166 
00167 void usart_reset( volatile avr32_usart_t * usart );
00168 
00169 int usart_linit( volatile avr32_usart_t * usart,
00170         const struct usart_options_t * opt,
00171         const long cpuHz );
00172 
00173 int usart_putchar( volatile avr32_usart_t * usart, const short character );
00174 
00175 #ifdef _write_r
00176 #undef _write_r
00177 #endif
00178 int _write_r(struct _reent *ptr, int fd, const void *buf, size_t cnt);
00179 
00180 #endif
00181 

Generated on Thu Oct 18 09:30:01 2007 for AVR32113 Configuration and Use of the Memory Management Unit by  doxygen 1.5.3