| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 | /* |
| 3 | * This file is subject to the terms and conditions of the GNU General Public |
| 4 | * License. See the file "COPYING" in the main directory of this archive |
| 5 | * for more details. |
| 6 | * |
| 7 | * Copyright (C) 1995, 96, 99, 2001, 06 Ralf Baechle |
| 8 | * Copyright (C) 1999 Silicon Graphics, Inc. |
| 9 | * Copyright (C) 2001 MIPS Technologies, Inc. |
| 10 | */ |
| 11 | #ifndef _ASM_TERMBITS_H |
| 12 | #define _ASM_TERMBITS_H |
| 13 | |
| 14 | #include <asm-generic/termbits-common.h> |
| 15 | |
| 16 | typedef unsigned int	tcflag_t; |
| 17 | |
| 18 | /* |
| 19 | * The ABI says nothing about NCC but seems to use NCCS as |
| 20 | * replacement for it in struct termio |
| 21 | */ |
| 22 | #define NCCS	23 |
| 23 | struct termios { |
| 24 | 	tcflag_t c_iflag;		/* input mode flags */ |
| 25 | 	tcflag_t c_oflag;		/* output mode flags */ |
| 26 | 	tcflag_t c_cflag;		/* control mode flags */ |
| 27 | 	tcflag_t c_lflag;		/* local mode flags */ |
| 28 | 	cc_t c_line;			/* line discipline */ |
| 29 | 	cc_t c_cc[NCCS];		/* control characters */ |
| 30 | }; |
| 31 | |
| 32 | struct termios2 { |
| 33 | 	tcflag_t c_iflag;		/* input mode flags */ |
| 34 | 	tcflag_t c_oflag;		/* output mode flags */ |
| 35 | 	tcflag_t c_cflag;		/* control mode flags */ |
| 36 | 	tcflag_t c_lflag;		/* local mode flags */ |
| 37 | 	cc_t c_line;			/* line discipline */ |
| 38 | 	cc_t c_cc[NCCS];		/* control characters */ |
| 39 | 	speed_t c_ispeed;		/* input speed */ |
| 40 | 	speed_t c_ospeed;		/* output speed */ |
| 41 | }; |
| 42 | |
| 43 | struct ktermios { |
| 44 | 	tcflag_t c_iflag;		/* input mode flags */ |
| 45 | 	tcflag_t c_oflag;		/* output mode flags */ |
| 46 | 	tcflag_t c_cflag;		/* control mode flags */ |
| 47 | 	tcflag_t c_lflag;		/* local mode flags */ |
| 48 | 	cc_t c_line;			/* line discipline */ |
| 49 | 	cc_t c_cc[NCCS];		/* control characters */ |
| 50 | 	speed_t c_ispeed;		/* input speed */ |
| 51 | 	speed_t c_ospeed;		/* output speed */ |
| 52 | }; |
| 53 | |
| 54 | /* c_cc characters */ |
| 55 | #define VINTR		 0		/* Interrupt character [ISIG] */ |
| 56 | #define VQUIT		 1		/* Quit character [ISIG] */ |
| 57 | #define VERASE		 2		/* Erase character [ICANON] */ |
| 58 | #define VKILL		 3		/* Kill-line character [ICANON] */ |
| 59 | #define VMIN		 4		/* Minimum number of bytes read at once [!ICANON] */ |
| 60 | #define VTIME		 5		/* Time-out value (tenths of a second) [!ICANON] */ |
| 61 | #define VEOL2		 6		/* Second EOL character [ICANON] */ |
| 62 | #define VSWTC		 7		/* ??? */ |
| 63 | #define VSWTCH		VSWTC |
| 64 | #define VSTART		 8		/* Start (X-ON) character [IXON, IXOFF] */ |
| 65 | #define VSTOP		 9		/* Stop (X-OFF) character [IXON, IXOFF] */ |
| 66 | #define VSUSP		10		/* Suspend character [ISIG] */ |
| 67 | #if 0 |
| 68 | /* |
| 69 | * VDSUSP is not supported |
| 70 | */ |
| 71 | #define VDSUSP		11		/* Delayed suspend character [ISIG] */ |
| 72 | #endif |
| 73 | #define VREPRINT	12		/* Reprint-line character [ICANON] */ |
| 74 | #define VDISCARD	13		/* Discard character [IEXTEN] */ |
| 75 | #define VWERASE		14		/* Word-erase character [ICANON] */ |
| 76 | #define VLNEXT		15		/* Literal-next character [IEXTEN] */ |
| 77 | #define VEOF		16		/* End-of-file character [ICANON] */ |
| 78 | #define VEOL		17		/* End-of-line character [ICANON] */ |
| 79 | |
| 80 | /* c_iflag bits */ |
| 81 | #define IUCLC	0x0200		/* Map upper case to lower case on input */ |
| 82 | #define IXON	0x0400		/* Enable start/stop output control */ |
| 83 | #define IXOFF	0x1000		/* Enable start/stop input control */ |
| 84 | #define IMAXBEL	0x2000		/* Ring bell when input queue is full */ |
| 85 | #define IUTF8	0x4000		/* Input is UTF-8 */ |
| 86 | |
| 87 | /* c_oflag bits */ |
| 88 | #define OLCUC	0x00002		/* Map lower case to upper case on output */ |
| 89 | #define ONLCR	0x00004		/* Map NL to CR-NL on output */ |
| 90 | #define NLDLY	0x00100 |
| 91 | #define NL0	0x00000 |
| 92 | #define NL1	0x00100 |
| 93 | #define CRDLY	0x00600 |
| 94 | #define CR0	0x00000 |
| 95 | #define CR1	0x00200 |
| 96 | #define CR2	0x00400 |
| 97 | #define CR3	0x00600 |
| 98 | #define TABDLY	0x01800 |
| 99 | #define TAB0	0x00000 |
| 100 | #define TAB1	0x00800 |
| 101 | #define TAB2	0x01000 |
| 102 | #define TAB3	0x01800 |
| 103 | #define XTABS	0x01800 |
| 104 | #define BSDLY	0x02000 |
| 105 | #define BS0	0x00000 |
| 106 | #define BS1	0x02000 |
| 107 | #define VTDLY	0x04000 |
| 108 | #define VT0	0x00000 |
| 109 | #define VT1	0x04000 |
| 110 | #define FFDLY	0x08000 |
| 111 | #define FF0	0x00000 |
| 112 | #define FF1	0x08000 |
| 113 | /* |
| 114 | #define PAGEOUT ??? |
| 115 | #define WRAP	??? |
| 116 | */ |
| 117 | |
| 118 | /* c_cflag bit meaning */ |
| 119 | #define CBAUD		0x0000100f |
| 120 | #define CSIZE		0x00000030	/* Number of bits per byte (mask) */ |
| 121 | #define CS5		0x00000000	/* 5 bits per byte */ |
| 122 | #define CS6		0x00000010	/* 6 bits per byte */ |
| 123 | #define CS7		0x00000020	/* 7 bits per byte */ |
| 124 | #define CS8		0x00000030	/* 8 bits per byte */ |
| 125 | #define CSTOPB		0x00000040	/* Two stop bits instead of one */ |
| 126 | #define CREAD		0x00000080	/* Enable receiver */ |
| 127 | #define PARENB		0x00000100	/* Parity enable */ |
| 128 | #define PARODD		0x00000200	/* Odd parity instead of even */ |
| 129 | #define HUPCL		0x00000400	/* Hang up on last close */ |
| 130 | #define CLOCAL		0x00000800	/* Ignore modem status lines */ |
| 131 | #define CBAUDEX		0x00001000 |
| 132 | #define BOTHER		0x00001000 |
| 133 | #define B57600	0x00001001 |
| 134 | #define B115200	0x00001002 |
| 135 | #define B230400	0x00001003 |
| 136 | #define B460800	0x00001004 |
| 137 | #define B500000	0x00001005 |
| 138 | #define B576000	0x00001006 |
| 139 | #define B921600	0x00001007 |
| 140 | #define B1000000	0x00001008 |
| 141 | #define B1152000	0x00001009 |
| 142 | #define B1500000	0x0000100a |
| 143 | #define B2000000	0x0000100b |
| 144 | #define B2500000	0x0000100c |
| 145 | #define B3000000	0x0000100d |
| 146 | #define B3500000	0x0000100e |
| 147 | #define B4000000	0x0000100f |
| 148 | #define CIBAUD		0x100f0000	/* input baud rate */ |
| 149 | |
| 150 | /* c_lflag bits */ |
| 151 | #define ISIG	0x00001		/* Enable signals */ |
| 152 | #define ICANON	0x00002		/* Do erase and kill processing */ |
| 153 | #define XCASE	0x00004 |
| 154 | #define ECHO	0x00008		/* Enable echo */ |
| 155 | #define ECHOE	0x00010		/* Visual erase for ERASE */ |
| 156 | #define ECHOK	0x00020		/* Echo NL after KILL */ |
| 157 | #define ECHONL	0x00040		/* Echo NL even if ECHO is off */ |
| 158 | #define NOFLSH	0x00080		/* Disable flush after interrupt */ |
| 159 | #define IEXTEN	0x00100		/* Enable DISCARD and LNEXT */ |
| 160 | #define ECHOCTL	0x00200		/* Echo control characters as ^X */ |
| 161 | #define ECHOPRT	0x00400		/* Hardcopy visual erase */ |
| 162 | #define ECHOKE	0x00800		/* Visual erase for KILL */ |
| 163 | #define FLUSHO	0x02000 |
| 164 | #define PENDIN	0x04000		/* Retype pending input (state) */ |
| 165 | #define TOSTOP	0x08000		/* Send SIGTTOU for background output */ |
| 166 | #define ITOSTOP	TOSTOP |
| 167 | #define EXTPROC	0x10000		/* External processing on pty */ |
| 168 | |
| 169 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ |
| 170 | #define TIOCSER_TEMT	0x01	/* Transmitter physically empty */ |
| 171 | |
| 172 | /* tcsetattr uses these */ |
| 173 | #define TCSANOW		TCSETS	/* Change immediately */ |
| 174 | #define TCSADRAIN	TCSETSW /* Change when pending output is written */ |
| 175 | #define TCSAFLUSH	TCSETSF /* Flush pending input before changing */ |
| 176 | |
| 177 | #endif /* _ASM_TERMBITS_H */ |