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 <asm-generic/termbits-common.h>
6 
7 #if defined(__sparc__) && defined(__arch64__)
8 typedef unsigned int	tcflag_t;
9 #else
10 typedef unsigned long	tcflag_t;
11 #endif
12 
13 #define NCC 8
14 struct termio {
15 	unsigned short c_iflag;		/* input mode flags */
16 	unsigned short c_oflag;		/* output mode flags */
17 	unsigned short c_cflag;		/* control mode flags */
18 	unsigned short c_lflag;		/* local mode flags */
19 	unsigned char c_line;		/* line discipline */
20 	unsigned char c_cc[NCC];	/* control characters */
21 };
22 
23 #define NCCS 17
24 struct termios {
25 	tcflag_t c_iflag;		/* input mode flags */
26 	tcflag_t c_oflag;		/* output mode flags */
27 	tcflag_t c_cflag;		/* control mode flags */
28 	tcflag_t c_lflag;		/* local mode flags */
29 	cc_t c_line;			/* line discipline */
30 #ifndef __KERNEL__
31 	cc_t c_cc[NCCS];		/* control characters */
32 #else
33 	cc_t c_cc[NCCS+2];	/* kernel needs 2 more to hold vmin/vtime */
34 #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
35 #endif
36 };
37 
38 struct termios2 {
39 	tcflag_t c_iflag;		/* input mode flags */
40 	tcflag_t c_oflag;		/* output mode flags */
41 	tcflag_t c_cflag;		/* control mode flags */
42 	tcflag_t c_lflag;		/* local mode flags */
43 	cc_t c_line;			/* line discipline */
44 	cc_t c_cc[NCCS+2];		/* control characters */
45 	speed_t c_ispeed;		/* input speed */
46 	speed_t c_ospeed;		/* output speed */
47 };
48 
49 struct ktermios {
50 	tcflag_t c_iflag;		/* input mode flags */
51 	tcflag_t c_oflag;		/* output mode flags */
52 	tcflag_t c_cflag;		/* control mode flags */
53 	tcflag_t c_lflag;		/* local mode flags */
54 	cc_t c_line;			/* line discipline */
55 	cc_t c_cc[NCCS+2];		/* control characters */
56 	speed_t c_ispeed;		/* input speed */
57 	speed_t c_ospeed;		/* output speed */
58 };
59 
60 /* c_cc characters */
61 #define VINTR     0
62 #define VQUIT     1
63 #define VERASE    2
64 #define VKILL     3
65 #define VEOF      4
66 #define VEOL      5
67 #define VEOL2     6
68 #define VSWTC     7
69 #define VSTART    8
70 #define VSTOP     9
71 
72 #define VSUSP    10
73 #define VDSUSP   11		/* SunOS POSIX nicety I do believe... */
74 #define VREPRINT 12
75 #define VDISCARD 13
76 #define VWERASE  14
77 #define VLNEXT   15
78 
79 /* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
80  * shared with eof/eol
81  */
82 #ifndef __KERNEL__
83 #define VMIN     VEOF
84 #define VTIME    VEOL
85 #endif
86 
87 /* c_iflag bits */
88 #define IUCLC	0x0200
89 #define IXON	0x0400
90 #define IXOFF	0x1000
91 #define IMAXBEL	0x2000
92 #define IUTF8   0x4000
93 
94 /* c_oflag bits */
95 #define OLCUC	0x00002
96 #define ONLCR	0x00004
97 #define NLDLY	0x00100
98 #define   NL0	0x00000
99 #define   NL1	0x00100
100 #define CRDLY	0x00600
101 #define   CR0	0x00000
102 #define   CR1	0x00200
103 #define   CR2	0x00400
104 #define   CR3	0x00600
105 #define TABDLY	0x01800
106 #define   TAB0	0x00000
107 #define   TAB1	0x00800
108 #define   TAB2	0x01000
109 #define   TAB3	0x01800
110 #define   XTABS	0x01800
111 #define BSDLY	0x02000
112 #define   BS0	0x00000
113 #define   BS1	0x02000
114 #define VTDLY	0x04000
115 #define   VT0	0x00000
116 #define   VT1	0x04000
117 #define FFDLY	0x08000
118 #define   FF0	0x00000
119 #define   FF1	0x08000
120 #define PAGEOUT 0x10000			/* SUNOS specific */
121 #define WRAP    0x20000			/* SUNOS specific */
122 
123 /* c_cflag bit meaning */
124 #define CBAUD		0x0000100f
125 #define CSIZE		0x00000030
126 #define   CS5		0x00000000
127 #define   CS6		0x00000010
128 #define   CS7		0x00000020
129 #define   CS8		0x00000030
130 #define CSTOPB		0x00000040
131 #define CREAD		0x00000080
132 #define PARENB		0x00000100
133 #define PARODD		0x00000200
134 #define HUPCL		0x00000400
135 #define CLOCAL		0x00000800
136 #define CBAUDEX		0x00001000
137 /* We'll never see these speeds with the Zilogs, but for completeness... */
138 #define BOTHER		0x00001000
139 #define     B57600	0x00001001
140 #define    B115200	0x00001002
141 #define    B230400	0x00001003
142 #define    B460800	0x00001004
143 /* This is what we can do with the Zilogs. */
144 #define     B76800	0x00001005
145 /* This is what we can do with the SAB82532. */
146 #define    B153600	0x00001006
147 #define    B307200	0x00001007
148 #define    B614400	0x00001008
149 #define    B921600	0x00001009
150 /* And these are the rest... */
151 #define    B500000	0x0000100a
152 #define    B576000	0x0000100b
153 #define   B1000000	0x0000100c
154 #define   B1152000	0x0000100d
155 #define   B1500000	0x0000100e
156 #define   B2000000	0x0000100f
157 /* These have totally bogus values and nobody uses them
158    so far. Later on we'd have to use say 0x10000x and
159    adjust CBAUD constant and drivers accordingly.
160 #define   B2500000	0x00001010
161 #define   B3000000	0x00001011
162 #define   B3500000	0x00001012
163 #define   B4000000	0x00001013 */
164 #define CIBAUD		0x100f0000	/* input baud rate (not used) */
165 
166 /* c_lflag bits */
167 #define ISIG	0x00000001
168 #define ICANON	0x00000002
169 #define XCASE	0x00000004
170 #define ECHO	0x00000008
171 #define ECHOE	0x00000010
172 #define ECHOK	0x00000020
173 #define ECHONL	0x00000040
174 #define NOFLSH	0x00000080
175 #define TOSTOP	0x00000100
176 #define ECHOCTL	0x00000200
177 #define ECHOPRT	0x00000400
178 #define ECHOKE	0x00000800
179 #define DEFECHO 0x00001000		/* SUNOS thing, what is it? */
180 #define FLUSHO	0x00002000
181 #define PENDIN	0x00004000
182 #define IEXTEN	0x00008000
183 #define EXTPROC	0x00010000
184 
185 /* modem lines */
186 #define TIOCM_LE	0x001
187 #define TIOCM_DTR	0x002
188 #define TIOCM_RTS	0x004
189 #define TIOCM_ST	0x008
190 #define TIOCM_SR	0x010
191 #define TIOCM_CTS	0x020
192 #define TIOCM_CAR	0x040
193 #define TIOCM_RNG	0x080
194 #define TIOCM_DSR	0x100
195 #define TIOCM_CD	TIOCM_CAR
196 #define TIOCM_RI	TIOCM_RNG
197 #define TIOCM_OUT1	0x2000
198 #define TIOCM_OUT2	0x4000
199 #define TIOCM_LOOP	0x8000
200 
201 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
202 #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
203 
204 /* tcsetattr uses these */
205 #define TCSANOW		0
206 #define TCSADRAIN	1
207 #define TCSAFLUSH	2
208 
209 #endif /* _UAPI_SPARC_TERMBITS_H */
210