initial commit
[glibc.git] / sysdeps / unix / bsd / bsd4.4 / kfreebsd / bits / termios.h
1 /* termios type and macro definitions. FreeBSD version.
2 Copyright (C) 1993-1994,1996-1997,1999,2001-2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
19
20 #ifndef _TERMIOS_H
21 # error "Never include <bits/termios.h> directly; use <termios.h> instead."
22 #endif
23
24 /* These macros are also defined in some <bits/ioctls.h> files (with
25 numerically identical values), but this serves to shut up cpp's
26 complaining. */
27 #ifdef __USE_MISC
28
29 # ifdef MDMBUF
30 # undef MDMBUF
31 # endif
32 # ifdef FLUSHO
33 # undef FLUSHO
34 # endif
35 # ifdef PENDIN
36 # undef PENDIN
37 # endif
38
39 #endif /* __USE_MISC */
40
41 #ifdef ECHO
42 # undef ECHO
43 #endif
44 #ifdef TOSTOP
45 # undef TOSTOP
46 #endif
47 #ifdef NOFLSH
48 # undef NOFLSH
49 #endif
50
51
52 typedef unsigned char cc_t;
53 typedef unsigned int speed_t;
54 typedef unsigned int tcflag_t;
55
56 #define NCCS 20
57 struct termios
58 {
59 tcflag_t c_iflag; /* input mode flags */
60 tcflag_t c_oflag; /* output mode flags */
61 tcflag_t c_cflag; /* control mode flags */
62 tcflag_t c_lflag; /* local mode flags */
63 cc_t c_cc[NCCS]; /* control characters */
64 speed_t c_ispeed; /* input speed */
65 speed_t c_ospeed; /* output speed */
66 #define __ispeed c_ispeed
67 #define __ospeed c_ospeed
68 #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
69 #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
70 };
71
72 /* c_cc characters */
73 #define VEOF 0
74 #define VEOL 1
75 #define VEOL2 2
76 #define VERASE 3
77 #define VWERASE 4
78 #define VKILL 5
79 #define VREPRINT 6
80 #ifdef __USE_MISC
81 # define VERASE2 7
82 #endif
83 #define VINTR 8
84 #define VQUIT 9
85 #define VSUSP 10
86 #ifdef __USE_MISC
87 # define VDSUSP 11
88 #endif
89 #define VSTART 12
90 #define VSTOP 13
91 #define VLNEXT 14
92 #define VDISCARD 15
93 #define VMIN 16
94 #define VTIME 17
95 #ifdef __USE_MISC
96 # define VSTATUS 18
97 #endif
98
99 /* c_iflag bits */
100 #define IGNBRK 0000001
101 #define BRKINT 0000002
102 #define IGNPAR 0000004
103 #define PARMRK 0000010
104 #define INPCK 0000020
105 #define ISTRIP 0000040
106 #define INLCR 0000100
107 #define IGNCR 0000200
108 #define ICRNL 0000400
109 #define IXON 0001000
110 #define IXOFF 0002000
111 #define IXANY 0004000
112 #define IMAXBEL 0020000
113
114 /* c_oflag bits */
115 #define OPOST (1 << 0) /* Perform output processing. */
116 #define ONLCR (1 << 1) /* Map NL to CR-NL on output. */
117 #if defined __USE_MISC || defined __USE_XOPEN
118 # define TAB0 (0 << 2) /* no tab delay and expansion */
119 # define TAB3 (1 << 2) /* expand tabs to spaces */
120 # define TABDLY TAB3 /* tab delay mask */
121 # define OXTABS TAB3
122 # define XTABS TAB3
123 #endif
124 #ifdef __USE_MISC
125 # define ONOEOT (1 << 3) /* Discard EOT (^D) on output. */
126 #endif
127 #define OCRNL (1 << 4) /* map CR to NL on output */
128 #define ONOCR (1 << 5) /* no CR output at column 0 */
129 #define ONLRET (1 << 6) /* NL performs CR function */
130
131 /* c_cflag bit meaning */
132 #ifdef __USE_MISC
133 # define CIGNORE (1 << 0) /* Ignore these control flags. */
134 #endif
135 #define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */
136 #define CS5 (0 << 8) /* 5 bits per byte. */
137 #define CS6 (1 << 8) /* 6 bits per byte. */
138 #define CS7 (2 << 8) /* 7 bits per byte. */
139 #define CS8 (3 << 8) /* 8 bits per byte. */
140 #define CSTOPB (1 << 10) /* Two stop bits instead of one. */
141 #define CREAD (1 << 11) /* Enable receiver. */
142 #define PARENB (1 << 12) /* Parity enable. */
143 #define PARODD (1 << 13) /* Odd parity instead of even. */
144 #define HUPCL (1 << 14) /* Hang up on last close. */
145 #define CLOCAL (1 << 15) /* Ignore modem status lines. */
146 #ifdef __USE_MISC
147 # define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */
148 # define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */
149 # define CRTSCTS (CCTS_OFLOW|CRTS_IFLOW) /* CTS/RTS flow control. */
150 # define CDTR_IFLOW (1 << 18) /* DTR flow control of input. */
151 # define CDSR_OFLOW (1 << 19) /* DSR flow control of output. */
152 # define CCAR_OFLOW (1 << 20) /* DCD flow control of output. */
153 # define MDMBUF (1 << 20) /* Carrier flow control of output. */
154 #endif
155
156 /* c_lflag bits */
157 #ifdef __USE_MISC
158 # define ECHOKE (1 << 0) /* Visual erase for KILL. */
159 #endif
160 #define ECHOE (1 << 1) /* Visual erase for ERASE. */
161 #define ECHOK (1 << 2) /* Echo NL after KILL. */
162 #define ECHO (1 << 3) /* Enable echo. */
163 #define ECHONL (1 << 4) /* Echo NL even if ECHO is off. */
164 #ifdef __USE_MISC
165 # define ECHOPRT (1 << 5) /* Hardcopy visual erase. */
166 # define ECHOCTL (1 << 6) /* Echo control characters as ^X. */
167 #endif
168 #define ISIG (1 << 7) /* Enable signals. */
169 #define ICANON (1 << 8) /* Do erase and kill processing. */
170 #ifdef __USE_MISC
171 # define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */
172 #endif
173 #define IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */
174 #ifdef __USE_MISC
175 # define EXTPROC (1 << 11) /* External processing. */
176 #endif
177 #define TOSTOP (1 << 22) /* Send SIGTTOU for background output. */
178 #ifdef __USE_MISC
179 # define FLUSHO (1 << 23) /* Output being flushed (state). */
180 # define NOKERNINFO (1 << 25) /* Disable VSTATUS. */
181 # define PENDIN (1 << 29) /* Retype pending input (state). */
182 #endif
183 #define NOFLSH (1 << 31) /* Disable flush after interrupt. */
184
185 /* Input and output baud rates. */
186 #define B0 0 /* Hang up. */
187 #define B50 50 /* 50 baud. */
188 #define B75 75 /* 75 baud. */
189 #define B110 110 /* 110 baud. */
190 #define B134 134 /* 134.5 baud. */
191 #define B150 150 /* 150 baud. */
192 #define B200 200 /* 200 baud. */
193 #define B300 300 /* 300 baud. */
194 #define B600 600 /* 600 baud. */
195 #define B1200 1200 /* 1200 baud. */
196 #define B1800 1800 /* 1800 baud. */
197 #define B2400 2400 /* 2400 baud. */
198 #define B4800 4800 /* 4800 baud. */
199 #define B9600 9600 /* 9600 baud. */
200 #define B19200 19200 /* 19200 baud. */
201 #define B38400 38400 /* 38400 baud. */
202 #define B76800 76800
203 #ifdef __USE_MISC
204 # define EXTA 19200
205 # define EXTB 38400
206 #endif
207 #define B7200 7200
208 #define B14400 14400
209 #define B28800 28800
210 #define B57600 57600
211 #define B115200 115200
212 #define B230400 230400
213 #define B460800 460800
214 #define B500000 500000
215 #define B576000 576000
216 #define B921600 921600
217 #define B1000000 1000000
218 #define B1152000 1152000
219 #define B1500000 1500000
220 #define B2000000 2000000
221 #define B2500000 2500000
222 #define B3000000 3000000
223 #define B3500000 3500000
224 #define B4000000 4000000
225 #define __MAX_BAUD B4000000
226
227 /* tcflow() and TCXONC use these */
228 #define TCOOFF 1
229 #define TCOON 2
230 #define TCIOFF 3
231 #define TCION 4
232
233 /* tcflush() and TCFLSH use these */
234 #define TCIFLUSH 1
235 #define TCOFLUSH 2
236 #define TCIOFLUSH 3
237
238 /* tcsetattr uses these */
239 #define TCSANOW 0
240 #define TCSADRAIN 1
241 #define TCSAFLUSH 2
242 #ifdef __USE_MISC
243 # define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */
244 #endif
245