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