1
2
3
4
5
6
7
8
9#ifndef _ASM_TERMIOS_H
10#define _ASM_TERMIOS_H
11
12#include <asm/termbits.h>
13#include <asm/ioctls.h>
14
15struct sgttyb {
16 char sg_ispeed;
17 char sg_ospeed;
18 char sg_erase;
19 char sg_kill;
20 int sg_flags;
21};
22
23struct tchars {
24 char t_intrc;
25 char t_quitc;
26 char t_startc;
27 char t_stopc;
28 char t_eofc;
29 char t_brkc;
30};
31
32struct ltchars {
33 char t_suspc;
34 char t_dsuspc;
35 char t_rprntc;
36 char t_flushc;
37 char t_werasc;
38 char t_lnextc;
39};
40
41
42
43
44struct winsize {
45 unsigned short ws_row;
46 unsigned short ws_col;
47 unsigned short ws_xpixel;
48 unsigned short ws_ypixel;
49};
50
51#define NCC 8
52struct termio {
53 unsigned short c_iflag;
54 unsigned short c_oflag;
55 unsigned short c_cflag;
56 unsigned short c_lflag;
57 char c_line;
58 unsigned char c_cc[NCCS];
59};
60
61#ifdef __KERNEL__
62
63
64
65
66
67
68
69#define INIT_C_CC "\003\034\177\025\1\0\0\0\021\023\032\0\022\017\027\026\004\0"
70#endif
71
72
73#define TIOCM_LE 0x001
74#define TIOCM_DTR 0x002
75#define TIOCM_RTS 0x004
76#define TIOCM_ST 0x010
77#define TIOCM_SR 0x020
78#define TIOCM_CTS 0x040
79#define TIOCM_CAR 0x100
80#define TIOCM_CD TIOCM_CAR
81#define TIOCM_RNG 0x200
82#define TIOCM_RI TIOCM_RNG
83#define TIOCM_DSR 0x400
84#define TIOCM_OUT1 0x2000
85#define TIOCM_OUT2 0x4000
86#define TIOCM_LOOP 0x8000
87
88#define TIOCM_MODEM_BITS TIOCM_OUT2
89
90
91#define N_TTY 0
92#define N_SLIP 1
93#define N_MOUSE 2
94#define N_PPP 3
95#define N_STRIP 4
96#define N_AX25 5
97#define N_X25 6
98#define N_6PACK 7
99#define N_MASC 8
100#define N_R3964 9
101#define N_PROFIBUS_FDL 10
102#define N_IRDA 11
103#define N_SMSBLOCK 12
104#define N_HDLC 13
105#define N_SYNC_PPP 14
106#define N_HCI 15
107
108#ifdef __KERNEL__
109
110#include <linux/string.h>
111
112
113
114
115#define user_termio_to_kernel_termios(termios, termio) \
116({ \
117 unsigned short tmp; \
118 get_user(tmp, &(termio)->c_iflag); \
119 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
120 get_user(tmp, &(termio)->c_oflag); \
121 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
122 get_user(tmp, &(termio)->c_cflag); \
123 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
124 get_user(tmp, &(termio)->c_lflag); \
125 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
126 get_user((termios)->c_line, &(termio)->c_line); \
127 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
128})
129
130
131
132
133#define kernel_termios_to_user_termio(termio, termios) \
134({ \
135 put_user((termios)->c_iflag, &(termio)->c_iflag); \
136 put_user((termios)->c_oflag, &(termio)->c_oflag); \
137 put_user((termios)->c_cflag, &(termio)->c_cflag); \
138 put_user((termios)->c_lflag, &(termio)->c_lflag); \
139 put_user((termios)->c_line, &(termio)->c_line); \
140 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
141})
142
143#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
144#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
145
146#endif
147
148#endif
149