* added 0.99 linux version
[mascara-docs.git] / i386 / linux / linux-2.3.21 / include / asm-alpha / termios.h
blob35e14b49bf86b5c1ec7301c6b299869ac549b7b7
1 #ifndef _ALPHA_TERMIOS_H
2 #define _ALPHA_TERMIOS_H
4 #include <asm/ioctls.h>
5 #include <asm/termbits.h>
7 struct sgttyb {
8 char sg_ispeed;
9 char sg_ospeed;
10 char sg_erase;
11 char sg_kill;
12 short sg_flags;
15 struct tchars {
16 char t_intrc;
17 char t_quitc;
18 char t_startc;
19 char t_stopc;
20 char t_eofc;
21 char t_brkc;
24 struct ltchars {
25 char t_suspc;
26 char t_dsuspc;
27 char t_rprntc;
28 char t_flushc;
29 char t_werasc;
30 char t_lnextc;
33 struct winsize {
34 unsigned short ws_row;
35 unsigned short ws_col;
36 unsigned short ws_xpixel;
37 unsigned short ws_ypixel;
40 #define NCC 8
41 struct termio {
42 unsigned short c_iflag; /* input mode flags */
43 unsigned short c_oflag; /* output mode flags */
44 unsigned short c_cflag; /* control mode flags */
45 unsigned short c_lflag; /* local mode flags */
46 unsigned char c_line; /* line discipline */
47 unsigned char c_cc[NCC]; /* control characters */
51 * c_cc characters in the termio structure. Oh, how I love being
52 * backwardly compatible. Notice that character 4 and 5 are
53 * interpreted differently depending on whether ICANON is set in
54 * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
55 * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
56 * is compatible with sysV)...
58 #define _VINTR 0
59 #define _VQUIT 1
60 #define _VERASE 2
61 #define _VKILL 3
62 #define _VEOF 4
63 #define _VMIN 4
64 #define _VEOL 5
65 #define _VTIME 5
66 #define _VEOL2 6
67 #define _VSWTC 7
69 /* line disciplines */
70 #define N_TTY 0
71 #define N_SLIP 1
72 #define N_MOUSE 2
73 #define N_PPP 3
74 #define N_AX25 5
75 #define N_X25 6 /* X.25 async */
76 #define N_6PACK 7
77 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
78 #define N_R3964 9 /* Reserved for Simatic R3964 module */
79 #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
80 #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
81 #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
82 #define N_HDLC 13 /* synchronous HDLC */
84 #ifdef __KERNEL__
85 /* eof=^D eol=\0 eol2=\0 erase=del
86 werase=^W kill=^U reprint=^R sxtc=\0
87 intr=^C quit=^\ susp=^Z <OSF/1 VDSUSP>
88 start=^Q stop=^S lnext=^V discard=^U
89 vmin=\1 vtime=\0
91 #define INIT_C_CC "\004\000\000\177\027\025\022\000\003\034\032\000\021\023\026\025\001\000"
94 * Translate a "termio" structure into a "termios". Ugh.
97 #define user_termio_to_kernel_termios(a_termios, u_termio) \
98 ({ \
99 struct termios *k_termios = (a_termios); \
100 struct termio k_termio; \
101 int canon, ret; \
103 ret = copy_from_user(&k_termio, u_termio, sizeof(k_termio)); \
104 if (!ret) { \
105 /* Overwrite only the low bits. */ \
106 *(unsigned short *)&k_termios->c_iflag = k_termio.c_iflag; \
107 *(unsigned short *)&k_termios->c_oflag = k_termio.c_oflag; \
108 *(unsigned short *)&k_termios->c_cflag = k_termio.c_cflag; \
109 *(unsigned short *)&k_termios->c_lflag = k_termio.c_lflag; \
110 canon = k_termio.c_lflag & ICANON; \
112 k_termios->c_cc[VINTR] = k_termio.c_cc[_VINTR]; \
113 k_termios->c_cc[VQUIT] = k_termio.c_cc[_VQUIT]; \
114 k_termios->c_cc[VERASE] = k_termio.c_cc[_VERASE]; \
115 k_termios->c_cc[VKILL] = k_termio.c_cc[_VKILL]; \
116 k_termios->c_cc[VEOL2] = k_termio.c_cc[_VEOL2]; \
117 k_termios->c_cc[VSWTC] = k_termio.c_cc[_VSWTC]; \
118 k_termios->c_cc[canon ? VEOF : VMIN] = k_termio.c_cc[_VEOF]; \
119 k_termios->c_cc[canon ? VEOL : VTIME] = k_termio.c_cc[_VEOL]; \
121 ret; \
125 * Translate a "termios" structure into a "termio". Ugh.
127 * Note the "fun" _VMIN overloading.
129 #define kernel_termios_to_user_termio(u_termio, a_termios) \
130 ({ \
131 struct termios *k_termios = (a_termios); \
132 struct termio k_termio; \
133 int canon; \
135 k_termio.c_iflag = k_termios->c_iflag; \
136 k_termio.c_oflag = k_termios->c_oflag; \
137 k_termio.c_cflag = k_termios->c_cflag; \
138 canon = (k_termio.c_lflag = k_termios->c_lflag) & ICANON; \
140 k_termio.c_line = k_termios->c_line; \
141 k_termio.c_cc[_VINTR] = k_termios->c_cc[VINTR]; \
142 k_termio.c_cc[_VQUIT] = k_termios->c_cc[VQUIT]; \
143 k_termio.c_cc[_VERASE] = k_termios->c_cc[VERASE]; \
144 k_termio.c_cc[_VKILL] = k_termios->c_cc[VKILL]; \
145 k_termio.c_cc[_VEOF] = k_termios->c_cc[canon ? VEOF : VMIN]; \
146 k_termio.c_cc[_VEOL] = k_termios->c_cc[canon ? VEOL : VTIME]; \
147 k_termio.c_cc[_VEOL2] = k_termios->c_cc[VEOL2]; \
148 k_termio.c_cc[_VSWTC] = k_termios->c_cc[VSWTC]; \
150 copy_to_user(u_termio, &k_termio, sizeof(k_termio)); \
153 #define user_termios_to_kernel_termios(k, u) \
154 copy_from_user(k, u, sizeof(struct termios))
156 #define kernel_termios_to_user_termios(u, k) \
157 copy_to_user(u, k, sizeof(struct termios))
159 #endif /* __KERNEL__ */
161 #endif /* _ALPHA_TERMIOS_H */