1 /* Copyright (C) 1997,1999,2001,2003,2004,2005 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef _TERMIOS_H
19 # error "Never include <bits/termios.h> directly; use <termios.h> instead."
20 #endif
21 
22 typedef unsigned char	cc_t;
23 typedef unsigned int	speed_t;
24 typedef unsigned int	tcflag_t;
25 
26 /*
27  * termios type and macro definitions.  Be careful about adding stuff
28  * to this file since it's used in GNU libc and there are strict rules
29  * concerning namespace pollution.
30  */
31 
32 #define NCCS 32
33 struct termios {
34 	tcflag_t c_iflag;		/* input mode flags */
35 	tcflag_t c_oflag;		/* output mode flags */
36 	tcflag_t c_cflag;		/* control mode flags */
37 	tcflag_t c_lflag;		/* local mode flags */
38 	cc_t c_line;			/* line discipline (== c_cc[19]) */
39 	cc_t c_cc[NCCS];		/* control characters */
40 	speed_t c_ispeed;		/* input speed */
41 	speed_t c_ospeed;		/* output speed */
42 #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
43 #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
44 };
45 
46 /* c_cc characters */
47 #define VINTR	0
48 #define VQUIT	1
49 #define VERASE	2
50 #define VKILL	3
51 #define VEOF	4
52 #define VMIN	5
53 #define VEOL	6
54 #define VTIME	7
55 #define VEOL2	8
56 #define VSWTC	9
57 
58 #define VWERASE	10
59 #define VREPRINT	11
60 #define VSUSP		12
61 #define VSTART		13
62 #define VSTOP		14
63 #define VLNEXT		15
64 #define VDISCARD	16
65 
66 /* c_iflag bits */
67 #define IGNBRK	0000001
68 #define BRKINT	0000002
69 #define IGNPAR	0000004
70 #define PARMRK	0000010
71 #define INPCK	0000020
72 #define ISTRIP	0000040
73 #define INLCR	0000100
74 #define IGNCR	0000200
75 #define ICRNL	0000400
76 #define IXON	0001000
77 #define IXOFF	0002000
78 #define IXANY	0004000
79 #define IUCLC	0010000
80 #define IMAXBEL	0020000
81 #define IUTF8	0040000
82 
83 /* c_oflag bits */
84 #define OPOST	0000001
85 #define ONLCR	0000002
86 #define OLCUC	0000004
87 
88 #define OCRNL	0000010
89 #define ONOCR	0000020
90 #define ONLRET	0000040
91 
92 #define OFILL	00000100
93 #define OFDEL	00000200
94 #if defined __USE_MISC || defined __USE_XOPEN
95 # define NLDLY	00001400
96 # define   NL0	00000000
97 # define   NL1	00000400
98 # define   NL2	00001000
99 # define   NL3	00001400
100 # define TABDLY	00006000
101 # define   TAB0	00000000
102 # define   TAB1	00002000
103 # define   TAB2	00004000
104 # define   TAB3	00006000
105 # define CRDLY	00030000
106 # define   CR0	00000000
107 # define   CR1	00010000
108 # define   CR2	00020000
109 # define   CR3	00030000
110 # define FFDLY	00040000
111 # define   FF0	00000000
112 # define   FF1	00040000
113 # define BSDLY	00100000
114 # define   BS0	00000000
115 # define   BS1	00100000
116 #endif
117 #define VTDLY	00200000
118 #define   VT0	00000000
119 #define   VT1	00200000
120 
121 #ifdef __USE_MISC
122 # define XTABS	00006000
123 #endif
124 
125 /* c_cflag bit meaning */
126 #ifdef __USE_MISC
127 # define CBAUD	0000377
128 #endif
129 #define  B0	0000000		/* hang up */
130 #define  B50	0000001
131 #define  B75	0000002
132 #define  B110	0000003
133 #define  B134	0000004
134 #define  B150	0000005
135 #define  B200	0000006
136 #define  B300	0000007
137 #define  B600	0000010
138 #define  B1200	0000011
139 #define  B1800	0000012
140 #define  B2400	0000013
141 #define  B4800	0000014
142 #define  B9600	0000015
143 #define  B19200	0000016
144 #define  B38400	0000017
145 #ifdef __USE_MISC
146 # define EXTA B19200
147 # define EXTB B38400
148 # define CBAUDEX 0000020
149 #endif
150 #define  B57600   00020
151 #define  B115200  00021
152 #define  B230400  00022
153 #define  B460800  00023
154 #define  B500000  00024
155 #define  B576000  00025
156 #define  B921600  00026
157 #define  B1000000 00027
158 #define  B1152000 00030
159 #define  B1500000 00031
160 #define  B2000000 00032
161 #define  B2500000 00033
162 #define  B3000000 00034
163 #define  B3500000 00035
164 #define  B4000000 00036
165 #define __MAX_BAUD B4000000
166 
167 #define CSIZE	00001400
168 #define   CS5	00000000
169 #define   CS6	00000400
170 #define   CS7	00001000
171 #define   CS8	00001400
172 
173 #define CSTOPB	00002000
174 #define CREAD	00004000
175 #define PARENB	00010000
176 #define PARODD	00020000
177 #define HUPCL	00040000
178 
179 #define CLOCAL	00100000
180 #ifdef __USE_MISC
181 # define CMSPAR   010000000000		/* mark or space (stick) parity */
182 # define CRTSCTS  020000000000		/* flow control */
183 #endif
184 
185 /* c_lflag bits */
186 #define ISIG	0x00000080
187 #define ICANON	0x00000100
188 #if defined __USE_MISC || defined __USE_XOPEN
189 # define XCASE	0x00004000
190 #endif
191 #define ECHO	0x00000008
192 #define ECHOE	0x00000002
193 #define ECHOK	0x00000004
194 #define ECHONL	0x00000010
195 #define NOFLSH	0x80000000
196 #define TOSTOP	0x00400000
197 #ifdef __USE_MISC
198 # define ECHOCTL	0x00000040
199 # define ECHOPRT	0x00000020
200 # define ECHOKE	0x00000001
201 # define FLUSHO	0x00800000
202 # define PENDIN	0x20000000
203 #endif
204 #define IEXTEN	0x00000400
205 
206 /* Values for the ACTION argument to `tcflow'.  */
207 #define	TCOOFF		0
208 #define	TCOON		1
209 #define	TCIOFF		2
210 #define	TCION		3
211 
212 /* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
213 #define	TCIFLUSH	0
214 #define	TCOFLUSH	1
215 #define	TCIOFLUSH	2
216 
217 /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
218 #define	TCSANOW		0
219 #define	TCSADRAIN	1
220 #define	TCSAFLUSH	2
221 
222 #ifndef __UCLIBC_STRICT_HEADERS__
223 struct sgttyb {
224 	char	sg_ispeed;
225 	char	sg_ospeed;
226 	char	sg_erase;
227 	char	sg_kill;
228 	short	sg_flags;
229 };
230 #endif
231 
232 struct tchars {
233 	char	t_intrc;
234 	char	t_quitc;
235 	char	t_startc;
236 	char	t_stopc;
237 	char	t_eofc;
238 	char	t_brkc;
239 };
240 
241 struct ltchars {
242 	char	t_suspc;
243 	char	t_dsuspc;
244 	char	t_rprntc;
245 	char	t_flushc;
246 	char	t_werasc;
247 	char	t_lnextc;
248 };
249 
250 /* Used for packet mode */
251 #define TIOCPKT_DATA		 0
252 #define TIOCPKT_FLUSHREAD	 1
253 #define TIOCPKT_FLUSHWRITE	 2
254 #define TIOCPKT_STOP		 4
255 #define TIOCPKT_START		 8
256 #define TIOCPKT_NOSTOP		16
257 #define TIOCPKT_DOSTOP		32
258 
259 /* c_cc characters */
260 #define _VINTR	0
261 #define _VQUIT	1
262 #define _VERASE	2
263 #define _VKILL	3
264 #define _VEOF	4
265 #define _VMIN	5
266 #define _VEOL	6
267 #define _VTIME	7
268 #define _VEOL2	8
269 #define _VSWTC	9
270 
271 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
272 #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
273