termios.h revision 8876
10SN/A/* 26073SN/A * Copyright (c) 1988, 1989, 1993, 1994 30SN/A * The Regents of the University of California. All rights reserved. 40SN/A * 50SN/A * Redistribution and use in source and binary forms, with or without 60SN/A * modification, are permitted provided that the following conditions 70SN/A * are met: 80SN/A * 1. Redistributions of source code must retain the above copyright 90SN/A * notice, this list of conditions and the following disclaimer. 100SN/A * 2. Redistributions in binary form must reproduce the above copyright 110SN/A * notice, this list of conditions and the following disclaimer in the 120SN/A * documentation and/or other materials provided with the distribution. 130SN/A * 3. All advertising materials mentioning features or use of this software 140SN/A * must display the following acknowledgement: 150SN/A * This product includes software developed by the University of 160SN/A * California, Berkeley and its contributors. 170SN/A * 4. Neither the name of the University nor the names of its contributors 180SN/A * may be used to endorse or promote products derived from this software 190SN/A * without specific prior written permission. 200SN/A * 210SN/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 220SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 230SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 240SN/A * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 250SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 260SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 270SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 280SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 290SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 300SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 310SN/A * SUCH DAMAGE. 320SN/A * 330SN/A * @(#)termios.h 8.3 (Berkeley) 3/28/94 340SN/A * $Id: termios.h,v 1.5 1995/05/11 07:52:47 bde Exp $ 350SN/A */ 360SN/A 370SN/A#ifndef _SYS_TERMIOS_H_ 380SN/A#define _SYS_TERMIOS_H_ 390SN/A 400SN/A/* 410SN/A * Special Control Characters 420SN/A * 430SN/A * Index into c_cc[] character array. 440SN/A * 450SN/A * Name Subscript Enabled by 460SN/A */ 470SN/A#define VEOF 0 /* ICANON */ 480SN/A#define VEOL 1 /* ICANON */ 490SN/A#ifndef _POSIX_SOURCE 500SN/A#define VEOL2 2 /* ICANON */ 510SN/A#endif 520SN/A#define VERASE 3 /* ICANON */ 530SN/A#ifndef _POSIX_SOURCE 540SN/A#define VWERASE 4 /* ICANON */ 550SN/A#endif 560SN/A#define VKILL 5 /* ICANON */ 570SN/A#ifndef _POSIX_SOURCE 580SN/A#define VREPRINT 6 /* ICANON */ 590SN/A#endif 600SN/A/* 7 spare 1 */ 610SN/A#define VINTR 8 /* ISIG */ 620SN/A#define VQUIT 9 /* ISIG */ 630SN/A#define VSUSP 10 /* ISIG */ 640SN/A#ifndef _POSIX_SOURCE 650SN/A#define VDSUSP 11 /* ISIG */ 660SN/A#endif 670SN/A#define VSTART 12 /* IXON, IXOFF */ 680SN/A#define VSTOP 13 /* IXON, IXOFF */ 690SN/A#ifndef _POSIX_SOURCE 700SN/A#define VLNEXT 14 /* IEXTEN */ 710SN/A#define VDISCARD 15 /* IEXTEN */ 720SN/A#endif 730SN/A#define VMIN 16 /* !ICANON */ 740SN/A#define VTIME 17 /* !ICANON */ 750SN/A#ifndef _POSIX_SOURCE 76936SN/A#define VSTATUS 18 /* ICANON */ 770SN/A/* 19 spare 2 */ 780SN/A#endif 790SN/A#define NCCS 20 800SN/A 810SN/A#define _POSIX_VDISABLE 0xff 820SN/A 830SN/A#ifndef _POSIX_SOURCE 84936SN/A#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0) 850SN/A#endif 860SN/A 87936SN/A/* 88936SN/A * Input flags - software input processing 89936SN/A */ 90936SN/A#define IGNBRK 0x00000001 /* ignore BREAK condition */ 910SN/A#define BRKINT 0x00000002 /* map BREAK to SIGINTR */ 920SN/A#define IGNPAR 0x00000004 /* ignore (discard) parity errors */ 93936SN/A#define PARMRK 0x00000008 /* mark parity and framing errors */ 94936SN/A#define INPCK 0x00000010 /* enable checking of parity errors */ 954660SN/A#define ISTRIP 0x00000020 /* strip 8th bit off chars */ 96936SN/A#define INLCR 0x00000040 /* map NL into CR */ 97936SN/A#define IGNCR 0x00000080 /* ignore CR */ 980SN/A#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ 990SN/A#define IXON 0x00000200 /* enable output flow control */ 100936SN/A#define IXOFF 0x00000400 /* enable input flow control */ 101936SN/A#ifndef _POSIX_SOURCE 102936SN/A#define IXANY 0x00000800 /* any char will restart after stop */ 1030SN/A#define IMAXBEL 0x00002000 /* ring bell on input queue full */ 1040SN/A#endif /*_POSIX_SOURCE */ 1050SN/A 1060SN/A/* 1070SN/A * Output flags - software output processing 1080SN/A */ 1090SN/A#define OPOST 0x00000001 /* enable following output processing */ 1100SN/A#ifndef _POSIX_SOURCE 1110SN/A#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ 1120SN/A#define OXTABS 0x00000004 /* expand tabs to spaces */ 1130SN/A#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ 1140SN/A#endif /*_POSIX_SOURCE */ 1150SN/A 1160SN/A/* 1170SN/A * Control flags - hardware control of terminal 1180SN/A */ 1190SN/A#ifndef _POSIX_SOURCE 1200SN/A#define CIGNORE 0x00000001 /* ignore control flags */ 1210SN/A#endif 1220SN/A#define CSIZE 0x00000300 /* character size mask */ 1230SN/A#define CS5 0x00000000 /* 5 bits (pseudo) */ 1240SN/A#define CS6 0x00000100 /* 6 bits */ 1250SN/A#define CS7 0x00000200 /* 7 bits */ 1260SN/A#define CS8 0x00000300 /* 8 bits */ 1270SN/A#define CSTOPB 0x00000400 /* send 2 stop bits */ 128936SN/A#define CREAD 0x00000800 /* enable receiver */ 1290SN/A#define PARENB 0x00001000 /* parity enable */ 1300SN/A#define PARODD 0x00002000 /* odd parity, else even */ 1310SN/A#define HUPCL 0x00004000 /* hang up on last close */ 1320SN/A#define CLOCAL 0x00008000 /* ignore modem status lines */ 1330SN/A#ifndef _POSIX_SOURCE 1340SN/A#define CCTS_OFLOW 0x00010000 /* CTS flow control of output */ 1350SN/A#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW) 136936SN/A#define CRTS_IFLOW 0x00020000 /* RTS flow control of input */ 1370SN/A#define CDTR_IFLOW 0x00040000 /* DTR flow control of input */ 1380SN/A#define CDSR_OFLOW 0x00080000 /* DSR flow control of output */ 139936SN/A#define CCAR_OFLOW 0x00100000 /* DCD flow control of output */ 140936SN/A#define MDMBUF 0x00100000 /* old name for CCAR_OFLOW */ 141936SN/A#endif 142936SN/A 1430SN/A 1440SN/A/* 145936SN/A * "Local" flags - dumping ground for other state 146936SN/A * 1474660SN/A * Warning: some flags in this structure begin with 148936SN/A * the letter "I" and look like they belong in the 149936SN/A * input flag. 1500SN/A */ 1510SN/A 152936SN/A#ifndef _POSIX_SOURCE 153936SN/A#define ECHOKE 0x00000001 /* visual erase for line kill */ 154936SN/A#endif /*_POSIX_SOURCE */ 155936SN/A#define ECHOE 0x00000002 /* visually erase chars */ 1560SN/A#define ECHOK 0x00000004 /* echo NL after line kill */ 1570SN/A#define ECHO 0x00000008 /* enable echoing */ 1580SN/A#define ECHONL 0x00000010 /* echo NL even if ECHO is off */ 1590SN/A#ifndef _POSIX_SOURCE 1600SN/A#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ 1610SN/A#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ 1620SN/A#endif /*_POSIX_SOURCE */ 1630SN/A#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ 1640SN/A#define ICANON 0x00000100 /* canonicalize input lines */ 1650SN/A#ifndef _POSIX_SOURCE 1660SN/A#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ 1670SN/A#endif /*_POSIX_SOURCE */ 1680SN/A#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */ 1690SN/A#define EXTPROC 0x00000800 /* external processing */ 1700SN/A#define TOSTOP 0x00400000 /* stop background jobs from output */ 1710SN/A#ifndef _POSIX_SOURCE 1720SN/A#define FLUSHO 0x00800000 /* output being flushed (state) */ 1730SN/A#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ 1740SN/A#define PENDIN 0x20000000 /* XXX retype pending input (state) */ 1750SN/A#endif /*_POSIX_SOURCE */ 1760SN/A#define NOFLSH 0x80000000 /* don't flush after interrupt */ 1770SN/A 1780SN/Atypedef unsigned long tcflag_t; 1790SN/Atypedef unsigned char cc_t; 180936SN/Atypedef long speed_t; /* XXX should be unsigned long */ 1810SN/A 1820SN/Astruct termios { 1830SN/A tcflag_t c_iflag; /* input flags */ 1840SN/A tcflag_t c_oflag; /* output flags */ 1850SN/A tcflag_t c_cflag; /* control flags */ 1860SN/A tcflag_t c_lflag; /* local flags */ 1870SN/A cc_t c_cc[NCCS]; /* control chars */ 188936SN/A speed_t c_ispeed; /* input speed */ 1890SN/A speed_t c_ospeed; /* output speed */ 1900SN/A}; 191936SN/A 192936SN/A/* 193936SN/A * Commands passed to tcsetattr() for setting the termios structure. 194936SN/A */ 1950SN/A#define TCSANOW 0 /* make change immediate */ 1960SN/A#define TCSADRAIN 1 /* drain output, then change */ 197936SN/A#define TCSAFLUSH 2 /* drain output, flush input */ 198936SN/A#ifndef _POSIX_SOURCE 1994660SN/A#define TCSASOFT 0x10 /* flag - don't alter h.w. state */ 200936SN/A#endif 201936SN/A 2020SN/A/* 2030SN/A * Standard speeds 204936SN/A */ 205936SN/A#define B0 0 206936SN/A#define B50 50 2070SN/A#define B75 75 2080SN/A#define B110 110 2090SN/A#define B134 134 2100SN/A#define B150 150 2110SN/A#define B200 200 2120SN/A#define B300 300 2130SN/A#define B600 600 2140SN/A#define B1200 1200 2150SN/A#define B1800 1800 2160SN/A#define B2400 2400 2170SN/A#define B4800 4800 2180SN/A#define B9600 9600 2190SN/A#define B19200 19200 2200SN/A#define B38400 38400 2210SN/A#ifndef _POSIX_SOURCE 2220SN/A#define B7200 7200 2230SN/A#define B14400 14400 2240SN/A#define B28800 28800 2250SN/A#define B57600 57600 2260SN/A#define B76800 76800 2270SN/A#define B115200 115200 2280SN/A#define B230400 230400 2290SN/A#define EXTA 19200 2300SN/A#define EXTB 38400 2310SN/A#endif /* !_POSIX_SOURCE */ 232936SN/A 2330SN/A#ifndef KERNEL 2340SN/A 2350SN/A#define TCIFLUSH 1 2360SN/A#define TCOFLUSH 2 2370SN/A#define TCIOFLUSH 3 2380SN/A#define TCOOFF 1 2390SN/A#define TCOON 2 240936SN/A#define TCIOFF 3 2410SN/A#define TCION 4 2420SN/A 243936SN/A#include <sys/cdefs.h> 244936SN/A 245936SN/A__BEGIN_DECLS 246936SN/Aspeed_t cfgetispeed __P((const struct termios *)); 2470SN/Aspeed_t cfgetospeed __P((const struct termios *)); 2480SN/Aint cfsetispeed __P((struct termios *, speed_t)); 249936SN/Aint cfsetospeed __P((struct termios *, speed_t)); 250936SN/Aint tcgetattr __P((int, struct termios *)); 2514660SN/Aint tcsetattr __P((int, int, const struct termios *)); 252936SN/Aint tcdrain __P((int)); 253936SN/Aint tcflow __P((int, int)); 2540SN/Aint tcflush __P((int, int)); 2550SN/Aint tcsendbreak __P((int, int)); 2560SN/A 257936SN/A#ifndef _POSIX_SOURCE 258936SN/Avoid cfmakeraw __P((struct termios *)); 259936SN/Aint cfsetspeed __P((struct termios *, speed_t)); 2600SN/A#endif /* !_POSIX_SOURCE */ 261936SN/A__END_DECLS 2620SN/A 2630SN/A#endif /* !KERNEL */ 2640SN/A 2650SN/A#ifndef _POSIX_SOURCE 2660SN/A 2670SN/A/* 2680SN/A * Include tty ioctl's that aren't just for backwards compatibility 2690SN/A * with the old tty driver. These ioctl definitions were previously 2700SN/A * in <sys/ioctl.h>. 2710SN/A */ 2720SN/A#include <sys/ttycom.h> 2730SN/A#endif 2740SN/A 2750SN/A/* 2760SN/A * END OF PROTECTED INCLUDE. 2770SN/A */ 2780SN/A#endif /* !_SYS_TERMIOS_H_ */ 2790SN/A 2800SN/A#ifndef _POSIX_SOURCE 2810SN/A#include <sys/ttydefaults.h> 2820SN/A#endif 2830SN/A