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