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