Revision 335
more docs
uart.h | ||
---|---|---|
8 | 8 |
* @{ |
9 | 9 |
*/ |
10 | 10 |
|
11 |
/// @brief COM1 base address |
|
11 | 12 |
#define COM1_ADDR 0x3F8 |
13 |
/// @brief COM2 base address |
|
12 | 14 |
#define COM2_ADDR 0x2F8 |
15 |
/// @brief COM1 IRQ line |
|
13 | 16 |
#define COM1_IRQ 4 |
17 |
/// @brief COM2 IRQ line |
|
14 | 18 |
#define COM2_IRQ 3 |
19 |
/// @brief COM1 Vector (???) |
|
15 | 20 |
#define COM1_VECTOR 0x0C |
21 |
/// @brief COM2 Vector (???) |
|
16 | 22 |
#define COM2_VECTOR 0x0B |
17 | 23 |
|
24 |
/** |
|
25 |
* @brief Possible parity schemes for UART. |
|
26 |
*/ |
|
18 | 27 |
typedef enum { |
19 | 28 |
uart_parity_none = 0x0, |
20 | 29 |
uart_parity_odd = 0x1, |
... | ... | |
23 | 32 |
uart_parity_par0 = 0x7 |
24 | 33 |
} uart_parity; |
25 | 34 |
|
35 |
/** |
|
36 |
* @brief UART configuration |
|
37 |
*/ |
|
26 | 38 |
typedef struct { |
39 |
/// @brief Base address of the serial port this configuration was read from |
|
27 | 40 |
int base_addr ; |
41 |
/// @brief LCR (Line Control Register) |
|
28 | 42 |
uint8_t lcr ; |
43 |
/// @brief DLL (Divisor Latch Least significant byte) |
|
29 | 44 |
uint8_t dll ; |
45 |
/// @brief DLL (Divisor Latch Most significant byte) |
|
30 | 46 |
uint8_t dlm ; |
47 |
/// @brief Number of bits per char |
|
31 | 48 |
uint8_t bits_per_char ; |
49 |
/// @brief Number of stop bits |
|
32 | 50 |
uint8_t stop_bits ; |
51 |
/// @brief Parity scheme |
|
33 | 52 |
uart_parity parity ; |
53 |
/// @brief Break control (???) |
|
34 | 54 |
uint8_t break_control :1; |
55 |
/// @brief Divisor Latch Access Bit (1 if DLL, DLM can be accessed) |
|
35 | 56 |
uint8_t dlab :1; |
57 |
/// @brief Divisor latch |
|
36 | 58 |
uint16_t divisor_latch ; |
59 |
/// @brief IER (Interrupt Enable Register) |
|
37 | 60 |
uint8_t ier ; |
61 |
/// @brief Receiver data interrupt enabled if 1 |
|
38 | 62 |
uint8_t received_data_int :1; |
63 |
/// @brief Transmitter empty interrupt enabled if 1 |
|
39 | 64 |
uint8_t transmitter_empty_int :1; |
65 |
/// @brief Receiver line status register (LSR) change interrupt enabled if 1 |
|
40 | 66 |
uint8_t receiver_line_stat_int:1; |
67 |
/// @brief Modem status interrupt enabled if 1 |
|
41 | 68 |
uint8_t modem_stat_int :1; |
42 | 69 |
} uart_config; |
43 | 70 |
|
Also available in: Unified diff