1 /* $Id: termios.h,v 1.29 1999/03/25 09:11:18 davem Exp $ */
2 #ifndef _SPARC_TERMIOS_H
3 #define _SPARC_TERMIOS_H
5 #include <asm/ioctls.h>
6 #include <asm/termbits.h>
8 #if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS)
34 #endif /* __KERNEL__ */
36 struct sunos_ttysize
{
37 int st_lines
; /* Lines on the terminal */
38 int st_columns
; /* Columns on the terminal */
41 /* Used for packet mode */
42 #define TIOCPKT_DATA 0
43 #define TIOCPKT_FLUSHREAD 1
44 #define TIOCPKT_FLUSHWRITE 2
45 #define TIOCPKT_STOP 4
46 #define TIOCPKT_START 8
47 #define TIOCPKT_NOSTOP 16
48 #define TIOCPKT_DOSTOP 32
51 unsigned short ws_row
;
52 unsigned short ws_col
;
53 unsigned short ws_xpixel
;
54 unsigned short ws_ypixel
;
57 /* line disciplines */
66 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
67 #define N_R3964 9 /* Reserved for Simatic R3964 module */
68 #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
69 #define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
70 #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
71 #define N_HDLC 13 /* synchronous HDLC */
76 * c_cc characters in the termio structure. Oh, how I love being
77 * backwardly compatible. Notice that character 4 and 5 are
78 * interpreted differently depending on whether ICANON is set in
79 * c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
80 * as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
81 * is compatible with sysV)...
87 /* intr=^C quit=^\ erase=del kill=^U
88 eof=^D eol=\0 eol2=\0 sxtc=\0
89 start=^Q stop=^S susp=^Z dsusp=^Y
90 reprint=^R discard=^U werase=^W lnext=^V
93 #define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001\000"
96 * Translate a "termio" structure into a "termios". Ugh.
98 #define user_termio_to_kernel_termios(termios, termio) \
100 unsigned short tmp; \
101 get_user(tmp, &(termio)->c_iflag); \
102 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
103 get_user(tmp, &(termio)->c_oflag); \
104 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
105 get_user(tmp, &(termio)->c_cflag); \
106 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
107 get_user(tmp, &(termio)->c_lflag); \
108 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
109 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
114 * Translate a "termios" structure into a "termio". Ugh.
116 * Note the "fun" _VMIN overloading.
118 #define kernel_termios_to_user_termio(termio, termios) \
120 put_user((termios)->c_iflag, &(termio)->c_iflag); \
121 put_user((termios)->c_oflag, &(termio)->c_oflag); \
122 put_user((termios)->c_cflag, &(termio)->c_cflag); \
123 put_user((termios)->c_lflag, &(termio)->c_lflag); \
124 put_user((termios)->c_line, &(termio)->c_line); \
125 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
126 if (!((termios)->c_lflag & ICANON)) { \
127 put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
128 put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
133 #define user_termios_to_kernel_termios(k, u) \
135 get_user((k)->c_iflag, &(u)->c_iflag); \
136 get_user((k)->c_oflag, &(u)->c_oflag); \
137 get_user((k)->c_cflag, &(u)->c_cflag); \
138 get_user((k)->c_lflag, &(u)->c_lflag); \
139 get_user((k)->c_line, &(u)->c_line); \
140 copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
141 if((k)->c_lflag & ICANON) { \
142 get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
143 get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
145 get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
146 get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
151 #define kernel_termios_to_user_termios(u, k) \
153 put_user((k)->c_iflag, &(u)->c_iflag); \
154 put_user((k)->c_oflag, &(u)->c_oflag); \
155 put_user((k)->c_cflag, &(u)->c_cflag); \
156 put_user((k)->c_lflag, &(u)->c_lflag); \
157 put_user((k)->c_line, &(u)->c_line); \
158 copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
159 if(!((k)->c_lflag & ICANON)) { \
160 put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
161 put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
163 put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
164 put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
169 #endif /* __KERNEL__ */
171 #endif /* _SPARC_TERMIOS_H */