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