Project

General

Profile

Statistics
| Revision:

root / proj / include / uart.h @ 241

History | View | Annotate | Download (971 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
    uint8_t dlab;
16
    uint16_t divisor_latch;
17
} uart_config;
18

    
19
int uart_get_config(int base_addr, uart_config *config);
20
void uart_parse_config(uart_config *config);
21
void uart_print_config(uart_config config);
22

    
23
int uart_enable_divisor_latch (int base_addr);
24
int uart_disable_divisor_latch(int base_addr);
25

    
26
int uart_write_config          (int base_addr, uint8_t     config       );
27
int uart_set_bits_per_character(int base_addr, uint8_t     bits_per_char);
28
int uart_set_stop_bits         (int base_addr, uint8_t     stop         );
29
int uart_set_parity            (int base_addr, uart_parity par          );
30
int uart_set_bit_rate          (int base_addr, float       bit_rate     );
31

    
32
#endif //UART_H_INCLUDED