1139825Simp/*- 21541Srgrimes * Copyright (c) 1988, 1989, 1993, 1994 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 4. Neither the name of the University nor the names of its contributors 141541Srgrimes * may be used to endorse or promote products derived from this software 151541Srgrimes * without specific prior written permission. 161541Srgrimes * 171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271541Srgrimes * SUCH DAMAGE. 281541Srgrimes * 291541Srgrimes * @(#)termios.h 8.3 (Berkeley) 3/28/94 3050477Speter * $FreeBSD$ 311541Srgrimes */ 321541Srgrimes 33199898Sed#ifndef _SYS__TERMIOS_H_ 34199898Sed#define _SYS__TERMIOS_H_ 351541Srgrimes 368876Srgrimes/* 378876Srgrimes * Special Control Characters 381541Srgrimes * 391541Srgrimes * Index into c_cc[] character array. 401541Srgrimes * 418876Srgrimes * Name Subscript Enabled by 421541Srgrimes */ 431541Srgrimes#define VEOF 0 /* ICANON */ 441541Srgrimes#define VEOL 1 /* ICANON */ 451541Srgrimes#ifndef _POSIX_SOURCE 4620020Sbde#define VEOL2 2 /* ICANON together with IEXTEN */ 471541Srgrimes#endif 481541Srgrimes#define VERASE 3 /* ICANON */ 491541Srgrimes#ifndef _POSIX_SOURCE 50182817Sed#define VWERASE 4 /* ICANON together with IEXTEN */ 518876Srgrimes#endif 52182817Sed#define VKILL 5 /* ICANON */ 531541Srgrimes#ifndef _POSIX_SOURCE 5420020Sbde#define VREPRINT 6 /* ICANON together with IEXTEN */ 55182817Sed#define VERASE2 7 /* ICANON */ 561541Srgrimes#endif 5769322Sjkh/* 7 ex-spare 1 */ 58182817Sed#define VINTR 8 /* ISIG */ 59182817Sed#define VQUIT 9 /* ISIG */ 60182817Sed#define VSUSP 10 /* ISIG */ 611541Srgrimes#ifndef _POSIX_SOURCE 62182817Sed#define VDSUSP 11 /* ISIG together with IEXTEN */ 631541Srgrimes#endif 64182817Sed#define VSTART 12 /* IXON, IXOFF */ 65182817Sed#define VSTOP 13 /* IXON, IXOFF */ 661541Srgrimes#ifndef _POSIX_SOURCE 671541Srgrimes#define VLNEXT 14 /* IEXTEN */ 681541Srgrimes#define VDISCARD 15 /* IEXTEN */ 691541Srgrimes#endif 70182817Sed#define VMIN 16 /* !ICANON */ 71182817Sed#define VTIME 17 /* !ICANON */ 721541Srgrimes#ifndef _POSIX_SOURCE 73182817Sed#define VSTATUS 18 /* ICANON together with IEXTEN */ 741541Srgrimes/* 19 spare 2 */ 751541Srgrimes#endif 761541Srgrimes#define NCCS 20 771541Srgrimes 788449Sbde#define _POSIX_VDISABLE 0xff 791541Srgrimes 801541Srgrimes/* 811541Srgrimes * Input flags - software input processing 821541Srgrimes */ 831541Srgrimes#define IGNBRK 0x00000001 /* ignore BREAK condition */ 841541Srgrimes#define BRKINT 0x00000002 /* map BREAK to SIGINTR */ 851541Srgrimes#define IGNPAR 0x00000004 /* ignore (discard) parity errors */ 861541Srgrimes#define PARMRK 0x00000008 /* mark parity and framing errors */ 871541Srgrimes#define INPCK 0x00000010 /* enable checking of parity errors */ 881541Srgrimes#define ISTRIP 0x00000020 /* strip 8th bit off chars */ 891541Srgrimes#define INLCR 0x00000040 /* map NL into CR */ 901541Srgrimes#define IGNCR 0x00000080 /* ignore CR */ 911541Srgrimes#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ 921541Srgrimes#define IXON 0x00000200 /* enable output flow control */ 931541Srgrimes#define IXOFF 0x00000400 /* enable input flow control */ 941541Srgrimes#ifndef _POSIX_SOURCE 951541Srgrimes#define IXANY 0x00000800 /* any char will restart after stop */ 96182817Sed#define IMAXBEL 0x00002000 /* ring bell on input queue full */ 971541Srgrimes#endif /*_POSIX_SOURCE */ 981541Srgrimes 991541Srgrimes/* 1001541Srgrimes * Output flags - software output processing 1011541Srgrimes */ 1021541Srgrimes#define OPOST 0x00000001 /* enable following output processing */ 1031541Srgrimes#ifndef _POSIX_SOURCE 104182817Sed#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ 105181905Sed#define TABDLY 0x00000004 /* tab delay mask */ 106181905Sed#define TAB0 0x00000000 /* no tab delay and expansion */ 107181905Sed#define TAB3 0x00000004 /* expand tabs to spaces */ 108182817Sed#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ 109182817Sed#define OCRNL 0x00000010 /* map CR to NL on output */ 110182817Sed#define ONOCR 0x00000020 /* no CR output at column 0 */ 111182817Sed#define ONLRET 0x00000040 /* NL performs CR function */ 1121541Srgrimes#endif /*_POSIX_SOURCE */ 1131541Srgrimes 1141541Srgrimes/* 1151541Srgrimes * Control flags - hardware control of terminal 1161541Srgrimes */ 1171541Srgrimes#ifndef _POSIX_SOURCE 1181541Srgrimes#define CIGNORE 0x00000001 /* ignore control flags */ 1191541Srgrimes#endif 120182817Sed#define CSIZE 0x00000300 /* character size mask */ 121182817Sed#define CS5 0x00000000 /* 5 bits (pseudo) */ 122182817Sed#define CS6 0x00000100 /* 6 bits */ 123182817Sed#define CS7 0x00000200 /* 7 bits */ 124182817Sed#define CS8 0x00000300 /* 8 bits */ 125182817Sed#define CSTOPB 0x00000400 /* send 2 stop bits */ 126182817Sed#define CREAD 0x00000800 /* enable receiver */ 127182817Sed#define PARENB 0x00001000 /* parity enable */ 128182817Sed#define PARODD 0x00002000 /* odd parity, else even */ 129182817Sed#define HUPCL 0x00004000 /* hang up on last close */ 130182817Sed#define CLOCAL 0x00008000 /* ignore modem status lines */ 1311541Srgrimes#ifndef _POSIX_SOURCE 132182817Sed#define CCTS_OFLOW 0x00010000 /* CTS flow control of output */ 133182817Sed#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW) 134182817Sed#define CRTS_IFLOW 0x00020000 /* RTS flow control of input */ 1358187Sbde#define CDTR_IFLOW 0x00040000 /* DTR flow control of input */ 136182817Sed#define CDSR_OFLOW 0x00080000 /* DSR flow control of output */ 1378187Sbde#define CCAR_OFLOW 0x00100000 /* DCD flow control of output */ 1381541Srgrimes#endif 1391541Srgrimes 1401541Srgrimes 1418876Srgrimes/* 1421541Srgrimes * "Local" flags - dumping ground for other state 1431541Srgrimes * 1441541Srgrimes * Warning: some flags in this structure begin with 1451541Srgrimes * the letter "I" and look like they belong in the 1461541Srgrimes * input flag. 1471541Srgrimes */ 1481541Srgrimes 1491541Srgrimes#ifndef _POSIX_SOURCE 1501541Srgrimes#define ECHOKE 0x00000001 /* visual erase for line kill */ 1511541Srgrimes#endif /*_POSIX_SOURCE */ 1521541Srgrimes#define ECHOE 0x00000002 /* visually erase chars */ 1531541Srgrimes#define ECHOK 0x00000004 /* echo NL after line kill */ 154182817Sed#define ECHO 0x00000008 /* enable echoing */ 1551541Srgrimes#define ECHONL 0x00000010 /* echo NL even if ECHO is off */ 1561541Srgrimes#ifndef _POSIX_SOURCE 1571541Srgrimes#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ 158182817Sed#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ 1591541Srgrimes#endif /*_POSIX_SOURCE */ 1601541Srgrimes#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ 1611541Srgrimes#define ICANON 0x00000100 /* canonicalize input lines */ 1621541Srgrimes#ifndef _POSIX_SOURCE 163182817Sed#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ 1641541Srgrimes#endif /*_POSIX_SOURCE */ 1651541Srgrimes#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */ 166182817Sed#define EXTPROC 0x00000800 /* external processing */ 167182817Sed#define TOSTOP 0x00400000 /* stop background jobs from output */ 1681541Srgrimes#ifndef _POSIX_SOURCE 169182817Sed#define FLUSHO 0x00800000 /* output being flushed (state) */ 1701541Srgrimes#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ 171182817Sed#define PENDIN 0x20000000 /* XXX retype pending input (state) */ 1721541Srgrimes#endif /*_POSIX_SOURCE */ 1731541Srgrimes#define NOFLSH 0x80000000 /* don't flush after interrupt */ 1741541Srgrimes 1758876Srgrimes/* 1761541Srgrimes * Standard speeds 1771541Srgrimes */ 178182817Sed#define B0 0 179182817Sed#define B50 50 180182817Sed#define B75 75 181182817Sed#define B110 110 182182817Sed#define B134 134 183182817Sed#define B150 150 184182817Sed#define B200 200 185182817Sed#define B300 300 186182817Sed#define B600 600 187182817Sed#define B1200 1200 1881541Srgrimes#define B1800 1800 189182817Sed#define B2400 2400 190182817Sed#define B4800 4800 191182817Sed#define B9600 9600 192182817Sed#define B19200 19200 193182817Sed#define B38400 38400 1941541Srgrimes#ifndef _POSIX_SOURCE 195182817Sed#define B7200 7200 196182817Sed#define B14400 14400 197182817Sed#define B28800 28800 198182817Sed#define B57600 57600 199182817Sed#define B76800 76800 200182817Sed#define B115200 115200 201182817Sed#define B230400 230400 202182817Sed#define B460800 460800 203182817Sed#define B921600 921600 204182817Sed#define EXTA 19200 205182817Sed#define EXTB 38400 2061541Srgrimes#endif /* !_POSIX_SOURCE */ 2071541Srgrimes 208199898Sedtypedef unsigned int tcflag_t; 209199898Sedtypedef unsigned char cc_t; 210199898Sedtypedef unsigned int speed_t; 2111541Srgrimes 212199898Sedstruct termios { 213199898Sed tcflag_t c_iflag; /* input flags */ 214199898Sed tcflag_t c_oflag; /* output flags */ 215199898Sed tcflag_t c_cflag; /* control flags */ 216199898Sed tcflag_t c_lflag; /* local flags */ 217199898Sed cc_t c_cc[NCCS]; /* control chars */ 218199898Sed speed_t c_ispeed; /* input speed */ 219199898Sed speed_t c_ospeed; /* output speed */ 220199898Sed}; 221181905Sed 222199898Sed#endif /* !_SYS__TERMIOS_H_ */ 223