]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/termios.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
27 * Copyright (c) 1988, 1989, 1993, 1994
28 * The Regents of the University of California. All rights reserved.
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
42 * 4. Neither the name of the University nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * @(#)termios.h 8.3 (Berkeley) 3/28/94
61 #ifndef _SYS_TERMIOS_H_
62 #define _SYS_TERMIOS_H_
65 * Special Control Characters
67 * Index into c_cc[] character array.
69 * Name Subscript Enabled by
71 #define VEOF 0 /* ICANON */
72 #define VEOL 1 /* ICANON */
74 #define VEOL2 2 /* ICANON together with IEXTEN */
76 #define VERASE 3 /* ICANON */
78 #define VWERASE 4 /* ICANON together with IEXTEN */
80 #define VKILL 5 /* ICANON */
82 #define VREPRINT 6 /* ICANON together with IEXTEN */
85 #define VINTR 8 /* ISIG */
86 #define VQUIT 9 /* ISIG */
87 #define VSUSP 10 /* ISIG */
89 #define VDSUSP 11 /* ISIG together with IEXTEN */
91 #define VSTART 12 /* IXON, IXOFF */
92 #define VSTOP 13 /* IXON, IXOFF */
94 #define VLNEXT 14 /* IEXTEN */
95 #define VDISCARD 15 /* IEXTEN */
97 #define VMIN 16 /* !ICANON */
98 #define VTIME 17 /* !ICANON */
100 #define VSTATUS 18 /* ICANON together with IEXTEN */
105 #ifndef _POSIX_VDISABLE
106 #define _POSIX_VDISABLE 0xff
109 #ifndef _POSIX_SOURCE
110 #define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
114 * Input flags - software input processing
116 #define IGNBRK 0x00000001 /* ignore BREAK condition */
117 #define BRKINT 0x00000002 /* map BREAK to SIGINTR */
118 #define IGNPAR 0x00000004 /* ignore (discard) parity errors */
119 #define PARMRK 0x00000008 /* mark parity and framing errors */
120 #define INPCK 0x00000010 /* enable checking of parity errors */
121 #define ISTRIP 0x00000020 /* strip 8th bit off chars */
122 #define INLCR 0x00000040 /* map NL into CR */
123 #define IGNCR 0x00000080 /* ignore CR */
124 #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
125 #define IXON 0x00000200 /* enable output flow control */
126 #define IXOFF 0x00000400 /* enable input flow control */
127 #ifndef _POSIX_SOURCE
128 #define IXANY 0x00000800 /* any char will restart after stop */
129 #define IMAXBEL 0x00002000 /* ring bell on input queue full */
130 #endif /*_POSIX_SOURCE */
133 * Output flags - software output processing
135 #define OPOST 0x00000001 /* enable following output processing */
136 #ifndef _POSIX_SOURCE
137 #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
138 #define OXTABS 0x00000004 /* expand tabs to spaces */
139 #define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */
140 #endif /*_POSIX_SOURCE */
143 * Control flags - hardware control of terminal
145 #ifndef _POSIX_SOURCE
146 #define CIGNORE 0x00000001 /* ignore control flags */
148 #define CSIZE 0x00000300 /* character size mask */
149 #define CS5 0x00000000 /* 5 bits (pseudo) */
150 #define CS6 0x00000100 /* 6 bits */
151 #define CS7 0x00000200 /* 7 bits */
152 #define CS8 0x00000300 /* 8 bits */
153 #define CSTOPB 0x00000400 /* send 2 stop bits */
154 #define CREAD 0x00000800 /* enable receiver */
155 #define PARENB 0x00001000 /* parity enable */
156 #define PARODD 0x00002000 /* odd parity, else even */
157 #define HUPCL 0x00004000 /* hang up on last close */
158 #define CLOCAL 0x00008000 /* ignore modem status lines */
159 #ifndef _POSIX_SOURCE
160 #define CCTS_OFLOW 0x00010000 /* CTS flow control of output */
161 #define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW)
162 #define CRTS_IFLOW 0x00020000 /* RTS flow control of input */
163 #define CDTR_IFLOW 0x00040000 /* DTR flow control of input */
164 #define CDSR_OFLOW 0x00080000 /* DSR flow control of output */
165 #define CCAR_OFLOW 0x00100000 /* DCD flow control of output */
166 #define MDMBUF 0x00100000 /* old name for CCAR_OFLOW */
171 * "Local" flags - dumping ground for other state
173 * Warning: some flags in this structure begin with
174 * the letter "I" and look like they belong in the
178 #ifndef _POSIX_SOURCE
179 #define ECHOKE 0x00000001 /* visual erase for line kill */
180 #endif /*_POSIX_SOURCE */
181 #define ECHOE 0x00000002 /* visually erase chars */
182 #define ECHOK 0x00000004 /* echo NL after line kill */
183 #define ECHO 0x00000008 /* enable echoing */
184 #define ECHONL 0x00000010 /* echo NL even if ECHO is off */
185 #ifndef _POSIX_SOURCE
186 #define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */
187 #define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */
188 #endif /*_POSIX_SOURCE */
189 #define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */
190 #define ICANON 0x00000100 /* canonicalize input lines */
191 #ifndef _POSIX_SOURCE
192 #define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */
193 #endif /*_POSIX_SOURCE */
194 #define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */
195 #define EXTPROC 0x00000800 /* external processing */
196 #define TOSTOP 0x00400000 /* stop background jobs from output */
197 #ifndef _POSIX_SOURCE
198 #define FLUSHO 0x00800000 /* output being flushed (state) */
199 #define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */
200 #define PENDIN 0x20000000 /* XXX retype pending input (state) */
201 #endif /*_POSIX_SOURCE */
202 #define NOFLSH 0x80000000 /* don't flush after interrupt */
204 typedef unsigned long tcflag_t
;
205 typedef unsigned char cc_t
;
206 typedef long speed_t
; /* XXX should be unsigned long */
209 tcflag_t c_iflag
; /* input flags */
210 tcflag_t c_oflag
; /* output flags */
211 tcflag_t c_cflag
; /* control flags */
212 tcflag_t c_lflag
; /* local flags */
213 cc_t c_cc
[NCCS
]; /* control chars */
214 speed_t c_ispeed
; /* input speed */
215 speed_t c_ospeed
; /* output speed */
219 * Commands passed to tcsetattr() for setting the termios structure.
221 #define TCSANOW 0 /* make change immediate */
222 #define TCSADRAIN 1 /* drain output, then change */
223 #define TCSAFLUSH 2 /* drain output, flush input */
224 #ifndef _POSIX_SOURCE
225 #define TCSASOFT 0x10 /* flag - don't alter h.w. state */
247 #ifndef _POSIX_SOURCE
253 #define B115200 115200
254 #define B230400 230400
257 #endif /* !_POSIX_SOURCE */
269 #include <sys/cdefs.h>
272 speed_t cfgetispeed
__P((const struct termios
*));
273 speed_t cfgetospeed
__P((const struct termios
*));
274 int cfsetispeed
__P((struct termios
*, speed_t
));
275 int cfsetospeed
__P((struct termios
*, speed_t
));
276 int tcgetattr
__P((int, struct termios
*));
277 int tcsetattr
__P((int, int, const struct termios
*));
278 int tcdrain
__P((int));
279 int tcflow
__P((int, int));
280 int tcflush
__P((int, int));
281 int tcsendbreak
__P((int, int));
283 #ifndef _POSIX_SOURCE
284 void cfmakeraw
__P((struct termios
*));
285 int cfsetspeed
__P((struct termios
*, speed_t
));
286 #endif /* !_POSIX_SOURCE */
291 #ifndef _POSIX_SOURCE
294 * Include tty ioctl's that aren't just for backwards compatibility
295 * with the old tty driver. These ioctl definitions were previously
298 #include <sys/ttycom.h>
302 * END OF PROTECTED INCLUDE.
304 #endif /* !_SYS_TERMIOS_H_ */
306 #ifndef _POSIX_SOURCE
307 #include <sys/ttydefaults.h>