-
Notifications
You must be signed in to change notification settings - Fork 0
/
uart.h
40 lines (33 loc) · 1.14 KB
/
uart.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "kmem.h"
/*
* Taken from XNU pe_serial.c
*/
typedef uint8_t uart_reg_t;
#ifndef USE_SAMSUNG_UART
// UART register offsets
#define rULCON 0x00 // UART Line control
#define rUCON 0x04 // UART Control
#define rUFCON 0x08 // UART FIFO control
#define rUMCON 0x0c // UART Modem control
#define rUTRSTAT 0x10 // UART Tx/Rx status
#define rUERSTAT 0x14 // UART Rx error status
#define rUFSTAT 0x18 // UART FIFO status
#define rUMSTAT 0x1c // UART Modem status
#define rUTXH 0x20 // UART Transmission Hold
#define rURXH 0x24 // UART Receive buffer
#define rUBRDIV 0x28 // UART Baud rate divisor
#endif
struct pe_serial_functions {
void (*uart_init) (void);
void (*uart_set_baud_rate) (int unit, uint32_t baud_rate);
int (*tr0) (void);
void (*td0) (int c);
int (*rr0) (void);
int (*rd0) (void);
struct pe_serial_functions *next;
};
typedef struct uart_kernel_symbols {
kptr_t UART_BASE_PHYS;
kptr_t UART_BASE_VIRT;
kptr_t PE_CLOCK_FREQINFO;
} uart_offsets_t;