]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/sys/termios.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / Include / sys / termios.h
CommitLineData
2aa62f2b 1/* $NetBSD: termios.h,v 1.29 2005/12/11 12:25:21 christos Exp $ */\r
2\r
3/*\r
4 * Copyright (c) 1988, 1989, 1993, 1994\r
5 * The Regents of the University of California. All rights reserved.\r
6 *\r
7 * Redistribution and use in source and binary forms, with or without\r
8 * modification, are permitted provided that the following conditions\r
9 * are met:\r
10 * 1. Redistributions of source code must retain the above copyright\r
11 * notice, this list of conditions and the following disclaimer.\r
12 * 2. Redistributions in binary form must reproduce the above copyright\r
13 * notice, this list of conditions and the following disclaimer in the\r
14 * documentation and/or other materials provided with the distribution.\r
15 * 3. Neither the name of the University nor the names of its contributors\r
16 * may be used to endorse or promote products derived from this software\r
17 * without specific prior written permission.\r
18 *\r
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
29 * SUCH DAMAGE.\r
30 *\r
31 * @(#)termios.h 8.3 (Berkeley) 3/28/94\r
32 */\r
33\r
34#ifndef _SYS_TERMIOS_H_\r
35#define _SYS_TERMIOS_H_\r
36\r
37#include <sys/ansi.h>\r
38#include <sys/featuretest.h>\r
39\r
40/*\r
41 * Special Control Characters\r
42 *\r
43 * Index into c_cc[] character array.\r
44 *\r
45 * Name Subscript Enabled by\r
46 */\r
47#define VEOF 0 /* ICANON */\r
48#define VEOL 1 /* ICANON */\r
49#if defined(_NETBSD_SOURCE)\r
50#define VEOL2 2 /* ICANON */\r
51#endif\r
52#define VERASE 3 /* ICANON */\r
53#if defined(_NETBSD_SOURCE)\r
54#define VWERASE 4 /* ICANON */\r
55#endif\r
56#define VKILL 5 /* ICANON */\r
57#if defined(_NETBSD_SOURCE)\r
58#define VREPRINT 6 /* ICANON */\r
59#endif\r
60/* 7 spare 1 */\r
61#define VINTR 8 /* ISIG */\r
62#define VQUIT 9 /* ISIG */\r
63#define VSUSP 10 /* ISIG */\r
64#if defined(_NETBSD_SOURCE)\r
65#define VDSUSP 11 /* ISIG */\r
66#endif\r
67#define VSTART 12 /* IXON, IXOFF */\r
68#define VSTOP 13 /* IXON, IXOFF */\r
69#if defined(_NETBSD_SOURCE)\r
70#define VLNEXT 14 /* IEXTEN */\r
71#define VDISCARD 15 /* IEXTEN */\r
72#endif\r
73#define VMIN 16 /* !ICANON */\r
74#define VTIME 17 /* !ICANON */\r
75#if defined(_NETBSD_SOURCE)\r
76#define VSTATUS 18 /* ICANON */\r
77/* 19 spare 2 */\r
78#endif\r
79#define NCCS 20\r
80\r
81#define _POSIX_VDISABLE ((unsigned char)'\377')\r
82\r
83#if defined(_NETBSD_SOURCE)\r
84#define CCEQ(val, c) (c == val ? val != _POSIX_VDISABLE : 0)\r
85#endif\r
86\r
87/*\r
88 * Input flags - software input processing\r
89 */\r
90#define IGNBRK 0x00000001 /* ignore BREAK condition */\r
91#define BRKINT 0x00000002 /* map BREAK to SIGINTR */\r
92#define IGNPAR 0x00000004 /* ignore (discard) parity errors */\r
93#define PARMRK 0x00000008 /* mark parity and framing errors */\r
94#define INPCK 0x00000010 /* enable checking of parity errors */\r
95#define ISTRIP 0x00000020 /* strip 8th bit off chars */\r
96#define INLCR 0x00000040 /* map NL into CR */\r
97#define IGNCR 0x00000080 /* ignore CR */\r
98#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */\r
99#define IXON 0x00000200 /* enable output flow control */\r
100#define IXOFF 0x00000400 /* enable input flow control */\r
101#if defined(_NETBSD_SOURCE)\r
102#define IXANY 0x00000800 /* any char will restart after stop */\r
103#endif\r
104#if defined(_NETBSD_SOURCE)\r
105#define IMAXBEL 0x00002000 /* ring bell on input queue full */\r
106#endif\r
107\r
108/*\r
109 * Output flags - software output processing\r
110 */\r
111#define OPOST 0x00000001 /* enable following output processing */\r
112#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
113#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */\r
114#endif\r
115#if defined(_NETBSD_SOURCE)\r
116#define OXTABS 0x00000004 /* expand tabs to spaces */\r
117#define ONOEOT 0x00000008 /* discard EOT's (^D) on output */\r
118#endif\r
119#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
120#define OCRNL 0x00000010 /* map CR to NL */\r
121#define ONOCR 0x00000020 /* discard CR's when on column 0 */\r
122#define ONLRET 0x00000040 /* move to column 0 on CR */\r
123#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */\r
124\r
125/*\r
126 * Control flags - hardware control of terminal\r
127 */\r
128#if defined(_NETBSD_SOURCE)\r
129#define CIGNORE 0x00000001 /* ignore control flags */\r
130#endif\r
131#define CSIZE 0x00000300 /* character size mask */\r
132#define CS5 0x00000000 /* 5 bits (pseudo) */\r
133#define CS6 0x00000100 /* 6 bits */\r
134#define CS7 0x00000200 /* 7 bits */\r
135#define CS8 0x00000300 /* 8 bits */\r
136#define CSTOPB 0x00000400 /* send 2 stop bits */\r
137#define CREAD 0x00000800 /* enable receiver */\r
138#define PARENB 0x00001000 /* parity enable */\r
139#define PARODD 0x00002000 /* odd parity, else even */\r
140#define HUPCL 0x00004000 /* hang up on last close */\r
141#define CLOCAL 0x00008000 /* ignore modem status lines */\r
142#if defined(_NETBSD_SOURCE)\r
143#define CRTSCTS 0x00010000 /* RTS/CTS full-duplex flow control */\r
144#define CRTS_IFLOW CRTSCTS /* XXX compat */\r
145#define CCTS_OFLOW CRTSCTS /* XXX compat */\r
146#define CDTRCTS 0x00020000 /* DTR/CTS full-duplex flow control */\r
147#define MDMBUF 0x00100000 /* DTR/DCD hardware flow control */\r
148#define CHWFLOW (MDMBUF|CRTSCTS|CDTRCTS) /* all types of hw flow control */\r
149#endif\r
150\r
151\r
152/*\r
153 * "Local" flags - dumping ground for other state\r
154 *\r
155 * Warning: some flags in this structure begin with\r
156 * the letter "I" and look like they belong in the\r
157 * input flag.\r
158 */\r
159\r
160#if defined(_NETBSD_SOURCE)\r
161#define ECHOKE 0x00000001 /* visual erase for line kill */\r
162#endif\r
163#define ECHOE 0x00000002 /* visually erase chars */\r
164#define ECHOK 0x00000004 /* echo NL after line kill */\r
165#define ECHO 0x00000008 /* enable echoing */\r
166#define ECHONL 0x00000010 /* echo NL even if ECHO is off */\r
167#if defined(_NETBSD_SOURCE)\r
168#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */\r
169#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */\r
170#endif /* defined(_NETBSD_SOURCE) */\r
171#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */\r
172#define ICANON 0x00000100 /* canonicalize input lines */\r
173#if defined(_NETBSD_SOURCE)\r
174#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */\r
175#endif /* defined(_NETBSD_SOURCE) */\r
176#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */\r
177#if defined(_NETBSD_SOURCE)\r
178#define EXTPROC 0x00000800 /* external processing */\r
179#endif /* defined(_NETBSD_SOURCE) */\r
180#define TOSTOP 0x00400000 /* stop background jobs on output */\r
181#if defined(_NETBSD_SOURCE)\r
182#define FLUSHO 0x00800000 /* output being flushed (state) */\r
183#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */\r
184#define PENDIN 0x20000000 /* re-echo input buffer at next read */\r
185#endif /* defined(_NETBSD_SOURCE) */\r
186#define NOFLSH 0x80000000 /* don't flush output on signal */\r
187\r
188typedef unsigned int tcflag_t;\r
189typedef unsigned char cc_t;\r
190typedef unsigned int speed_t;\r
191\r
192struct termios {\r
193 tcflag_t c_iflag; /* input flags */\r
194 tcflag_t c_oflag; /* output flags */\r
195 tcflag_t c_cflag; /* control flags */\r
196 tcflag_t c_lflag; /* local flags */\r
197 cc_t c_cc[NCCS]; /* control chars */\r
198 int c_ispeed; /* input speed */\r
199 int c_ospeed; /* output speed */\r
200};\r
201\r
202/*\r
203 * Commands passed to tcsetattr() for setting the termios structure.\r
204 */\r
205#define TCSANOW 0 /* make change immediate */\r
206#define TCSADRAIN 1 /* drain output, then change */\r
207#define TCSAFLUSH 2 /* drain output, flush input */\r
208#if defined(_NETBSD_SOURCE)\r
209#define TCSASOFT 0x10 /* flag - don't alter h.w. state */\r
210#endif\r
211\r
212/*\r
213 * Standard speeds\r
214 */\r
215#define B0 0\r
216#define B50 50\r
217#define B75 75\r
218#define B110 110\r
219#define B134 134\r
220#define B150 150\r
221#define B200 200\r
222#define B300 300\r
223#define B600 600\r
224#define B1200 1200\r
225#define B1800 1800\r
226#define B2400 2400\r
227#define B4800 4800\r
228#define B9600 9600\r
229#define B19200 19200\r
230#define B38400 38400\r
231#if defined(_NETBSD_SOURCE)\r
232#define B7200 7200\r
233#define B14400 14400\r
234#define B28800 28800\r
235#define B57600 57600\r
236#define B76800 76800\r
237#define B115200 115200\r
238#define B230400 230400\r
239#define B460800 460800\r
240#define B921600 921600\r
241#define EXTA 19200\r
242#define EXTB 38400\r
243#endif /* defined(_NETBSD_SOURCE) */\r
244\r
245#ifndef _KERNEL\r
246\r
247#define TCIFLUSH 1\r
248#define TCOFLUSH 2\r
249#define TCIOFLUSH 3\r
250#define TCOOFF 1\r
251#define TCOON 2\r
252#define TCIOFF 3\r
253#define TCION 4\r
254\r
255#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
256#ifndef pid_t\r
257typedef __pid_t pid_t;\r
258#define pid_t __pid_t\r
259#endif\r
260#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */\r
261#include <sys/EfiCdefs.h>\r
262\r
263__BEGIN_DECLS\r
264speed_t cfgetispeed(const struct termios *);\r
265speed_t cfgetospeed(const struct termios *);\r
266int cfsetispeed(struct termios *, speed_t);\r
267int cfsetospeed(struct termios *, speed_t);\r
268int tcgetattr(int, struct termios *);\r
269int tcsetattr(int, int, const struct termios *);\r
270int tcdrain(int);\r
271int tcflow(int, int);\r
272int tcflush(int, int);\r
273int tcsendbreak(int, int);\r
274#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)\r
275pid_t tcgetsid(int);\r
276#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */\r
277\r
278\r
279#if defined(_NETBSD_SOURCE)\r
280void cfmakeraw(struct termios *);\r
281int cfsetspeed(struct termios *, speed_t);\r
282#endif /* defined(_NETBSD_SOURCE) */\r
283__END_DECLS\r
284\r
285#endif /* !_KERNEL */\r
286\r
287#if defined(_NETBSD_SOURCE)\r
288\r
289/*\r
290 * Include tty ioctl's that aren't just for backwards compatibility\r
291 * with the old tty driver. These ioctl definitions were previously\r
292 * in <sys/ioctl.h>.\r
293 */\r
294//#include <sys/ttycom.h>\r
295#endif\r
296\r
297/*\r
298 * END OF PROTECTED INCLUDE.\r
299 */\r
300#endif /* !_SYS_TERMIOS_H_ */\r
301\r
302#if defined(_NETBSD_SOURCE)\r
303//#include <sys/ttydefaults.h>\r
304#endif\r