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