File: /usr/src/linux/include/asm-ppc/termios.h

1     /*
2      * BK Id: SCCS/s.termios.h 1.8 05/17/01 18:14:26 cort
3      */
4     #ifndef _PPC_TERMIOS_H
5     #define _PPC_TERMIOS_H
6     
7     /*
8      * Liberally adapted from alpha/termios.h.  In particular, the c_cc[]
9      * fields have been reordered so that termio & termios share the
10      * common subset in the same order (for brain dead programs that don't
11      * know or care about the differences).
12      */
13     
14     #include <asm/ioctls.h>
15     #include <asm/termbits.h>
16     
17     struct sgttyb {
18     	char	sg_ispeed;
19     	char	sg_ospeed;
20     	char	sg_erase;
21     	char	sg_kill;
22     	short	sg_flags;
23     };
24     
25     struct tchars {
26     	char	t_intrc;
27     	char	t_quitc;
28     	char	t_startc;
29     	char	t_stopc;
30     	char	t_eofc;
31     	char	t_brkc;
32     };
33     
34     struct ltchars {
35     	char	t_suspc;
36     	char	t_dsuspc;
37     	char	t_rprntc;
38     	char	t_flushc;
39     	char	t_werasc;
40     	char	t_lnextc;
41     };
42     
43     #define FIOCLEX		_IO('f', 1)
44     #define FIONCLEX	_IO('f', 2)
45     #define FIOASYNC	_IOW('f', 125, int)
46     #define FIONBIO		_IOW('f', 126, int)
47     #define FIONREAD	_IOR('f', 127, int)
48     #define TIOCINQ		FIONREAD
49     #define FIOQSIZE	_IOR('f', 128, loff_t)
50     
51     #define TIOCGETP	_IOR('t', 8, struct sgttyb)
52     #define TIOCSETP	_IOW('t', 9, struct sgttyb)
53     #define TIOCSETN	_IOW('t', 10, struct sgttyb)	/* TIOCSETP wo flush */
54     
55     #define TIOCSETC	_IOW('t', 17, struct tchars)
56     #define TIOCGETC	_IOR('t', 18, struct tchars)
57     #define TCGETS		_IOR('t', 19, struct termios)
58     #define TCSETS		_IOW('t', 20, struct termios)
59     #define TCSETSW		_IOW('t', 21, struct termios)
60     #define TCSETSF		_IOW('t', 22, struct termios)
61     
62     #define TCGETA		_IOR('t', 23, struct termio)
63     #define TCSETA		_IOW('t', 24, struct termio)
64     #define TCSETAW		_IOW('t', 25, struct termio)
65     #define TCSETAF		_IOW('t', 28, struct termio)
66     
67     #define TCSBRK		_IO('t', 29)
68     #define TCXONC		_IO('t', 30)
69     #define TCFLSH		_IO('t', 31)
70     
71     #define TIOCSWINSZ	_IOW('t', 103, struct winsize)
72     #define TIOCGWINSZ	_IOR('t', 104, struct winsize)
73     #define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */
74     #define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */
75     #define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
76     
77     #define TIOCGLTC	_IOR('t', 116, struct ltchars)
78     #define TIOCSLTC	_IOW('t', 117, struct ltchars)
79     #define TIOCSPGRP	_IOW('t', 118, int)
80     #define TIOCGPGRP	_IOR('t', 119, int)
81     
82     #define TIOCEXCL	0x540C
83     #define TIOCNXCL	0x540D
84     #define TIOCSCTTY	0x540E
85     
86     #define TIOCSTI		0x5412
87     #define TIOCMGET	0x5415
88     #define TIOCMBIS	0x5416
89     #define TIOCMBIC	0x5417
90     #define TIOCMSET	0x5418
91     #define TIOCGSOFTCAR	0x5419
92     #define TIOCSSOFTCAR	0x541A
93     #define TIOCLINUX	0x541C
94     #define TIOCCONS	0x541D
95     #define TIOCGSERIAL	0x541E
96     #define TIOCSSERIAL	0x541F
97     #define TIOCPKT		0x5420
98     
99     #define TIOCNOTTY	0x5422
100     #define TIOCSETD	0x5423
101     #define TIOCGETD	0x5424
102     #define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
103     #define TIOCTTYGSTRUCT	0x5426  /* For debugging only */
104     
105     #define TIOCSERCONFIG	0x5453
106     #define TIOCSERGWILD	0x5454
107     #define TIOCSERSWILD	0x5455
108     #define TIOCGLCKTRMIOS	0x5456
109     #define TIOCSLCKTRMIOS	0x5457
110     #define TIOCSERGSTRUCT	0x5458 /* For debugging only */
111     #define TIOCSERGETLSR   0x5459 /* Get line status register */
112     #define TIOCSERGETMULTI 0x545A /* Get multiport config  */
113     #define TIOCSERSETMULTI 0x545B /* Set multiport config */
114     
115     #define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
116     #define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
117     
118     /* Used for packet mode */
119     #define TIOCPKT_DATA		 0
120     #define TIOCPKT_FLUSHREAD	 1
121     #define TIOCPKT_FLUSHWRITE	 2
122     #define TIOCPKT_STOP		 4
123     #define TIOCPKT_START		 8
124     #define TIOCPKT_NOSTOP		16
125     #define TIOCPKT_DOSTOP		32
126     
127     struct winsize {
128     	unsigned short ws_row;
129     	unsigned short ws_col;
130     	unsigned short ws_xpixel;
131     	unsigned short ws_ypixel;
132     };
133     
134     #define NCC 10
135     struct termio {
136     	unsigned short c_iflag;		/* input mode flags */
137     	unsigned short c_oflag;		/* output mode flags */
138     	unsigned short c_cflag;		/* control mode flags */
139     	unsigned short c_lflag;		/* local mode flags */
140     	unsigned char c_line;		/* line discipline */
141     	unsigned char c_cc[NCC];	/* control characters */
142     };
143     
144     /* c_cc characters */
145     #define _VINTR	0
146     #define _VQUIT	1
147     #define _VERASE	2
148     #define _VKILL	3
149     #define _VEOF	4
150     #define _VMIN	5
151     #define _VEOL	6
152     #define _VTIME	7
153     #define _VEOL2	8
154     #define _VSWTC	9
155     
156     #ifdef __KERNEL__
157     /*                   ^C  ^\ del  ^U  ^D   1   0   0   0   0  ^W  ^R  ^Z  ^Q  ^S  ^V  ^U  */
158     #define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
159     #endif
160     
161     /* modem lines */
162     #define TIOCM_LE	0x001
163     #define TIOCM_DTR	0x002
164     #define TIOCM_RTS	0x004
165     #define TIOCM_ST	0x008
166     #define TIOCM_SR	0x010
167     #define TIOCM_CTS	0x020
168     #define TIOCM_CAR	0x040
169     #define TIOCM_RNG	0x080
170     #define TIOCM_DSR	0x100
171     #define TIOCM_CD	TIOCM_CAR
172     #define TIOCM_RI	TIOCM_RNG
173     #define TIOCM_OUT1	0x2000
174     #define TIOCM_OUT2	0x4000
175     #define TIOCM_LOOP	0x8000
176     
177     /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
178     #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
179     
180     /* line disciplines */
181     #define N_TTY		0
182     #define N_SLIP		1
183     #define N_MOUSE		2
184     #define N_PPP		3
185     #define N_STRIP		4
186     #define N_AX25		5
187     #define N_X25		6	/* X.25 async */
188     #define N_6PACK		7
189     #define N_MASC		8	/* Reserved for Mobitex module <kaz@cafe.net> */
190     #define N_R3964		9	/* Reserved for Simatic R3964 module */
191     #define N_PROFIBUS_FDL	10	/* Reserved for Profibus <Dave@mvhi.com> */
192     #define N_IRDA		11	/* Linux IrDa - http://irda.sourceforge.net/ */
193     #define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
194     #define N_HDLC		13	/* synchronous HDLC */
195     #define N_SYNC_PPP	14
196     #define N_HCI		15  /* Bluetooth HCI UART */
197     
198     #ifdef __KERNEL__
199     
200     /*
201      * Translate a "termio" structure into a "termios". Ugh.
202      */
203     #define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
204     	unsigned short __tmp; \
205     	get_user(__tmp,&(termio)->x); \
206     	(termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
207     }
208     
209     #define user_termio_to_kernel_termios(termios, termio) \
210     ({ \
211     	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
212     	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
213     	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
214     	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
215     	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
216     })
217     
218     /*
219      * Translate a "termios" structure into a "termio". Ugh.
220      */
221     #define kernel_termios_to_user_termio(termio, termios) \
222     ({ \
223     	put_user((termios)->c_iflag, &(termio)->c_iflag); \
224     	put_user((termios)->c_oflag, &(termio)->c_oflag); \
225     	put_user((termios)->c_cflag, &(termio)->c_cflag); \
226     	put_user((termios)->c_lflag, &(termio)->c_lflag); \
227     	put_user((termios)->c_line,  &(termio)->c_line); \
228     	copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
229     })
230     
231     #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
232     #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
233     
234     #endif	/* __KERNEL__ */
235     
236     #endif	/* _PPC_TERMIOS_H */
237