2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
\r
4 * This program is free software; you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation; either version 2 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with this program; if not, write to the Free Software
\r
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
18 * Revision : $Id: uart_defs.h,v 1.2.4.13 2009-06-29 20:28:27 zer0 Exp $
\r
22 /* Olivier MATZ, Droids-corp 2004 - 2006
\r
23 * Uart specific definitions
\r
26 #ifndef _UART_DEFS_H_
\r
27 #define _UART_DEFS_H_
\r
29 #define UART_PARTITY_NONE 0
\r
30 #define UART_PARTITY_ODD 1
\r
31 #define UART_PARTITY_EVEN 2
\r
33 #define UART_STOP_BITS_1 0
\r
34 #define UART_STOP_BITS_2 1
\r
37 #define UART_HW_NUM 4
\r
38 #elif (defined UDR2)
\r
39 #define UART_HW_NUM 3
\r
40 #elif (defined UDR1)
\r
41 #define UART_HW_NUM 2
\r
42 #else /* assume 1 uart */
\r
43 #define UART_HW_NUM 1
\r
47 /* For arch with only one UART, we consider that UART0 = UART */
\r
48 #if !defined(SIG_UART0_DATA) && !defined(SIG_USART0_DATA)
\r
49 #if defined SIG_UART_DATA
\r
50 #define SIG_UART0_DATA SIG_UART_DATA
\r
51 #elif defined SIG_USART_DATA
\r
52 #define SIG_UART0_DATA SIG_USART_DATA
\r
56 #if !defined(SIG_UART0_RECV) && !defined(SIG_USART0_RECV)
\r
57 #if defined SIG_UART_RECV
\r
58 #define SIG_UART0_RECV SIG_UART_RECV
\r
59 #elif defined SIG_USART_RECV
\r
60 #define SIG_UART0_RECV SIG_USART_RECV
\r
68 #define UCSR0A UCSRA
\r
71 #define UCSR0B UCSRB
\r
74 #define UCSR0C UCSRC
\r
77 #define UBRR0L UBRRL
\r
80 #define UBRR0H UBRRH
\r
86 #define UCSZ0 UCSZ00
\r
89 #define UCSZ1 UCSZ01
\r
92 #define UCSZ2 UCSZ02
\r
107 #define TXCIE TXCIE0
\r
113 #define RXCIE RXCIE0
\r
125 #define UDRIE UDRIE0
\r
131 /* makes functions more generic, we associate USR and UCR with UCSRA
\r
132 * and UCSRB, respectively */
\r
133 #if ( ! defined UCSRA ) && ( defined USR )
\r
137 #if ( ! defined UCSRB ) && ( defined UCR )
\r
141 /* UBRR is UBRRL */
\r
147 /* workaround for libc incomplete headers when using CAN AVR
\r
148 * (avr/iocanxx.h): USART is valid.
\r
149 * see http://savannah.nongnu.org/bugs/?18964
\r
151 #if defined (__AVR_AT90CAN128__) || defined (__AVR_AT90CAN64__) || defined (__AVR_AT90CAN32__)
\r
153 #ifndef SIG_USART0_RECV
\r
154 #define SIG_USART0_RECV SIG_UART0_RECV
\r
155 #define SIG_USART1_RECV SIG_UART1_RECV
\r
156 #define SIG_USART0_DATA SIG_UART0_DATA
\r
157 #define SIG_USART1_DATA SIG_UART1_DATA
\r
158 #define SIG_USART0_TRANS SIG_UART0_TRANS
\r
159 #define SIG_USART1_TRANS SIG_UART1_TRANS
\r
165 /* if the signal USART is defined, the uC has a USART. */
\r
166 #if ( defined SIG_USART0_RECV ) || ( defined SIG_USART_RECV )
\r
167 #define UART_IS_USART 1
\r
168 #elif (defined USART_UDRE_vect) || (defined USART_TXC_vect) || (defined USART_RXC_vect)
\r
169 #define UART_IS_USART 1
\r
171 #define UART_IS_USART 0
\r
174 /* if the U2X macro is defined, the uC has the U2X option. */
\r
176 #define UART_HAS_U2X 1
\r
178 #define UART_HAS_U2X 0
\r
181 #endif //_UART_DEFS_H_
\r