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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#[repr(C)]
pub struct serial_struct_t {
pub type_: i32,
pub line: i32,
pub port: u32,
pub irq: i32,
pub flags: i32,
pub xmit_fifo_size: i32,
pub custom_divisor: i32,
pub baud_base: i32,
pub close_delay: u16,
pub io_type: u8,
pub reserved_char: [u8; 1],
pub hub6: i32,
pub closing_wait: u16,
pub closing_wait2: u16,
pub iomem_base: *mut u8,
pub iomem_reg_shift: u16,
pub port_high: u32,
pub iomap_base: usize,
}
pub const ASYNC_CLOSING_WAIT_INF: i32 = 0;
pub const ASYNC_CLOSING_WAIT_NONE: i32 = 65535;
pub const PORT_UNKNOWN: i32 = 0;
pub const PORT_8250: i32 = 1;
pub const PORT_16450: i32 = 2;
pub const PORT_16550: i32 = 3;
pub const PORT_16550A: i32 = 4;
pub const PORT_CIRRUS: i32 = 5;
pub const PORT_16650: i32 = 6;
pub const PORT_16650V2: i32 = 7;
pub const PORT_16750: i32 = 8;
pub const PORT_STARTECH: i32 = 9;
pub const PORT_16C950: i32 = 10;
pub const PORT_16654: i32 = 11;
pub const PORT_16850: i32 = 12;
pub const PORT_RSA: i32 = 13;
pub const PORT_MAX: i32 = 13;
pub const SERIAL_IO_PORT: i32 = 0;
pub const SERIAL_IO_HUB6: i32 = 1;
pub const SERIAL_IO_MEM: i32 = 2;
pub const SERIAL_IO_MEM32: i32 = 3;
pub const SERIAL_IO_AU: i32 = 4;
pub const SERIAL_IO_TSI: i32 = 5;
pub const SERIAL_IO_MEM32BE: i32 = 6;
pub const SERIAL_IO_MEM16: i32 = 7;
pub const UART_CLEAR_FIFO: i32 = 0x01;
pub const UART_USE_FIFO: i32 = 0x02;
pub const UART_STARTECH: i32 = 0x04;
pub const UART_NATSEMI: i32 = 0x08;
#[repr(C)]
pub struct serial_multiport_struct_t {
pub irq: i32,
pub port1: i32,
pub mask1: u8,
pub match1: u8,
pub port2: i32,
pub mask2: u8,
pub match2: u8,
pub port3: i32,
pub mask3: u8,
pub match3: u8,
pub port4: i32,
pub mask4: u8,
pub match4: u8,
pub port_monitor: i32,
reserved: [i32; 32],
}
#[repr(C)]
pub struct serial_icounter_struct_t {
pub cts: i32,
pub dsr: i32,
pub rng: i32,
pub dcd: i32,
pub rx: i32,
pub tx: i32,
pub frame: i32,
pub overrun: i32,
pub parity: i32,
pub brk: i32,
pub buf_overrun: i32,
reserved: [i32; 9],
}
#[repr(C)]
pub struct serial_rs485_t {
pub flags: u32,
pub delay_rts_before_send: u32,
pub delay_rts_after_send: u32,
padding: [u32; 5],
}
pub const SER_RS485_ENABLED: i32 = (1 << 0);
pub const SER_RS485_RTS_ON_SEND: i32 = (1 << 1);
pub const SER_RS485_RTS_AFTER_SEND: i32 = (1 << 2);
pub const SER_RS485_RX_DURING_TX: i32 = (1 << 4);
pub const SER_RS485_TERMINATE_BUS: i32 = (1 << 5);
#[repr(C)]
pub struct serial_iso7816_t {
pub flags: u32,
pub tg: u32,
pub sc_fi: u32,
pub sc_di: u32,
pub clk: u32,
reserved: [u32; 5],
}
pub const SER_ISO7816_ENABLED: i32 = (1 << 0);
pub const SER_ISO7816_T_PARAM: i32 = (0x0f << 4);
#[inline]
pub fn SER_ISO7816_T(t: i32) -> i32 {
(t & 0x0f) << 4
}