1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef __ASM_GENERIC_TERMBITS_H
3 #define __ASM_GENERIC_TERMBITS_H
4 
5 #include <linux/posix_types.h>
6 
7 typedef unsigned char	cc_t;
8 typedef unsigned int	speed_t;
9 typedef unsigned int	tcflag_t;
10 
11 #define NCCS 19
12 struct termios {
13 	tcflag_t c_iflag;		/* input mode flags */
14 	tcflag_t c_oflag;		/* output mode flags */
15 	tcflag_t c_cflag;		/* control mode flags */
16 	tcflag_t c_lflag;		/* local mode flags */
17 	cc_t c_line;			/* line discipline */
18 	cc_t c_cc[NCCS];		/* control characters */
19 };
20 
21 struct termios2 {
22 	tcflag_t c_iflag;		/* input mode flags */
23 	tcflag_t c_oflag;		/* output mode flags */
24 	tcflag_t c_cflag;		/* control mode flags */
25 	tcflag_t c_lflag;		/* local mode flags */
26 	cc_t c_line;			/* line discipline */
27 	cc_t c_cc[NCCS];		/* control characters */
28 	speed_t c_ispeed;		/* input speed */
29 	speed_t c_ospeed;		/* output speed */
30 };
31 
32 struct ktermios {
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 /* c_cc characters */
44 #define VINTR 0
45 #define VQUIT 1
46 #define VERASE 2
47 #define VKILL 3
48 #define VEOF 4
49 #define VTIME 5
50 #define VMIN 6
51 #define VSWTC 7
52 #define VSTART 8
53 #define VSTOP 9
54 #define VSUSP 10
55 #define VEOL 11
56 #define VREPRINT 12
57 #define VDISCARD 13
58 #define VWERASE 14
59 #define VLNEXT 15
60 #define VEOL2 16
61 
62 /* c_iflag bits */
63 #define IGNBRK	0x00001
64 #define BRKINT	0x00002
65 #define IGNPAR	0x00004
66 #define PARMRK	0x00008
67 #define INPCK	0x00010
68 #define ISTRIP	0x00020
69 #define INLCR	0x00040
70 #define IGNCR	0x00080
71 #define ICRNL	0x00100
72 #define IUCLC	0x00200
73 #define IXON	0x00400
74 #define IXANY	0x00800
75 #define IXOFF	0x01000
76 #define IMAXBEL	0x02000
77 #define IUTF8	0x04000
78 
79 /* c_oflag bits */
80 #define OPOST	0x00001
81 #define OLCUC	0x00002
82 #define ONLCR	0x00004
83 #define OCRNL	0x00008
84 #define ONOCR	0x00010
85 #define ONLRET	0x00020
86 #define OFILL	0x00040
87 #define OFDEL	0x00080
88 #define NLDLY	0x00100
89 #define   NL0	0x00000
90 #define   NL1	0x00100
91 #define CRDLY	0x00600
92 #define   CR0	0x00000
93 #define   CR1	0x00200
94 #define   CR2	0x00400
95 #define   CR3	0x00600
96 #define TABDLY	0x01800
97 #define   TAB0	0x00000
98 #define   TAB1	0x00800
99 #define   TAB2	0x01000
100 #define   TAB3	0x01800
101 #define   XTABS	0x01800
102 #define BSDLY	0x02000
103 #define   BS0	0x00000
104 #define   BS1	0x02000
105 #define VTDLY	0x04000
106 #define   VT0	0x00000
107 #define   VT1	0x04000
108 #define FFDLY	0x08000
109 #define   FF0	0x00000
110 #define   FF1	0x08000
111 
112 /* c_cflag bit meaning */
113 #define CBAUD		0x0000100f
114 #define  B0		0x00000000	/* hang up */
115 #define  B50		0x00000001
116 #define  B75		0x00000002
117 #define  B110		0x00000003
118 #define  B134		0x00000004
119 #define  B150		0x00000005
120 #define  B200		0x00000006
121 #define  B300		0x00000007
122 #define  B600		0x00000008
123 #define  B1200		0x00000009
124 #define  B1800		0x0000000a
125 #define  B2400		0x0000000b
126 #define  B4800		0x0000000c
127 #define  B9600		0x0000000d
128 #define  B19200		0x0000000e
129 #define  B38400		0x0000000f
130 #define EXTA B19200
131 #define EXTB B38400
132 #define CSIZE		0x00000030
133 #define   CS5		0x00000000
134 #define   CS6		0x00000010
135 #define   CS7		0x00000020
136 #define   CS8		0x00000030
137 #define CSTOPB		0x00000040
138 #define CREAD		0x00000080
139 #define PARENB		0x00000100
140 #define PARODD		0x00000200
141 #define HUPCL		0x00000400
142 #define CLOCAL		0x00000800
143 #define CBAUDEX		0x00001000
144 #define    BOTHER	0x00001000
145 #define    B57600	0x00001001
146 #define   B115200	0x00001002
147 #define   B230400	0x00001003
148 #define   B460800	0x00001004
149 #define   B500000	0x00001005
150 #define   B576000	0x00001006
151 #define   B921600	0x00001007
152 #define  B1000000	0x00001008
153 #define  B1152000	0x00001009
154 #define  B1500000	0x0000100a
155 #define  B2000000	0x0000100b
156 #define  B2500000	0x0000100c
157 #define  B3000000	0x0000100d
158 #define  B3500000	0x0000100e
159 #define  B4000000	0x0000100f
160 #define CIBAUD		0x100f0000	/* input baud rate */
161 #define CMSPAR		0x40000000	/* mark or space (stick) parity */
162 #define CRTSCTS		0x80000000	/* flow control */
163 
164 #define IBSHIFT	  16		/* Shift from CBAUD to CIBAUD */
165 
166 /* c_lflag bits */
167 #define ISIG	0x00001
168 #define ICANON	0x00002
169 #define XCASE	0x00004
170 #define ECHO	0x00008
171 #define ECHOE	0x00010
172 #define ECHOK	0x00020
173 #define ECHONL	0x00040
174 #define NOFLSH	0x00080
175 #define TOSTOP	0x00100
176 #define ECHOCTL	0x00200
177 #define ECHOPRT	0x00400
178 #define ECHOKE	0x00800
179 #define FLUSHO	0x01000
180 #define PENDIN	0x04000
181 #define IEXTEN	0x08000
182 #define EXTPROC	0x10000
183 
184 /* tcflow() and TCXONC use these */
185 #define	TCOOFF		0
186 #define	TCOON		1
187 #define	TCIOFF		2
188 #define	TCION		3
189 
190 /* tcflush() and TCFLSH use these */
191 #define	TCIFLUSH	0
192 #define	TCOFLUSH	1
193 #define	TCIOFLUSH	2
194 
195 /* tcsetattr uses these */
196 #define	TCSANOW		0
197 #define	TCSADRAIN	1
198 #define	TCSAFLUSH	2
199 
200 #endif /* __ASM_GENERIC_TERMBITS_H */
201