1 |
1276 |
phoenix |
/* $Id: termios.h,v 1.1.1.1 2004-04-15 03:01:07 phoenix Exp $ */
|
2 |
|
|
#ifndef _SPARC64_TERMIOS_H
|
3 |
|
|
#define _SPARC64_TERMIOS_H
|
4 |
|
|
|
5 |
|
|
#include <asm/ioctls.h>
|
6 |
|
|
#include <asm/termbits.h>
|
7 |
|
|
|
8 |
|
|
#if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS)
|
9 |
|
|
struct sgttyb {
|
10 |
|
|
char sg_ispeed;
|
11 |
|
|
char sg_ospeed;
|
12 |
|
|
char sg_erase;
|
13 |
|
|
char sg_kill;
|
14 |
|
|
short sg_flags;
|
15 |
|
|
};
|
16 |
|
|
|
17 |
|
|
struct tchars {
|
18 |
|
|
char t_intrc;
|
19 |
|
|
char t_quitc;
|
20 |
|
|
char t_startc;
|
21 |
|
|
char t_stopc;
|
22 |
|
|
char t_eofc;
|
23 |
|
|
char t_brkc;
|
24 |
|
|
};
|
25 |
|
|
|
26 |
|
|
struct ltchars {
|
27 |
|
|
char t_suspc;
|
28 |
|
|
char t_dsuspc;
|
29 |
|
|
char t_rprntc;
|
30 |
|
|
char t_flushc;
|
31 |
|
|
char t_werasc;
|
32 |
|
|
char t_lnextc;
|
33 |
|
|
};
|
34 |
|
|
#endif /* __KERNEL__ */
|
35 |
|
|
|
36 |
|
|
struct sunos_ttysize {
|
37 |
|
|
int st_lines; /* Lines on the terminal */
|
38 |
|
|
int st_columns; /* Columns on the terminal */
|
39 |
|
|
};
|
40 |
|
|
|
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
|
49 |
|
|
|
50 |
|
|
struct winsize {
|
51 |
|
|
unsigned short ws_row;
|
52 |
|
|
unsigned short ws_col;
|
53 |
|
|
unsigned short ws_xpixel;
|
54 |
|
|
unsigned short ws_ypixel;
|
55 |
|
|
};
|
56 |
|
|
|
57 |
|
|
/* line disciplines */
|
58 |
|
|
#define N_TTY 0
|
59 |
|
|
#define N_SLIP 1
|
60 |
|
|
#define N_MOUSE 2
|
61 |
|
|
#define N_PPP 3
|
62 |
|
|
#define N_STRIP 4
|
63 |
|
|
#define N_AX25 5
|
64 |
|
|
#define N_X25 6
|
65 |
|
|
#define N_6PACK 7
|
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://irda.sourceforge.net/ */
|
70 |
|
|
#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
|
71 |
|
|
#define N_HDLC 13 /* synchronous HDLC */
|
72 |
|
|
#define N_SYNC_PPP 14 /* synchronous PPP */
|
73 |
|
|
#define N_HCI 15 /* Bluetooth HCI UART */
|
74 |
|
|
|
75 |
|
|
#ifdef __KERNEL__
|
76 |
|
|
|
77 |
|
|
/*
|
78 |
|
|
* c_cc characters in the termio structure. Oh, how I love being
|
79 |
|
|
* backwardly compatible. Notice that character 4 and 5 are
|
80 |
|
|
* interpreted differently depending on whether ICANON is set in
|
81 |
|
|
* c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
|
82 |
|
|
* as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
|
83 |
|
|
* is compatible with sysV)...
|
84 |
|
|
*/
|
85 |
|
|
#define _VMIN 4
|
86 |
|
|
#define _VTIME 5
|
87 |
|
|
|
88 |
|
|
/* intr=^C quit=^\ erase=del kill=^U
|
89 |
|
|
eof=^D eol=\0 eol2=\0 sxtc=\0
|
90 |
|
|
start=^Q stop=^S susp=^Z dsusp=^Y
|
91 |
|
|
reprint=^R discard=^U werase=^W lnext=^V
|
92 |
|
|
vmin=\1 vtime=\0
|
93 |
|
|
*/
|
94 |
|
|
#define INIT_C_CC "\003\034\177\025\004\000\000\000\021\023\032\031\022\025\027\026\001\000"
|
95 |
|
|
|
96 |
|
|
/*
|
97 |
|
|
* Translate a "termio" structure into a "termios". Ugh.
|
98 |
|
|
*/
|
99 |
|
|
#define user_termio_to_kernel_termios(termios, termio) \
|
100 |
|
|
({ \
|
101 |
|
|
unsigned short tmp; \
|
102 |
|
|
get_user(tmp, &(termio)->c_iflag); \
|
103 |
|
|
(termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
|
104 |
|
|
get_user(tmp, &(termio)->c_oflag); \
|
105 |
|
|
(termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
|
106 |
|
|
get_user(tmp, &(termio)->c_cflag); \
|
107 |
|
|
(termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
|
108 |
|
|
get_user(tmp, &(termio)->c_lflag); \
|
109 |
|
|
(termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
|
110 |
|
|
copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
|
111 |
|
|
0; \
|
112 |
|
|
})
|
113 |
|
|
|
114 |
|
|
/*
|
115 |
|
|
* Translate a "termios" structure into a "termio". Ugh.
|
116 |
|
|
*
|
117 |
|
|
* Note the "fun" _VMIN overloading.
|
118 |
|
|
*/
|
119 |
|
|
#define kernel_termios_to_user_termio(termio, termios) \
|
120 |
|
|
({ \
|
121 |
|
|
put_user((termios)->c_iflag, &(termio)->c_iflag); \
|
122 |
|
|
put_user((termios)->c_oflag, &(termio)->c_oflag); \
|
123 |
|
|
put_user((termios)->c_cflag, &(termio)->c_cflag); \
|
124 |
|
|
put_user((termios)->c_lflag, &(termio)->c_lflag); \
|
125 |
|
|
put_user((termios)->c_line, &(termio)->c_line); \
|
126 |
|
|
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
|
127 |
|
|
if (!((termios)->c_lflag & ICANON)) { \
|
128 |
|
|
put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
|
129 |
|
|
put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
|
130 |
|
|
} \
|
131 |
|
|
0; \
|
132 |
|
|
})
|
133 |
|
|
|
134 |
|
|
#define user_termios_to_kernel_termios(k, u) \
|
135 |
|
|
({ \
|
136 |
|
|
get_user((k)->c_iflag, &(u)->c_iflag); \
|
137 |
|
|
get_user((k)->c_oflag, &(u)->c_oflag); \
|
138 |
|
|
get_user((k)->c_cflag, &(u)->c_cflag); \
|
139 |
|
|
get_user((k)->c_lflag, &(u)->c_lflag); \
|
140 |
|
|
get_user((k)->c_line, &(u)->c_line); \
|
141 |
|
|
copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
|
142 |
|
|
if((k)->c_lflag & ICANON) { \
|
143 |
|
|
get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
|
144 |
|
|
get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
|
145 |
|
|
} else { \
|
146 |
|
|
get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
|
147 |
|
|
get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
|
148 |
|
|
} \
|
149 |
|
|
0; \
|
150 |
|
|
})
|
151 |
|
|
|
152 |
|
|
#define kernel_termios_to_user_termios(u, k) \
|
153 |
|
|
({ \
|
154 |
|
|
put_user((k)->c_iflag, &(u)->c_iflag); \
|
155 |
|
|
put_user((k)->c_oflag, &(u)->c_oflag); \
|
156 |
|
|
put_user((k)->c_cflag, &(u)->c_cflag); \
|
157 |
|
|
put_user((k)->c_lflag, &(u)->c_lflag); \
|
158 |
|
|
put_user((k)->c_line, &(u)->c_line); \
|
159 |
|
|
copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
|
160 |
|
|
if(!((k)->c_lflag & ICANON)) { \
|
161 |
|
|
put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
|
162 |
|
|
put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
|
163 |
|
|
} else { \
|
164 |
|
|
put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
|
165 |
|
|
put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
|
166 |
|
|
} \
|
167 |
|
|
0; \
|
168 |
|
|
})
|
169 |
|
|
|
170 |
|
|
#endif /* __KERNEL__ */
|
171 |
|
|
|
172 |
|
|
#endif /* _SPARC64_TERMIOS_H */
|