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