root / proj / include / uart.h @ 237
History | View | Annotate | Download (953 Bytes)
1 |
#ifndef UART_H_INCLUDED
|
---|---|
2 |
#define UART_H_INCLUDED
|
3 |
|
4 |
#include "uart_macros.h" |
5 |
|
6 |
typedef struct { |
7 |
int base_addr;
|
8 |
uint8_t config; |
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; |
15 |
uint16_t divisor_latch; |
16 |
} uart_config; |
17 |
|
18 |
int uart_get_config(int base_addr, uart_config *config); |
19 |
void uart_parse_config(uart_config *config);
|
20 |
void uart_print_config(uart_config config);
|
21 |
|
22 |
int uart_enable_divisor_latch (int base_addr); |
23 |
int uart_disable_divisor_latch(int base_addr); |
24 |
|
25 |
int uart_write_config (int base_addr, uint8_t config ); |
26 |
int uart_set_bits_per_character(int base_addr, uint8_t bits_per_char); |
27 |
int uart_set_stop_bits (int base_addr, uint8_t stop ); |
28 |
int uart_set_parity (int base_addr, uart_parity par ); |
29 |
int uart_set_bit_rate (int base_addr, float bit_rate ); |
30 |
|
31 |
#endif //UART_H_INCLUDED |