xref: /linux/arch/sparc/include/uapi/asm/termbits.h (revision 87c9c16317882dd6dbbc07e349bc3223e14f3244)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_SPARC_TERMBITS_H
3 #define _UAPI_SPARC_TERMBITS_H
4 
5 #include <linux/posix_types.h>
6 
7 typedef unsigned char   cc_t;
8 typedef unsigned int    speed_t;
9 
10 #if defined(__sparc__) && defined(__arch64__)
11 typedef unsigned int    tcflag_t;
12 #else
13 typedef unsigned long   tcflag_t;
14 #endif
15 
16 #define NCC 8
17 struct termio {
18 	unsigned short c_iflag;		/* input mode flags */
19 	unsigned short c_oflag;		/* output mode flags */
20 	unsigned short c_cflag;		/* control mode flags */
21 	unsigned short c_lflag;		/* local mode flags */
22 	unsigned char c_line;		/* line discipline */
23 	unsigned char c_cc[NCC];	/* control characters */
24 };
25 
26 #define NCCS 17
27 struct termios {
28 	tcflag_t c_iflag;		/* input mode flags */
29 	tcflag_t c_oflag;		/* output mode flags */
30 	tcflag_t c_cflag;		/* control mode flags */
31 	tcflag_t c_lflag;		/* local mode flags */
32 	cc_t c_line;			/* line discipline */
33 #ifndef __KERNEL__
34 	cc_t c_cc[NCCS];		/* control characters */
35 #else
36 	cc_t c_cc[NCCS+2];	/* kernel needs 2 more to hold vmin/vtime */
37 #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
38 #endif
39 };
40 
41 struct termios2 {
42 	tcflag_t c_iflag;		/* input mode flags */
43 	tcflag_t c_oflag;		/* output mode flags */
44 	tcflag_t c_cflag;		/* control mode flags */
45 	tcflag_t c_lflag;		/* local mode flags */
46 	cc_t c_line;			/* line discipline */
47 	cc_t c_cc[NCCS+2];		/* control characters */
48 	speed_t c_ispeed;		/* input speed */
49 	speed_t c_ospeed;		/* output speed */
50 };
51 
52 struct ktermios {
53 	tcflag_t c_iflag;		/* input mode flags */
54 	tcflag_t c_oflag;		/* output mode flags */
55 	tcflag_t c_cflag;		/* control mode flags */
56 	tcflag_t c_lflag;		/* local mode flags */
57 	cc_t c_line;			/* line discipline */
58 	cc_t c_cc[NCCS+2];		/* control characters */
59 	speed_t c_ispeed;		/* input speed */
60 	speed_t c_ospeed;		/* output speed */
61 };
62 
63 /* c_cc characters */
64 #define VINTR    0
65 #define VQUIT    1
66 #define VERASE   2
67 #define VKILL    3
68 #define VEOF     4
69 #define VEOL     5
70 #define VEOL2    6
71 #define VSWTC    7
72 #define VSTART   8
73 #define VSTOP    9
74 
75 
76 
77 #define VSUSP    10
78 #define VDSUSP   11  /* SunOS POSIX nicety I do believe... */
79 #define VREPRINT 12
80 #define VDISCARD 13
81 #define VWERASE  14
82 #define VLNEXT   15
83 
84 /* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
85  * shared with eof/eol
86  */
87 #ifndef __KERNEL__
88 #define VMIN     VEOF
89 #define VTIME    VEOL
90 #endif
91 
92 /* c_iflag bits */
93 #define IGNBRK	0x00000001
94 #define BRKINT	0x00000002
95 #define IGNPAR	0x00000004
96 #define PARMRK	0x00000008
97 #define INPCK	0x00000010
98 #define ISTRIP	0x00000020
99 #define INLCR	0x00000040
100 #define IGNCR	0x00000080
101 #define ICRNL	0x00000100
102 #define IUCLC	0x00000200
103 #define IXON	0x00000400
104 #define IXANY	0x00000800
105 #define IXOFF	0x00001000
106 #define IMAXBEL	0x00002000
107 #define IUTF8   0x00004000
108 
109 /* c_oflag bits */
110 #define OPOST	0x00000001
111 #define OLCUC	0x00000002
112 #define ONLCR	0x00000004
113 #define OCRNL	0x00000008
114 #define ONOCR	0x00000010
115 #define ONLRET	0x00000020
116 #define OFILL	0x00000040
117 #define OFDEL	0x00000080
118 #define NLDLY	0x00000100
119 #define   NL0	0x00000000
120 #define   NL1	0x00000100
121 #define CRDLY	0x00000600
122 #define   CR0	0x00000000
123 #define   CR1	0x00000200
124 #define   CR2	0x00000400
125 #define   CR3	0x00000600
126 #define TABDLY	0x00001800
127 #define   TAB0	0x00000000
128 #define   TAB1	0x00000800
129 #define   TAB2	0x00001000
130 #define   TAB3	0x00001800
131 #define   XTABS	0x00001800
132 #define BSDLY	0x00002000
133 #define   BS0	0x00000000
134 #define   BS1	0x00002000
135 #define VTDLY	0x00004000
136 #define   VT0	0x00000000
137 #define   VT1	0x00004000
138 #define FFDLY	0x00008000
139 #define   FF0	0x00000000
140 #define   FF1	0x00008000
141 #define PAGEOUT 0x00010000  /* SUNOS specific */
142 #define WRAP    0x00020000  /* SUNOS specific */
143 
144 /* c_cflag bit meaning */
145 #define CBAUD	  0x0000100f
146 #define  B0	  0x00000000   /* hang up */
147 #define  B50	  0x00000001
148 #define  B75	  0x00000002
149 #define  B110	  0x00000003
150 #define  B134	  0x00000004
151 #define  B150	  0x00000005
152 #define  B200	  0x00000006
153 #define  B300	  0x00000007
154 #define  B600	  0x00000008
155 #define  B1200	  0x00000009
156 #define  B1800	  0x0000000a
157 #define  B2400	  0x0000000b
158 #define  B4800	  0x0000000c
159 #define  B9600	  0x0000000d
160 #define  B19200	  0x0000000e
161 #define  B38400	  0x0000000f
162 #define EXTA      B19200
163 #define EXTB      B38400
164 #define  CSIZE    0x00000030
165 #define   CS5	  0x00000000
166 #define   CS6	  0x00000010
167 #define   CS7	  0x00000020
168 #define   CS8	  0x00000030
169 #define CSTOPB	  0x00000040
170 #define CREAD	  0x00000080
171 #define PARENB	  0x00000100
172 #define PARODD	  0x00000200
173 #define HUPCL	  0x00000400
174 #define CLOCAL	  0x00000800
175 #define CBAUDEX   0x00001000
176 /* We'll never see these speeds with the Zilogs, but for completeness... */
177 #define  BOTHER   0x00001000
178 #define  B57600   0x00001001
179 #define  B115200  0x00001002
180 #define  B230400  0x00001003
181 #define  B460800  0x00001004
182 /* This is what we can do with the Zilogs. */
183 #define  B76800   0x00001005
184 /* This is what we can do with the SAB82532. */
185 #define  B153600  0x00001006
186 #define  B307200  0x00001007
187 #define  B614400  0x00001008
188 #define  B921600  0x00001009
189 /* And these are the rest... */
190 #define  B500000  0x0000100a
191 #define  B576000  0x0000100b
192 #define B1000000  0x0000100c
193 #define B1152000  0x0000100d
194 #define B1500000  0x0000100e
195 #define B2000000  0x0000100f
196 /* These have totally bogus values and nobody uses them
197    so far. Later on we'd have to use say 0x10000x and
198    adjust CBAUD constant and drivers accordingly.
199 #define B2500000  0x00001010
200 #define B3000000  0x00001011
201 #define B3500000  0x00001012
202 #define B4000000  0x00001013  */
203 #define CIBAUD	  0x100f0000  /* input baud rate (not used) */
204 #define CMSPAR	  0x40000000  /* mark or space (stick) parity */
205 #define CRTSCTS	  0x80000000  /* flow control */
206 
207 #define IBSHIFT	  16		/* Shift from CBAUD to CIBAUD */
208 
209 /* c_lflag bits */
210 #define ISIG	0x00000001
211 #define ICANON	0x00000002
212 #define XCASE	0x00000004
213 #define ECHO	0x00000008
214 #define ECHOE	0x00000010
215 #define ECHOK	0x00000020
216 #define ECHONL	0x00000040
217 #define NOFLSH	0x00000080
218 #define TOSTOP	0x00000100
219 #define ECHOCTL	0x00000200
220 #define ECHOPRT	0x00000400
221 #define ECHOKE	0x00000800
222 #define DEFECHO 0x00001000  /* SUNOS thing, what is it? */
223 #define FLUSHO	0x00002000
224 #define PENDIN	0x00004000
225 #define IEXTEN	0x00008000
226 #define EXTPROC	0x00010000
227 
228 /* modem lines */
229 #define TIOCM_LE	0x001
230 #define TIOCM_DTR	0x002
231 #define TIOCM_RTS	0x004
232 #define TIOCM_ST	0x008
233 #define TIOCM_SR	0x010
234 #define TIOCM_CTS	0x020
235 #define TIOCM_CAR	0x040
236 #define TIOCM_RNG	0x080
237 #define TIOCM_DSR	0x100
238 #define TIOCM_CD	TIOCM_CAR
239 #define TIOCM_RI	TIOCM_RNG
240 #define TIOCM_OUT1	0x2000
241 #define TIOCM_OUT2	0x4000
242 #define TIOCM_LOOP	0x8000
243 
244 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
245 #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
246 
247 
248 /* tcflow() and TCXONC use these */
249 #define	TCOOFF		0
250 #define	TCOON		1
251 #define	TCIOFF		2
252 #define	TCION		3
253 
254 /* tcflush() and TCFLSH use these */
255 #define	TCIFLUSH	0
256 #define	TCOFLUSH	1
257 #define	TCIOFLUSH	2
258 
259 /* tcsetattr uses these */
260 #define	TCSANOW		0
261 #define	TCSADRAIN	1
262 #define	TCSAFLUSH	2
263 
264 #endif /* _UAPI_SPARC_TERMBITS_H */
265