Project

General

Profile

Revision 241

implementing uart

View differences:

uart_macros.h
10 10
#define COM1_VECTOR         0x0C
11 11
#define COM2_VECTOR         0x0B
12 12

  
13
#define UART_RBR            0
14
#define UART_THR            0
15
#define UART_IER            1
16
#define UART_IIR            2
17
#define UART_FCR            2
18
#define UART_LCR            3
19
#define UART_MCR            4
20
#define UART_LSR            5
21
#define UART_MSR            6
22
#define UART_SR             7
23

  
24
#define UART_DLL            0
25
#define UART_DLM            1
26

  
27
#define UART_BITS_PER_CHAR_POS 0
28
#define UART_STOP_BITS_POS     2
29
#define UART_PARITY_POS        3
30
#define UART_BREAK_CONTROL_POS 6
31
#define UART_DLAB_POS          7
32

  
33
#define UART_BITS_PER_CHAR  (BIT(0) | BIT(1))
34
#define UART_STOP_BITS      (BIT(2))
35
#define UART_PARITY         (BIT(3) | BIT(4) | BIT(5))
36
#define UART_BREAK_CONTROL  (BIT(6))
37
#define UART_DLAB           (BIT(7))
38

  
39
#define UART_GET_BITS_PER_CHAR(n) ((n)&UART_BITS_PER_CHAR + 5)
40
#define UART_GET_STOP_BITS(n)     ((n)&UART_STOP_BITS? 2 : 1)
41
#define UART_GET_PARITY(n)        (((n)&UART_PARITY       )>>UART_PARITY_POS       )
42
#define UART_GET_BREAK_CONTROL(n) (((n)&UART_BREAK_CONTROL)>>UART_BREAK_CONTROL_POS)
43
#define UART_GET_DLAB(n)          (((n)&UART_DLAB         )>>UART_DLAB_POS         )
44

  
45

  
46 13
typedef enum {
47 14
    uart_parity_none = 0x0,
48 15
    uart_parity_odd  = 0x1,

Also available in: Unified diff