-
Notifications
You must be signed in to change notification settings - Fork 0
/
serial.h
57 lines (47 loc) · 1.73 KB
/
serial.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef QEMU_SERIAL_H
#define QEMU_SERIAL_H
#include <stdint.h>
#define UART_FIFO_LENGTH 16 /* 16550A Fifo Length */
typedef struct SerialFIFO {
uint8_t data[UART_FIFO_LENGTH];
uint8_t count;
uint8_t itl; /* Interrupt Trigger Level */
uint8_t tail;
uint8_t head;
} SerialFIFO;
struct SerialState {
uint16_t divider;
uint8_t rbr; /* receive register */
uint8_t _derived thr; /* transmit holding register */
uint8_t _derived tsr; /* transmit shift register */
uint8_t ier;
uint8_t iir; /* read only */
uint8_t lcr;
uint8_t mcr;
uint8_t lsr; /* read only */
uint8_t msr; /* read only */
uint8_t scr;
uint8_t _derived fcr;
uint8_t fcr_vmstate; /* we can't write directly this value
it has side effects */
/* NOTE: this hidden state is necessary for tx irq generation as
it can be reset while reading iir */
int thr_ipending _default(0);
qemu_irq _immutable irq;
CharDriverState _immutable *chr;
int _derived last_break_enable;
int _immutable it_shift;
int _immutable baudbase;
int _immutable tsr_retry;
uint64_t _derived last_xmit_ts; /* Time when the last byte was successfully sent out of the tsr */
SerialFIFO _derived recv_fifo;
SerialFIFO _derived xmit_fifo;
struct QEMUTimer _derived *fifo_timeout_timer;
int timeout_ipending _default(0); /* timeout interrupt pending state */
struct QEMUTimer _derived *transmit_timer;
uint64_t _immutable char_transmit_time; /* time to transmit a char in ticks*/
int _derived poll_msl;
struct QEMUTimer _derived *modem_status_poll;
MemoryRegion _immutable io;
};
#endif