uart.h


1
#include <lpc210x.h>
2
3
// IIR
4
#define UARTIIR_NOINT    0x01
5
#define UARTIIR_RDA     0x04
6
#define UARTIIR_CTI     0x0C
7
#define UARTIIR_RLS      0x06
8
#define  UARTIIR_THRE    0x02
9
#define UARTIIR_MASK    0x0E      
10
11
//LSR
12
#define UARTLSR_THRE     0x20
13
#define UARTLSR_RDR     0x01
14
15
//IER
16
#define UARTIER_RDA     0x01
17
#define UARTIER_THRE     0x02
18
#define UARTIER_RXLine    0x04
19
20
//FCR
21
#define UARTFCR_RST_TX    0x04
22
#define UARTFCR_RST_RX    0x02
23
#define UARTFCR_EN      0x01
24
#define UARTFCR_TRIGGER1  0x00
25
#define UARTFCR_TRIGGER2  0x40
26
#define UARTFCR_TRIGGER3  0x80
27
#define UARTFCR_TRIGGER4  0xC0
28
29
//LCR
30
#define UARTLCR_DLAB    0x70
31
32
/////////////Functions////////////
33
void UART0_Rx_ISR(void);
34
void initUARTs(void);
35
void wait(void);