1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * include/asm-xtensa/termbits.h
4  *
5  * Copied from SH.
6  *
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file "COPYING" in the main directory of this archive
9  * for more details.
10  *
11  * Copyright (C) 2001 - 2005 Tensilica Inc.
12  */
13 
14 #ifndef _XTENSA_TERMBITS_H
15 #define _XTENSA_TERMBITS_H
16 
17 
18 #include <linux/posix_types.h>
19 
20 typedef unsigned char	cc_t;
21 typedef unsigned int	speed_t;
22 typedef unsigned int	tcflag_t;
23 
24 #define NCCS 19
25 struct termios {
26 	tcflag_t c_iflag;		/* input mode flags */
27 	tcflag_t c_oflag;		/* output mode flags */
28 	tcflag_t c_cflag;		/* control mode flags */
29 	tcflag_t c_lflag;		/* local mode flags */
30 	cc_t c_line;			/* line discipline */
31 	cc_t c_cc[NCCS];		/* control characters */
32 };
33 
34 struct termios2 {
35 	tcflag_t c_iflag;		/* input mode flags */
36 	tcflag_t c_oflag;		/* output mode flags */
37 	tcflag_t c_cflag;		/* control mode flags */
38 	tcflag_t c_lflag;		/* local mode flags */
39 	cc_t c_line;			/* line discipline */
40 	cc_t c_cc[NCCS];		/* control characters */
41 	speed_t c_ispeed;		/* input speed */
42 	speed_t c_ospeed;		/* output speed */
43 };
44 
45 struct ktermios {
46 	tcflag_t c_iflag;		/* input mode flags */
47 	tcflag_t c_oflag;		/* output mode flags */
48 	tcflag_t c_cflag;		/* control mode flags */
49 	tcflag_t c_lflag;		/* local mode flags */
50 	cc_t c_line;			/* line discipline */
51 	cc_t c_cc[NCCS];		/* control characters */
52 	speed_t c_ispeed;		/* input speed */
53 	speed_t c_ospeed;		/* output speed */
54 };
55 
56 /* c_cc characters */
57 
58 #define VINTR 0
59 #define VQUIT 1
60 #define VERASE 2
61 #define VKILL 3
62 #define VEOF 4
63 #define VTIME 5
64 #define VMIN 6
65 #define VSWTC 7
66 #define VSTART 8
67 #define VSTOP 9
68 #define VSUSP 10
69 #define VEOL 11
70 #define VREPRINT 12
71 #define VDISCARD 13
72 #define VWERASE 14
73 #define VLNEXT 15
74 #define VEOL2 16
75 
76 /* c_iflag bits */
77 
78 #define IGNBRK	0000001
79 #define BRKINT	0000002
80 #define IGNPAR	0000004
81 #define PARMRK	0000010
82 #define INPCK	0000020
83 #define ISTRIP	0000040
84 #define INLCR	0000100
85 #define IGNCR	0000200
86 #define ICRNL	0000400
87 #define IUCLC	0001000
88 #define IXON	0002000
89 #define IXANY	0004000
90 #define IXOFF	0010000
91 #define IMAXBEL	0020000
92 #define IUTF8	0040000
93 
94 /* c_oflag bits */
95 
96 #define OPOST	0000001
97 #define OLCUC	0000002
98 #define ONLCR	0000004
99 #define OCRNL	0000010
100 #define ONOCR	0000020
101 #define ONLRET	0000040
102 #define OFILL	0000100
103 #define OFDEL	0000200
104 #define NLDLY	0000400
105 #define   NL0	0000000
106 #define   NL1	0000400
107 #define CRDLY	0003000
108 #define   CR0	0000000
109 #define   CR1	0001000
110 #define   CR2	0002000
111 #define   CR3	0003000
112 #define TABDLY	0014000
113 #define   TAB0	0000000
114 #define   TAB1	0004000
115 #define   TAB2	0010000
116 #define   TAB3	0014000
117 #define   XTABS	0014000
118 #define BSDLY	0020000
119 #define   BS0	0000000
120 #define   BS1	0020000
121 #define VTDLY	0040000
122 #define   VT0	0000000
123 #define   VT1	0040000
124 #define FFDLY	0100000
125 #define   FF0	0000000
126 #define   FF1	0100000
127 
128 /* c_cflag bit meaning */
129 
130 #define CBAUD	0010017
131 #define  B0	0000000		/* hang up */
132 #define  B50	0000001
133 #define  B75	0000002
134 #define  B110	0000003
135 #define  B134	0000004
136 #define  B150	0000005
137 #define  B200	0000006
138 #define  B300	0000007
139 #define  B600	0000010
140 #define  B1200	0000011
141 #define  B1800	0000012
142 #define  B2400	0000013
143 #define  B4800	0000014
144 #define  B9600	0000015
145 #define  B19200	0000016
146 #define  B38400	0000017
147 #define EXTA B19200
148 #define EXTB B38400
149 #define CSIZE	0000060
150 #define   CS5	0000000
151 #define   CS6	0000020
152 #define   CS7	0000040
153 #define   CS8	0000060
154 #define CSTOPB	0000100
155 #define CREAD	0000200
156 #define PARENB	0000400
157 #define PARODD	0001000
158 #define HUPCL	0002000
159 #define CLOCAL	0004000
160 #define CBAUDEX 0010000
161 #define	   BOTHER 0010000
162 #define    B57600 0010001
163 #define   B115200 0010002
164 #define   B230400 0010003
165 #define   B460800 0010004
166 #define   B500000 0010005
167 #define   B576000 0010006
168 #define   B921600 0010007
169 #define  B1000000 0010010
170 #define  B1152000 0010011
171 #define  B1500000 0010012
172 #define  B2000000 0010013
173 #define  B2500000 0010014
174 #define  B3000000 0010015
175 #define  B3500000 0010016
176 #define  B4000000 0010017
177 #define CIBAUD	  002003600000		/* input baud rate */
178 #define CMSPAR	  010000000000		/* mark or space (stick) parity */
179 #define CRTSCTS	  020000000000		/* flow control */
180 
181 #define IBSHIFT	16		/* Shift from CBAUD to CIBAUD */
182 
183 /* c_lflag bits */
184 
185 #define ISIG	0000001
186 #define ICANON	0000002
187 #define XCASE	0000004
188 #define ECHO	0000010
189 #define ECHOE	0000020
190 #define ECHOK	0000040
191 #define ECHONL	0000100
192 #define NOFLSH	0000200
193 #define TOSTOP	0000400
194 #define ECHOCTL	0001000
195 #define ECHOPRT	0002000
196 #define ECHOKE	0004000
197 #define FLUSHO	0010000
198 #define PENDIN	0040000
199 #define IEXTEN	0100000
200 #define EXTPROC	0200000
201 
202 /* tcflow() and TCXONC use these */
203 
204 #define	TCOOFF		0
205 #define	TCOON		1
206 #define	TCIOFF		2
207 #define	TCION		3
208 
209 /* tcflush() and TCFLSH use these */
210 
211 #define	TCIFLUSH	0
212 #define	TCOFLUSH	1
213 #define	TCIOFLUSH	2
214 
215 /* tcsetattr uses these */
216 
217 #define	TCSANOW		0
218 #define	TCSADRAIN	1
219 #define	TCSAFLUSH	2
220 
221 #endif	/* _XTENSA_TERMBITS_H */
222