1
2
3
4
5
6
7
8
9
10 #ifndef _LINUX_SERIAL_H
11 #define _LINUX_SERIAL_H
12
13 struct serial_struct {
14 int type;
15 int line;
16 int port;
17 int irq;
18 int flags;
19 int xmit_fifo_size;
20 int custom_divisor;
21 int baud_base;
22 unsigned short close_delay;
23 char reserved_char[2];
24 int hub6;
25 unsigned short closing_wait;
26 unsigned short closing_wait2;
27 int reserved[4];
28 };
29
30
31
32
33
34 #define ASYNC_CLOSING_WAIT_INF 0
35 #define ASYNC_CLOSING_WAIT_NONE 65535
36
37
38
39
40 #define PORT_UNKNOWN 0
41 #define PORT_8250 1
42 #define PORT_16450 2
43 #define PORT_16550 3
44 #define PORT_16550A 4
45 #define PORT_CIRRUS 5
46 #define PORT_16650 6
47 #define PORT_MAX 6
48
49
50
51
52 #define ASYNC_HUP_NOTIFY 0x0001
53
54 #define ASYNC_FOURPORT 0x0002
55 #define ASYNC_SAK 0x0004
56 #define ASYNC_SPLIT_TERMIOS 0x0008
57
58 #define ASYNC_SPD_MASK 0x0030
59 #define ASYNC_SPD_HI 0x0010
60
61 #define ASYNC_SPD_VHI 0x0020
62 #define ASYNC_SPD_CUST 0x0030
63
64 #define ASYNC_SKIP_TEST 0x0040
65 #define ASYNC_AUTO_IRQ 0x0080
66 #define ASYNC_SESSION_LOCKOUT 0x0100
67 #define ASYNC_PGRP_LOCKOUT 0x0200
68 #define ASYNC_CALLOUT_NOHUP 0x0400
69
70 #define ASYNC_FLAGS 0x0FFF
71 #define ASYNC_USR_MASK 0x0430
72
73
74
75 #define ASYNC_INITIALIZED 0x80000000
76 #define ASYNC_CALLOUT_ACTIVE 0x40000000
77 #define ASYNC_NORMAL_ACTIVE 0x20000000
78 #define ASYNC_BOOT_AUTOCONF 0x10000000
79 #define ASYNC_CLOSING 0x08000000
80 #define ASYNC_CTS_FLOW 0x04000000
81 #define ASYNC_CHECK_CD 0x02000000
82 #define ASYNC_SHARE_IRQ 0x01000000
83
84
85
86
87 struct serial_multiport_struct {
88 int irq;
89 int port1;
90 unsigned char mask1, match1;
91 int port2;
92 unsigned char mask2, match2;
93 int port3;
94 unsigned char mask3, match3;
95 int port4;
96 unsigned char mask4, match4;
97 int port_monitor;
98 int reserved[32];
99 };
100
101
102
103
104
105 struct serial_icounter_struct {
106 int cts, dsr, rng, dcd;
107 int reserved[16];
108 };
109
110
111 #ifdef __KERNEL__
112
113
114
115
116
117
118
119
120
121 #include <linux/termios.h>
122 #include <linux/tqueue.h>
123
124
125
126
127 struct async_icount {
128 __u32 cts, dsr, rng, dcd;
129 };
130
131 struct async_struct {
132 int magic;
133 int baud_base;
134 int port;
135 int irq;
136 int flags;
137 int hub6;
138 int type;
139 struct tty_struct *tty;
140 int read_status_mask;
141 int ignore_status_mask;
142 int timeout;
143 int xmit_fifo_size;
144 int custom_divisor;
145 int x_char;
146 int close_delay;
147 unsigned short closing_wait;
148 unsigned short closing_wait2;
149 int IER;
150 int MCR;
151 int MCR_noint;
152 unsigned long event;
153 unsigned long last_active;
154 int line;
155 int count;
156 int blocked_open;
157 long session;
158 long pgrp;
159 unsigned char *xmit_buf;
160 int xmit_head;
161 int xmit_tail;
162 int xmit_cnt;
163 struct tq_struct tqueue;
164 struct tq_struct tqueue_hangup;
165 struct termios normal_termios;
166 struct termios callout_termios;
167 struct wait_queue *open_wait;
168 struct wait_queue *close_wait;
169 struct wait_queue *delta_msr_wait;
170 struct async_icount icount;
171 struct async_struct *next_port;
172 struct async_struct *prev_port;
173 };
174
175 #define SERIAL_MAGIC 0x5301
176
177
178
179
180 #define SERIAL_XMIT_SIZE 4096
181
182
183
184
185
186 #define RS_EVENT_WRITE_WAKEUP 0
187
188
189
190
191 struct rs_multiport_struct {
192 int port1;
193 unsigned char mask1, match1;
194 int port2;
195 unsigned char mask2, match2;
196 int port3;
197 unsigned char mask3, match3;
198 int port4;
199 unsigned char mask4, match4;
200 int port_monitor;
201 };
202
203
204 extern int register_serial(struct serial_struct *req);
205 extern void unregister_serial(int line);
206 #endif
207 #endif