4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef __SYS_TERMIOS_H
28 #define __SYS_TERMIOS_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/stdtypes.h>
33 #include <sys/ioccom.h>
34 #include <sys/ttydev.h>
35 #include <sys/ttycom.h>
45 * the following are not (yet) posix
46 * VEOL2, VSWTCH, VDSUSP, VREPRINT, VDISCARD, VWERASE, VLNEXT, VSTATUS
74 #define _CTRL(c) ('c'&037)
77 * default control chars.
78 * guarded for ttychars.h.
81 #define CINTR _CTRL(c)
82 #define CQUIT 034 /* FS, ^\ */
83 #define CERASE 0177 /* DEL, ^? */
84 #define CKILL _CTRL(u)
91 #define CSTART _CTRL(q)
92 #define CSTOP _CTRL(s)
93 #define CSUSP _CTRL(z)
94 #define CDSUSP _CTRL(y)
95 #define CRPRNT _CTRL(r)
96 #define CFLUSH _CTRL(o)
97 #define CWERASE _CTRL(w)
98 #define CLNEXT _CTRL(v)
104 #endif /* !_POSIX_SOURCE */
107 #define IGNBRK 0x00000001
108 #define BRKINT 0x00000002
109 #define IGNPAR 0x00000004
110 #define PARMRK 0x00000008
111 #define INPCK 0x00000010
112 #define ISTRIP 0x00000020
113 #define INLCR 0x00000040
114 #define IGNCR 0x00000080
115 #define ICRNL 0x00000100
116 /* IUCLC 0x00000200 not posix, defined below */
117 #define IXON 0x00000400
118 /* IXANY 0x00000800 not posix, defined below */
119 #define IXOFF 0x00001000
120 /* IMAXBEL 0x00002000 not posix, defined below */
122 #ifndef _POSIX_SOURCE
123 #define IUCLC 0x00000200
124 #define IXANY 0x00000800
125 #define IMAXBEL 0x00002000
126 #endif /* !_POSIX_SOURCE */
129 #define OPOST 0x00000001
130 #ifndef _POSIX_SOURCE
131 #define OLCUC 0x00000002
132 #define ONLCR 0x00000004
133 #define OCRNL 0x00000008
134 #define ONOCR 0x00000010
135 #define ONLRET 0x00000020
136 #define OFILL 0x00000040
137 #define OFDEL 0x00000080
138 #define NLDLY 0x00000100
140 #define NL1 0x00000100
141 #define CRDLY 0x00000600
143 #define CR1 0x00000200
144 #define CR2 0x00000400
145 #define CR3 0x00000600
146 #define TABDLY 0x00001800
148 #define TAB1 0x00000800
149 #define TAB2 0x00001000
150 #define XTABS 0x00001800
152 #define BSDLY 0x00002000
154 #define BS1 0x00002000
155 #define VTDLY 0x00004000
157 #define VT1 0x00004000
158 #define FFDLY 0x00008000
160 #define FF1 0x00008000
161 #define PAGEOUT 0x00010000
162 #define WRAP 0x00020000
163 #endif /* !_POSIX_SOURCE */
166 #ifndef _POSIX_SOURCE
167 #define CBAUD 0x0000000f
169 #define CSIZE 0x00000030
171 #define CS6 0x00000010
172 #define CS7 0x00000020
173 #define CS8 0x00000030
174 #define CSTOPB 0x00000040
175 #define CREAD 0x00000080
176 #define PARENB 0x00000100
177 #define PARODD 0x00000200
178 #define HUPCL 0x00000400
179 #define CLOCAL 0x00000800
180 #ifndef _POSIX_SOURCE
181 #define LOBLK 0x00001000
182 #define CIBAUD 0x000f0000
183 #define CRTSXOFF 0x40000000
184 #define CRTSCTS 0x80000000
185 #define CBAUDEXT 0x200000
186 #define CIBAUDEXT 0x400000
189 * 4.4BSD flags for hardware flow control
191 #define CRTS_IFLOW 0x40000000
192 #define CCTS_OFLOW 0x80000000
195 #endif /* !_POSIX_SOURCE */
197 /* line discipline 0 modes */
198 #define ISIG 0x00000001
199 #define ICANON 0x00000002
200 /* XCASE 0x00000004 not posix, defined below */
201 #define ECHO 0x00000008
202 #define ECHOE 0x00000010
203 #define ECHOK 0x00000020
204 #define ECHONL 0x00000040
205 #define NOFLSH 0x00000080
206 #define TOSTOP 0x00000100
207 /* ECHOCTL 0x00000200 not posix, defined below */
208 /* ECHOPRT 0x00000400 not posix, defined below */
209 /* ECHOKE 0x00000800 not posix, defined below */
210 /* DEFECHO 0x00001000 not posix, defined below */
211 /* FLUSHO 0x00002000 not posix, defined below */
212 /* PENDIN 0x00004000 not posix, defined below */
213 #define IEXTEN 0x00008000
215 #ifndef _POSIX_SOURCE
216 #define XCASE 0x00000004
217 #define ECHOCTL 0x00000200
218 #define ECHOPRT 0x00000400
219 #define ECHOKE 0x00000800
220 #define DEFECHO 0x00001000
221 #define FLUSHO 0x00002000
222 #define PENDIN 0x00004000
223 #endif /* !_POSIX_SOURCE */
225 #ifndef _POSIX_SOURCE
227 * codes 1 through 5, not shown here, are old "termio" calls
229 #define TCXONC _IO('T', 6)
230 #define TCFLSH _IO('T', 7)
231 #define TCGETS _IOR('T', 8, struct termios)
232 #define TCSETS _IOW('T', 9, struct termios)
233 #define TCSETSW _IOW('T', 10, struct termios)
234 #define TCSETSF _IOW('T', 11, struct termios)
235 #endif /* !_POSIX_SOURCE */
237 #define TCOOFF 0 /* arg to TCXONC & tcflow() */
238 #define TCOON 1 /* arg to TCXONC & tcflow() */
239 #define TCIOFF 2 /* arg to TCXONC & tcflow() */
240 #define TCION 3 /* arg to TCXONC & tcflow() */
241 #define TCIFLUSH 0 /* arg to TCFLSH & tcflush() */
242 #define TCOFLUSH 1 /* arg to TCFLSH & tcflush() */
243 #define TCIOFLUSH 2 /* arg to TCFLSH & tcflush() */
244 #define TCSANOW 0 /* arg to tcsetattr() */
245 #define TCSADRAIN 1 /* arg to tcsetattr() */
246 #define TCSAFLUSH 2 /* arg to tcsetattr() */
249 * Ioctl control packet
252 tcflag_t c_iflag
; /* input modes */
253 tcflag_t c_oflag
; /* output modes */
254 tcflag_t c_cflag
; /* control modes */
255 tcflag_t c_lflag
; /* line discipline modes */
256 char c_line
; /* line discipline XXX */
257 cc_t c_cc
[NCCS
]; /* control chars */
262 speed_t
cfgetispeed(/* struct termios *termios_p */);
263 speed_t
cfgetospeed(/* struct termios *termios_p */);
264 int cfsetispeed(/* struct termios *termios_p, speed_t speed */);
265 int cfsetospeed(/* struct termios *termios_p, speed_t speed */);
266 int tcdrain(/* int fildes */);
267 int tcflow(/* int fildes, int action */);
268 int tcflush(/* int fildes, int queue_selector */);
269 int tcgetattr(/* int fildes, struct termios *termios_p */);
270 int tcsendbreak(/* int fildes, int duration */);
271 int tcsetattr(/* int fildes, int optional_actions, struct *termios_p */);
278 #endif /* __SYS_TERMIOS_H */