1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)termios.h 7.1 (Berkeley) 03/27/88 7 */ 8 9 /* 10 * posix termios structure 11 */ 12 #ifndef _TERMIOS_ 13 #define _TERMIOS_ 14 15 #ifdef KERNEL 16 #include "ioctl.h" 17 #else 18 #include <sys/ioctl.h> 19 #endif 20 21 22 /* 23 * Special Control Characters 24 * 25 * Index into c_cc[] character array. 26 * 27 * Name Subscript Enabled by 28 */ 29 #define VEOF 0 /* ICANON */ 30 #define VEOL 1 /* ICANON */ 31 #define VEOL2 2 /* ICANON */ 32 #define VERASE 3 /* ICANON */ 33 #define VWERASE 4 /* ICANON */ 34 #define VKILL 5 /* ICANON */ 35 #define VREPRINT 6 /* ICANON */ 36 #define VQUOTE 7 /* ICANON */ 37 #define VINTR 8 /* ISIG */ 38 #define VQUIT 9 /* ISIG */ 39 #define VSUSP 10 /* ISIG */ 40 #define VDSUSP 11 /* ISIG */ 41 #define VSTART 12 /* IXON, IXOFF */ 42 #define VSTOP 13 /* IXON, IXOFF */ 43 #define VLNEXT 14 /* IEXTEN */ 44 #define VFLUSHO 15 /* IEXTEN */ 45 #define VFLUSH VFLUSHO /* for sun */ 46 #define VMIN 16 /* !ICANON */ 47 #define VTIME 17 /* !ICANON */ 48 49 #define NCC 20 /* two spares */ 50 51 #define POSIX_V_DISABLE ((unsigned char)'\377') 52 #define _POSIX_V_DISABLE POSIX_V_DISABLE 53 54 /* 55 * Input flags - software input processing 56 */ 57 #define IGNBRK 0x00000001 /* ignore BREAK condition */ 58 #define BRKINT 0x00000002 /* map BREAK to SIGINTR */ 59 #define IGNPAR 0x00000004 /* ignore (throw out) parity errors */ 60 #define PARMRK 0x00000008 /* mark parity and framing errors */ 61 #define INPCK 0x00000010 /* disable checking of parity errors */ 62 #define ISTRIP 0x00000020 /* strip 8th bit off chars */ 63 #define INLCR 0x00000040 /* map NL into CR */ 64 #define IGNCR 0x00000080 /* ignore CR */ 65 #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ 66 #define IXON 0x00000200 /* enable output flow control */ 67 #define IFLOW IXON /* "" */ 68 #define IXOFF 0x00000400 /* enable input flow control */ 69 #define ITANDEM IXOFF /* "" */ 70 #define IXANY 0x00000800 /* any char will restart after stop */ 71 #define IEXTEN 0x00001000 /* enable FLUSHO and LNEXT */ 72 #define IMAXBEL 0x00002000 /* ring bell on input queue full */ 73 74 /* 75 * Output flags - software output processing 76 */ 77 #define OPOST 0x00000001 /* enable output processing */ 78 #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ 79 #define OXTABS 0x00000004 /* expand tabs to spaces */ 80 81 /* 82 * Control flags - hardware control of terminal 83 */ 84 #define CSIZE 0x00000300 /* character size mask */ 85 #define CS5 0x00000000 /* 5 bits - pseudo */ 86 #define CS6 0x00000100 /* 6 bits */ 87 #define CS7 0x00000200 /* 7 bits */ 88 #define CS8 0x00000300 /* 8 bits */ 89 #define CSTOPB 0x00000400 /* send 2 stop bits */ 90 #define CREAD 0x00000800 /* enable receiver */ 91 #define PARENB 0x00001000 /* parity enable */ 92 #define PARODD 0x00002000 /* odd parity, else even */ 93 #define HUPCL 0x00004000 /* hang up on last close */ 94 #define CLOCAL 0x00008000 /* ignore mode status lines */ 95 #define CRTSCTS 0x00010000 /* RTS/CTS flow control */ 96 97 98 /* 99 * "Local" flags - dumping ground for other state 100 * 101 * Note presence of ISIG and ICANON. Its not *our* fault. 102 */ 103 104 #define ECHO 0x00000001 /* enable echoing */ 105 #define ECHOE 0x00000002 /* visually erase chars */ 106 #define ECHOK 0x00000004 /* echo NL after line kill */ 107 #define ECHOKE 0x00000008 /* visual erase for line kill */ 108 #define ECHONL 0x00000010 /* echo NL even if ECHO is off */ 109 #define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ 110 #define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ 111 #define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ 112 #define ICANON 0x00000100 /* canonicalize input lines */ 113 #define NOFLSH 0x00000200 /* don't flush after interrupt */ 114 #define TOSTOP 0x00000400 /* stop background jobs from output */ 115 #define MDMBUF 0x00000800 /* flow control output via Carrier */ 116 #define NOHANG 0x00001000 /* XXX this should go away */ 117 #define FLUSHO 0x00002000 /* output being flushed (state) */ 118 #define PENDIN 0x00004000 /* retype pending input (state) */ 119 120 struct termios { 121 unsigned long c_iflag; /* input flags */ 122 unsigned long c_oflag; /* output flags */ 123 unsigned long c_cflag; /* control flags */ 124 unsigned long c_lflag; /* local flags */ 125 unsigned char c_cc[NCC]; /* control chars */ 126 long c_ispeed; /* input speed */ 127 long c_ospeed; /* output speed */ 128 }; 129 130 /* 131 * Flags to tcsetattr(), for setting the termios structure. 132 * 133 * If TCSASOFT is or'ed in with one of the first three, then 134 * only the software processing flags in the termios structure 135 * are set. That is, the settings of the cflag and speeds 136 * are ignored. 137 */ 138 #define TCSANOW 0 /* make change immediate */ 139 #define TCSADRAIN 1 /* drain output, then change */ 140 #define TCSADFLUSH 2 /* drain output, flush input */ 141 #define TCSASOFT 0x80000000 /* but ignore hardware settings */ 142 143 /* 144 * Is c equal to control character val? XXX - should reverse val and c 145 */ 146 #define CCEQ(val, c) (c == val ? val != POSIX_V_DISABLE : 0) 147 148 #endif _TERMIOS_ 149