xref: /netbsd-src/sys/compat/linux/arch/powerpc/linux_termios.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1 /*	$NetBSD: linux_termios.h,v 1.9 2008/04/28 20:23:43 martin Exp $ */
2 
3 /*-
4  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Eric Haszlakiewicz and Emmanuel Dreyfus.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _POWERPC_LINUX_TERMIOS_H
33 #define _POWERPC_LINUX_TERMIOS_H
34 
35 #define LINUX_NCC 10
36 #define LINUX_NCCS 19
37 
38 /*
39  * Enable optional part of struct termios
40  * in sys/compat/linux/common/linux_termios.h
41  */
42 #define LINUX_LARGE_STRUCT_TERMIOS
43 
44 /*
45  * From Linux's include/asm-ppc/termios.h
46  */
47 #define LINUX_TCGETS		_LINUX_IOR('t', 19, struct linux_termios)
48 #define LINUX_TCSETS		_LINUX_IOW('t', 20, struct linux_termios)
49 #define LINUX_TCSETSW	_LINUX_IOW('t', 21, struct linux_termios)
50 #define LINUX_TCSETSF	_LINUX_IOW('t', 22, struct linux_termios)
51 #define LINUX_TCGETA		_LINUX_IOR('t', 23, struct linux_termio)
52 #define LINUX_TCSETA		_LINUX_IOW('t', 24, struct linux_termio)
53 #define LINUX_TCSETAW	_LINUX_IOW('t', 25, struct linux_termio)
54 #define LINUX_TCSETAF	_LINUX_IOW('t', 28, struct linux_termio)
55 #define LINUX_TCSBRK		_LINUX_IO('t', 29)
56 #define LINUX_TCXONC		_LINUX_IO('t', 30)
57 #define LINUX_TCFLSH		_LINUX_IO('t', 31)
58 #define LINUX_TIOCEXCL	0x540c
59 #define LINUX_TIOCNXCL	0x540d
60 #define LINUX_TIOCSCTTY	0x540e
61 #define LINUX_TIOCGPGRP	_LINUX_IOR('t', 119, int)
62 #define LINUX_TIOCSPGRP	_LINUX_IOW('t', 118, int)
63 #define LINUX_TIOCOUTQ	_LINUX_IOR('t', 115, int)
64 #define LINUX_TIOCSTI		0x5412
65 #define LINUX_TIOCGWINSZ 	_LINUX_IOR('t', 104, struct linux_winsize)
66 #define LINUX_TIOCSWINSZ 	_LINUX_IOW('t', 103, struct linux_winsize)
67 #define LINUX_TIOCMGET		0x5415
68 #define LINUX_TIOCMBIS		0x5416
69 #define LINUX_TIOCMBIC		0x5417
70 #define LINUX_TIOCMSET		0x5418
71 #define LINUX_TIOCGSOFTCAR	0x5419
72 #define LINUX_TIOCSSOFTCAR	0x541a
73 #define LINUX_FIONREAD		_LINUX_IOR('f', 127, int)
74 #define LINUX_TIOCINQ		LINUX_FIONREAD
75 #define LINUX_TIOCLINUX		0x541c
76 #define LINUX_TIOCCONS		0x541d
77 #define LINUX_TIOCGSERIAL	0x541e
78 #define LINUX_TIOCSSERIAL	0x541f
79 #define LINUX_TIOCPKT		0x5420
80 #define LINUX_FIONBIO		_LINUX_IOW('f', 126, int)
81 #define LINUX_TIOCNOTTY		0x5422
82 #define LINUX_TIOCSETD		0x5423
83 #define LINUX_TIOCGETD		0x5424
84 #define LINUX_TCSBRKP		0x5425
85 #define LINUX_TIOCTTYGSTRUCT	0x5426
86 
87 #define LINUX_FIONCLEX		_LINUX_IO('f', 2)
88 #define LINUX_FIOCLEX		_LINUX_IO('f', 1)
89 #define LINUX_FIOASYNC		_LINUX_IOW('f', 125, int)
90 #define LINUX_TIOCSERCONFIG	0x5453
91 #define LINUX_TIOCSERGWILD		0x5454
92 #define LINUX_TIOCSERSWILD		0x5455
93 #define LINUX_TIOCGLCKTRMIOS	0x5456
94 #define LINUX_TIOCSLCKTRMIOS	0x5457
95 #define LINUX_TIOCSERGSTRUCT	0x5458
96 #define LINUX_TIOCSERGETLSR	0x5459
97 #define LINUX_TIOCSERGETMULTI 0x545a
98 #define LINUX_TIOCSERSETMULTI 0x545b
99 
100 /*
101  * linux_termios c_cc chars:
102  * From Linux include/asm-ppc/termios.h AND include/asm-ppc/termbits.h
103  */
104 #define LINUX_VINTR 	0
105 #define LINUX_VQUIT 	1
106 #define LINUX_VERASE 2
107 #define LINUX_VKILL 	3
108 #define LINUX_VEOF 	4
109 #define LINUX_VMIN 	5
110 #define LINUX_VEOL 	6
111 #define LINUX_VTIME 	7
112 #define LINUX_VEOL2 	8
113 #define LINUX_VSWTC 	9
114 
115 /*
116  * The following is from include/asm-ppc/termbits.h only
117  */
118 #define LINUX_VWERASE   10
119 #define LINUX_VREPRINT  11
120 #define LINUX_VSUSP     12
121 #define LINUX_VSTART    13
122 #define LINUX_VSTOP     14
123 #define LINUX_VLNEXT    15
124 #define LINUX_VDISCARD  16
125 
126 /*
127  * Old style linux_termio
128  * XXX Not found anywhere in Linux
129  */
130 #define	LINUX_OLD_VINTR	LINUX_VINTR
131 #define	LINUX_OLD_VQUIT	LINUX_VQUIT
132 #define	LINUX_OLD_VERASE	LINUX_VERASE
133 #define	LINUX_OLD_VKILL	LINUX_VKILL
134 #define	LINUX_OLD_VEOF		LINUX_VEOF
135 #define	LINUX_OLD_VMIN		LINUX_VMIN
136 #define	LINUX_OLD_VEOL		LINUX_VEOL
137 #define	LINUX_OLD_VTIME	LINUX_VTIME
138 #define	LINUX_OLD_VEOL2	LINUX_VEOL2
139 #define	LINUX_OLD_VSWTC	LINUX_VSWTC
140 
141 /*
142  * All the remaining stuff is from  Linux's include/asm-ppc/termbits.h
143  * Note that theses values are octal, not hex.
144  * Linux c_iflag masks
145  */
146 #define LINUX_IGNBRK	0000001
147 #define LINUX_BRKINT	0000002
148 #define LINUX_IGNPAR	0000004
149 #define LINUX_PARMRK	0000010
150 #define LINUX_INPCK	0000020
151 #define LINUX_ISTRIP	0000040
152 #define LINUX_INLCR	0000100
153 #define LINUX_IGNCR	0000200
154 #define LINUX_ICRNL	0000400
155 #define LINUX_IXON	0001000
156 #define LINUX_IXOFF	0002000
157 #define LINUX_IXANY	0004000
158 #define LINUX_IUCLC	0010000
159 #define LINUX_IMAXBEL	0002000
160 
161 /*
162  * Linux c_oflag masks
163  */
164 #define LINUX_OPOST	0000001
165 #define LINUX_ONLCR	0000002
166 #define LINUX_OLCUC	0000004
167 #define LINUX_OCRNL	0000010
168 #define LINUX_ONOCR	0000020
169 #define LINUX_ONLRET	0000040
170 
171 #define LINUX_OFILL	00000100
172 #define LINUX_OFDEL	00000200
173 #define LINUX_NLDLY	00001400
174 #define LINUX_NL0	00000000
175 #define LINUX_NL1  	00000400
176 #define LINUX_NL2  	00001000
177 #define LINUX_NL3  	00001400
178 #define LINUX_TABDLY	00006000
179 #define LINUX_TAB0 	00000000
180 #define LINUX_TAB1 	00002000
181 #define LINUX_TAB2 	00004000
182 #define LINUX_TAB3 	00006000
183 #define LINUX_CRDLY	00030000
184 #define LINUX_CR0  	00000000
185 #define LINUX_CR1  	00010000
186 #define LINUX_CR2  	00020000
187 #define LINUX_CR3  	00030000
188 #define LINUX_FFDLY	00040000
189 #define LINUX_FF0  	00000000
190 #define LINUX_FF1  	00040000
191 #define LINUX_BSDLY	00100000
192 #define LINUX_BS0  	00000000
193 #define LINUX_BS1  	00100000
194 #define LINUX_VTDLY	00200000
195 #define LINUX_VT0  	00000000
196 #define LINUX_VT1  	00200000
197 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
198 #define LINUX_XTABS	01000000
199 
200 /*
201  * Linux c_cflag bit masks
202  * XXX not found in Linux, but it is needed to build
203  */
204 #define LINUX_NSPEEDS   16
205 
206 #define LINUX_CBAUD	0000377
207 #define LINUX_B0	0000000     /* hang up */
208 #define LINUX_B50  	0000001
209 #define LINUX_B75   	0000002
210 #define LINUX_B110  	0000003
211 #define LINUX_B134  	0000004
212 #define LINUX_B150  	0000005
213 #define LINUX_B200  	0000006
214 #define LINUX_B300  	0000007
215 #define LINUX_B600  	0000010
216 #define LINUX_B1200 	0000011
217 #define LINUX_B1800 	0000012
218 #define LINUX_B2400 	0000013
219 #define LINUX_B4800 	0000014
220 #define LINUX_B9600 	0000015
221 #define LINUX_B19200	0000016
222 #define LINUX_B38400	0000017
223 #define LINUX_EXTA 	LINUX_B19200
224 #define LINUX_EXTB 	LINUX_B38400
225 #define LINUX_CBAUDEX	0000000
226 #define LINUX_B57600 	00020
227 #define LINUX_B115200	00021
228 #define LINUX_B230400	00022
229 #define LINUX_B460800	00023
230 #define LINUX_B500000	00024
231 #define LINUX_B576000	00025
232 #define LINUX_B921600	00026
233 #define LINUX_B1000000	00027
234 #define LINUX_B1152000	00030
235 #define LINUX_B1500000	00031
236 #define LINUX_B2000000	00032
237 #define LINUX_B2500000	00033
238 #define LINUX_B3000000	00034
239 #define LINUX_B3500000	00035
240 #define LINUX_B4000000	00036
241 
242 #define LINUX_CSIZE	00001400
243 #define LINUX_CS5	00000000
244 #define LINUX_CS6	00000400
245 #define LINUX_CS7 	00001000
246 #define LINUX_CS8	00001400
247 
248 #define LINUX_CSTOPB	00002000
249 #define LINUX_CREAD	00004000
250 #define LINUX_PARENB	00010000
251 #define LINUX_PARODD	00020000
252 #define LINUX_HUPCL	00040000
253 
254 #define LINUX_CLOCAL 	00100000
255 #define LINUX_CRTSCTS	020000000000    /* flow control */
256 
257 /*
258  * Linux c_lflag masks
259  */
260 #define LINUX_ISIG   0x00000080
261 #define LINUX_ICANON 0x00000100
262 #define LINUX_XCASE  0x00004000
263 #define LINUX_ECHO   0x00000008
264 #define LINUX_ECHOE  0x00000002
265 #define LINUX_ECHOK  0x00000004
266 #define LINUX_ECHONL 0x00000010
267 #define LINUX_NOFLSH 0x80000000
268 #define LINUX_TOSTOP 0x00400000
269 #define LINUX_ECHOCTL 0x00000040
270 #define LINUX_ECHOPRT 0x00000020
271 #define LINUX_ECHOKE 0x00000001
272 #define LINUX_FLUSHO 0x00800000
273 #define LINUX_PENDIN 0x20000000
274 #define LINUX_IEXTEN 0x00000400
275 
276 #endif /* !_POWERPC_LINUX_TERMIOS_H */
277