xref: /openbmc/linux/arch/sparc/include/asm/termbits.h (revision 9ac8d3fb)
1 #ifndef _SPARC_TERMBITS_H
2 #define _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 	cc_t c_cc[NCCS];		/* control characters */
33 #ifdef __KERNEL__
34 #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
35 	cc_t _x_cc[2];                  /* We need them to hold vmin/vtime */
36 #endif
37 };
38 
39 struct termios2 {
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];		/* control characters */
46 	cc_t _x_cc[2];                  /* padding to match ktermios */
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];		/* control characters */
58 	cc_t _x_cc[2];                  /* We need them to hold vmin/vtime */
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 #ifdef __KERNEL__
88 #define VMIN     16
89 #define VTIME    17
90 #else
91 #define VMIN     VEOF
92 #define VTIME    VEOL
93 #endif
94 
95 /* c_iflag bits */
96 #define IGNBRK	0x00000001
97 #define BRKINT	0x00000002
98 #define IGNPAR	0x00000004
99 #define PARMRK	0x00000008
100 #define INPCK	0x00000010
101 #define ISTRIP	0x00000020
102 #define INLCR	0x00000040
103 #define IGNCR	0x00000080
104 #define ICRNL	0x00000100
105 #define IUCLC	0x00000200
106 #define IXON	0x00000400
107 #define IXANY	0x00000800
108 #define IXOFF	0x00001000
109 #define IMAXBEL	0x00002000
110 #define IUTF8   0x00004000
111 
112 /* c_oflag bits */
113 #define OPOST	0x00000001
114 #define OLCUC	0x00000002
115 #define ONLCR	0x00000004
116 #define OCRNL	0x00000008
117 #define ONOCR	0x00000010
118 #define ONLRET	0x00000020
119 #define OFILL	0x00000040
120 #define OFDEL	0x00000080
121 #define NLDLY	0x00000100
122 #define   NL0	0x00000000
123 #define   NL1	0x00000100
124 #define CRDLY	0x00000600
125 #define   CR0	0x00000000
126 #define   CR1	0x00000200
127 #define   CR2	0x00000400
128 #define   CR3	0x00000600
129 #define TABDLY	0x00001800
130 #define   TAB0	0x00000000
131 #define   TAB1	0x00000800
132 #define   TAB2	0x00001000
133 #define   TAB3	0x00001800
134 #define   XTABS	0x00001800
135 #define BSDLY	0x00002000
136 #define   BS0	0x00000000
137 #define   BS1	0x00002000
138 #define VTDLY	0x00004000
139 #define   VT0	0x00000000
140 #define   VT1	0x00004000
141 #define FFDLY	0x00008000
142 #define   FF0	0x00000000
143 #define   FF1	0x00008000
144 #define PAGEOUT 0x00010000  /* SUNOS specific */
145 #define WRAP    0x00020000  /* SUNOS specific */
146 
147 /* c_cflag bit meaning */
148 #define CBAUD	  0x0000100f
149 #define  B0	  0x00000000   /* hang up */
150 #define  B50	  0x00000001
151 #define  B75	  0x00000002
152 #define  B110	  0x00000003
153 #define  B134	  0x00000004
154 #define  B150	  0x00000005
155 #define  B200	  0x00000006
156 #define  B300	  0x00000007
157 #define  B600	  0x00000008
158 #define  B1200	  0x00000009
159 #define  B1800	  0x0000000a
160 #define  B2400	  0x0000000b
161 #define  B4800	  0x0000000c
162 #define  B9600	  0x0000000d
163 #define  B19200	  0x0000000e
164 #define  B38400	  0x0000000f
165 #define EXTA      B19200
166 #define EXTB      B38400
167 #define  CSIZE    0x00000030
168 #define   CS5	  0x00000000
169 #define   CS6	  0x00000010
170 #define   CS7	  0x00000020
171 #define   CS8	  0x00000030
172 #define CSTOPB	  0x00000040
173 #define CREAD	  0x00000080
174 #define PARENB	  0x00000100
175 #define PARODD	  0x00000200
176 #define HUPCL	  0x00000400
177 #define CLOCAL	  0x00000800
178 #define CBAUDEX   0x00001000
179 /* We'll never see these speeds with the Zilogs, but for completeness... */
180 #define  BOTHER   0x00001000
181 #define  B57600   0x00001001
182 #define  B115200  0x00001002
183 #define  B230400  0x00001003
184 #define  B460800  0x00001004
185 /* This is what we can do with the Zilogs. */
186 #define  B76800   0x00001005
187 /* This is what we can do with the SAB82532. */
188 #define  B153600  0x00001006
189 #define  B307200  0x00001007
190 #define  B614400  0x00001008
191 #define  B921600  0x00001009
192 /* And these are the rest... */
193 #define  B500000  0x0000100a
194 #define  B576000  0x0000100b
195 #define B1000000  0x0000100c
196 #define B1152000  0x0000100d
197 #define B1500000  0x0000100e
198 #define B2000000  0x0000100f
199 /* These have totally bogus values and nobody uses them
200    so far. Later on we'd have to use say 0x10000x and
201    adjust CBAUD constant and drivers accordingly.
202 #define B2500000  0x00001010
203 #define B3000000  0x00001011
204 #define B3500000  0x00001012
205 #define B4000000  0x00001013  */
206 #define CIBAUD	  0x100f0000  /* input baud rate (not used) */
207 #define CMSPAR	  0x40000000  /* mark or space (stick) parity */
208 #define CRTSCTS	  0x80000000  /* flow control */
209 
210 #define IBSHIFT	  16		/* Shift from CBAUD to CIBAUD */
211 
212 /* c_lflag bits */
213 #define ISIG	0x00000001
214 #define ICANON	0x00000002
215 #define XCASE	0x00000004
216 #define ECHO	0x00000008
217 #define ECHOE	0x00000010
218 #define ECHOK	0x00000020
219 #define ECHONL	0x00000040
220 #define NOFLSH	0x00000080
221 #define TOSTOP	0x00000100
222 #define ECHOCTL	0x00000200
223 #define ECHOPRT	0x00000400
224 #define ECHOKE	0x00000800
225 #define DEFECHO 0x00001000  /* SUNOS thing, what is it? */
226 #define FLUSHO	0x00002000
227 #define PENDIN	0x00004000
228 #define IEXTEN	0x00008000
229 
230 /* modem lines */
231 #define TIOCM_LE	0x001
232 #define TIOCM_DTR	0x002
233 #define TIOCM_RTS	0x004
234 #define TIOCM_ST	0x008
235 #define TIOCM_SR	0x010
236 #define TIOCM_CTS	0x020
237 #define TIOCM_CAR	0x040
238 #define TIOCM_RNG	0x080
239 #define TIOCM_DSR	0x100
240 #define TIOCM_CD	TIOCM_CAR
241 #define TIOCM_RI	TIOCM_RNG
242 #define TIOCM_OUT1	0x2000
243 #define TIOCM_OUT2	0x4000
244 #define TIOCM_LOOP	0x8000
245 
246 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
247 #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
248 
249 
250 /* tcflow() and TCXONC use these */
251 #define	TCOOFF		0
252 #define	TCOON		1
253 #define	TCIOFF		2
254 #define	TCION		3
255 
256 /* tcflush() and TCFLSH use these */
257 #define	TCIFLUSH	0
258 #define	TCOFLUSH	1
259 #define	TCIOFLUSH	2
260 
261 /* tcsetattr uses these */
262 #define	TCSANOW		0
263 #define	TCSADRAIN	1
264 #define	TCSAFLUSH	2
265 
266 #endif /* !(_SPARC_TERMBITS_H) */
267