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
83
84
85
86 struct serial_multiport_struct {
87 int irq;
88 int port1;
89 unsigned char mask1, match1;
90 int port2;
91 unsigned char mask2, match2;
92 int port3;
93 unsigned char mask3, match3;
94 int port4;
95 unsigned char mask4, match4;
96 int port_monitor;
97 int reserved[32];
98 };
99
100 #ifdef __KERNEL__
101
102
103
104
105
106
107
108
109
110 #include <linux/termios.h>
111 #include <linux/tqueue.h>
112
113 struct async_struct {
114 int magic;
115 int baud_base;
116 int port;
117 int irq;
118 int flags;
119 int hub6;
120 int type;
121 struct tty_struct *tty;
122 int read_status_mask;
123 int ignore_status_mask;
124 int timeout;
125 int xmit_fifo_size;
126 int custom_divisor;
127 int x_char;
128 int close_delay;
129 unsigned short closing_wait;
130 unsigned short closing_wait2;
131 int IER;
132 int MCR;
133 int MCR_noint;
134 unsigned long event;
135 unsigned long last_active;
136 int line;
137 int count;
138 int blocked_open;
139 long session;
140 long pgrp;
141 unsigned char *xmit_buf;
142 int xmit_head;
143 int xmit_tail;
144 int xmit_cnt;
145 struct tq_struct tqueue;
146 struct tq_struct tqueue_hangup;
147 struct termios normal_termios;
148 struct termios callout_termios;
149 struct wait_queue *open_wait;
150 struct wait_queue *close_wait;
151 struct async_struct *next_port;
152 struct async_struct *prev_port;
153 };
154
155 #define SERIAL_MAGIC 0x5301
156
157
158
159
160 #define SERIAL_XMIT_SIZE 4096
161
162
163
164
165
166 #define RS_EVENT_WRITE_WAKEUP 0
167
168
169
170
171 struct rs_multiport_struct {
172 int port1;
173 unsigned char mask1, match1;
174 int port2;
175 unsigned char mask2, match2;
176 int port3;
177 unsigned char mask3, match3;
178 int port4;
179 unsigned char mask4, match4;
180 int port_monitor;
181 };
182
183
184 extern int register_serial(struct serial_struct *req);
185 extern void unregister_serial(int line);
186 #endif
187 #endif