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