avrboot/mega32.h
Olaf Rempel c897637dc2 cleanup uart stuff
- use new per-cpu headers
- remove interrupt handling from uart functions
- correct baudrate calculation
- introduce UART_DOUBLESPEED to use fast mode
- introduce UART_SECOND to use 2nd uart on mega128
- move uart functions to main.c, delete uart.[ch]
- rename XTAL to F_CPU (avrlibc style)
- move some defines from Makefile to main.c
2006-05-19 22:19:18 +02:00

30 lines
716 B
C

#ifndef _MEGA32_H_
#define _MEGA32_H_
#define DEVTYPE 0x73
#define SIG_BYTE3 0x1E
#define SIG_BYTE2 0x95
#define SIG_BYTE1 0x02
#ifdef UART_DOUBLESPEED
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
#else
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
#endif
#define UART_BAUD_HIGH UBRRH
#define UART_BAUD_LOW UBRRL
#define UART_STATUS UCSRA
#define UART_TXREADY UDRE
#define UART_RXREADY RXC
#define UART_DOUBLE U2X
#define UART_CTRL UCSRB
#define UART_CTRL_DATA ((1<<TXEN) | (1<<RXEN))
#define UART_CTRL2 UCSRC
#define UART_CTRL2_DATA ((1<<URSEL) | (1<<UCSZ1) | (1<<UCSZ0))
#define UART_DATA UDR
#endif // #ifndef _MEGA32_H_