root / proj / include / uart.h @ 245
History | View | Annotate | Download (1.29 KB)
1 | 235 | up20180642 | #ifndef UART_H_INCLUDED
|
---|---|---|---|
2 | #define UART_H_INCLUDED
|
||
3 | |||
4 | #include "uart_macros.h" |
||
5 | |||
6 | typedef struct { |
||
7 | 242 | up20180642 | int base_addr ;
|
8 | uint8_t lcr ; |
||
9 | uint8_t dll ; |
||
10 | uint8_t dlm ; |
||
11 | uint8_t bits_per_char ; |
||
12 | uint8_t stop_bits ; |
||
13 | uint8_t parity ; |
||
14 | uint8_t break_control :1;
|
||
15 | uint8_t dlab :1;
|
||
16 | uint16_t divisor_latch ; |
||
17 | uint8_t ier ; |
||
18 | uint8_t received_data_int :1;
|
||
19 | uint8_t transmitter_empty_int :1;
|
||
20 | uint8_t receiver_line_stat_int:1;
|
||
21 | uint8_t modem_stat_int :1;
|
||
22 | 235 | up20180642 | } uart_config; |
23 | |||
24 | int uart_get_config(int base_addr, uart_config *config); |
||
25 | void uart_parse_config(uart_config *config);
|
||
26 | void uart_print_config(uart_config config);
|
||
27 | |||
28 | int uart_enable_divisor_latch (int base_addr); |
||
29 | int uart_disable_divisor_latch(int base_addr); |
||
30 | |||
31 | int uart_write_config (int base_addr, uint8_t config ); |
||
32 | int uart_set_bits_per_character(int base_addr, uint8_t bits_per_char); |
||
33 | int uart_set_stop_bits (int base_addr, uint8_t stop ); |
||
34 | int uart_set_parity (int base_addr, uart_parity par ); |
||
35 | int uart_set_bit_rate (int base_addr, float bit_rate ); |
||
36 | |||
37 | #endif //UART_H_INCLUDED |