1 #ifndef _SPARC_TERMIOS_H
2 #define _SPARC_TERMIOS_H
4 #include <asm/ioctls.h>
5 #include <asm/termbits.h>
7 #if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS)
33 #endif /* __KERNEL__ */
36 unsigned short ws_row
;
37 unsigned short ws_col
;
38 unsigned short ws_xpixel
;
39 unsigned short ws_ypixel
;
45 * c_cc characters in the termio structure. Oh, how I love being
46 * backwardly compatible. Notice that character 4 and 5 are
47 * interpreted differently depending on whether ICANON is set in
48 * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
49 * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
50 * is compatible with sysV)...
55 /* intr=^C quit=^\ erase=del kill=^U
56 eof=^D eol=\0 eol2=\0 sxtc=\0
57 start=^Q stop=^S susp=^Z dsusp=^Y
58 reprint=^R discard=^U werase=^W lnext=^V
61 #define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001"
64 * Translate a "termio" structure into a "termios". Ugh.
66 #define user_termio_to_kernel_termios(termios, termio) \
70 err = get_user(tmp, &(termio)->c_iflag); \
71 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
72 err |= get_user(tmp, &(termio)->c_oflag); \
73 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
74 err |= get_user(tmp, &(termio)->c_cflag); \
75 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
76 err |= get_user(tmp, &(termio)->c_lflag); \
77 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
78 err |= copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
83 * Translate a "termios" structure into a "termio". Ugh.
85 * Note the "fun" _VMIN overloading.
87 #define kernel_termios_to_user_termio(termio, termios) \
90 err = put_user((termios)->c_iflag, &(termio)->c_iflag); \
91 err |= put_user((termios)->c_oflag, &(termio)->c_oflag); \
92 err |= put_user((termios)->c_cflag, &(termio)->c_cflag); \
93 err |= put_user((termios)->c_lflag, &(termio)->c_lflag); \
94 err |= put_user((termios)->c_line, &(termio)->c_line); \
95 err |= copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
96 if (!((termios)->c_lflag & ICANON)) { \
97 err |= put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
98 err |= put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
103 #define user_termios_to_kernel_termios(k, u) \
106 err = get_user((k)->c_iflag, &(u)->c_iflag); \
107 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
108 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
109 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
110 err |= get_user((k)->c_line, &(u)->c_line); \
111 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
112 if ((k)->c_lflag & ICANON) { \
113 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
114 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
116 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
117 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
119 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
120 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
124 #define kernel_termios_to_user_termios(u, k) \
127 err = put_user((k)->c_iflag, &(u)->c_iflag); \
128 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
129 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
130 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
131 err |= put_user((k)->c_line, &(u)->c_line); \
132 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
133 if (!((k)->c_lflag & ICANON)) { \
134 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
135 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
137 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
138 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
140 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
141 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
145 #define user_termios_to_kernel_termios_1(k, u) \
148 err = get_user((k)->c_iflag, &(u)->c_iflag); \
149 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
150 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
151 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
152 err |= get_user((k)->c_line, &(u)->c_line); \
153 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
154 if ((k)->c_lflag & ICANON) { \
155 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
156 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
158 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
159 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
164 #define kernel_termios_to_user_termios_1(u, k) \
167 err = put_user((k)->c_iflag, &(u)->c_iflag); \
168 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
169 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
170 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
171 err |= put_user((k)->c_line, &(u)->c_line); \
172 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
173 if (!((k)->c_lflag & ICANON)) { \
174 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
175 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
177 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
178 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
183 #endif /* __KERNEL__ */
185 #endif /* _SPARC_TERMIOS_H */