source: firmware/MSR/src/UARTBUF/UART0.H@ 11094

Last change on this file since 11094 was 10588, checked in by neise, 14 years ago
added MSR Firmware MSR is the little brother of FSC
File size: 2.4 KB
Line 
1/************************************************************************/
2/* */
3/* Interrupt driven buffered UART */
4/* */
5/* Author: Peter Dannegger */
6/* */
7/************************************************************************/
8#ifndef _uart0_h_
9#define _uart0_h_
10
11 // size must be in range 2 .. 256
12#define RX0_SIZE 10 // usable: RX0_SIZE + 2 (4 .. 258)
13#define TX0_SIZE 8 // usable: TX0_SIZE + 1 (3 .. 257)
14
15#define uputs0(x) uputs0_((u8*)(x)) // avoid char warning
16
17
18u8 ukbhit0( void ); // 0 = rx buffer empty
19u8 ugetchar0( void ); // get received byte
20u8 utx0_ready( void ); // 0 = tx still busy
21void uputchar0( u8 c ); // send byte
22void uputs0_( u8 *s ); // send string from SRAM
23void init_uart0( u16 bauddivider );
24
25
26#define UTX0_IEN SBIT( UCSR0B, UDRIE0 )
27#define URX0_IEN SBIT( UCSR0B, RXCIE0 )
28
29
30/****************************** Resolve AVR naming chaos ****************/
31
32//----------------------------- Interrupt vectors -----------------------/
33#ifndef USART0_RX_vect
34#if defined USART_RX_vect
35#define USART0_RX_vect USART_RX_vect
36#elif defined USART_RXC_vect
37#define USART0_RX_vect USART_RXC_vect
38#elif defined USART0_RXC_vect
39#define USART0_RX_vect USART0_RXC_vect
40#endif
41#endif
42
43#if !defined USART0_UDRE_vect && defined USART_UDRE_vect
44#define USART0_UDRE_vect USART_UDRE_vect
45#endif
46
47//----------------------------- Register names --------------------------/
48#ifndef UCSR0A
49#define UCSR0A UCSRA
50#endif
51#ifndef UCSR0B
52#define UCSR0B UCSRB
53#endif
54#ifndef UCSR0C
55#define UCSR0C UCSRC
56#endif
57#ifndef UDR0
58#define UDR0 UDR
59#endif
60#ifndef UBRR0L
61#define UBRR0L UBRRL
62#endif
63#ifndef UBRR0H
64#define UBRR0H UBRRH
65#endif
66
67//----------------------------- Bit names -------------------------------/
68#ifndef UCSZ00
69#define UCSZ00 UCSZ0
70#endif
71#ifndef UCSZ01
72#define UCSZ01 UCSZ1
73#endif
74#if !defined URSEL0 && defined URSEL
75#define URSEL0 URSEL
76#endif
77#ifndef RXEN0
78#define RXEN0 RXEN
79#endif
80#ifndef TXEN0
81#define TXEN0 TXEN
82#endif
83#ifndef UDRIE0
84#define UDRIE0 UDRIE
85#endif
86#ifndef RXCIE0
87#define RXCIE0 RXCIE
88#endif
89
90#endif
Note: See TracBrowser for help on using the repository browser.