aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300/include/uapi/asm/termios.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mn10300/include/uapi/asm/termios.h')
-rw-r--r--arch/mn10300/include/uapi/asm/termios.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/arch/mn10300/include/uapi/asm/termios.h b/arch/mn10300/include/uapi/asm/termios.h
new file mode 100644
index 000000000000..11d3cc9d3162
--- /dev/null
+++ b/arch/mn10300/include/uapi/asm/termios.h
@@ -0,0 +1,83 @@
1#ifndef _UAPI_ASM_TERMIOS_H
2#define _UAPI_ASM_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24
25/* modem lines */
26#define TIOCM_LE 0x001
27#define TIOCM_DTR 0x002
28#define TIOCM_RTS 0x004
29#define TIOCM_ST 0x008
30#define TIOCM_SR 0x010
31#define TIOCM_CTS 0x020
32#define TIOCM_CAR 0x040
33#define TIOCM_RNG 0x080
34#define TIOCM_DSR 0x100
35#define TIOCM_CD TIOCM_CAR
36#define TIOCM_RI TIOCM_RNG
37#define TIOCM_OUT1 0x2000
38#define TIOCM_OUT2 0x4000
39#define TIOCM_LOOP 0x8000
40
41#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */
42
43/*
44 * Translate a "termio" structure into a "termios". Ugh.
45 */
46#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
47 unsigned short __tmp; \
48 get_user(__tmp, &(termio)->x); \
49 *(unsigned short *) &(termios)->x = __tmp; \
50}
51
52#define user_termio_to_kernel_termios(termios, termio) \
53({ \
54 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
55 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
56 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
57 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
58 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
59})
60
61/*
62 * Translate a "termios" structure into a "termio". Ugh.
63 */
64#define kernel_termios_to_user_termio(termio, termios) \
65({ \
66 put_user((termios)->c_iflag, &(termio)->c_iflag); \
67 put_user((termios)->c_oflag, &(termio)->c_oflag); \
68 put_user((termios)->c_cflag, &(termio)->c_cflag); \
69 put_user((termios)->c_lflag, &(termio)->c_lflag); \
70 put_user((termios)->c_line, &(termio)->c_line); \
71 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
72})
73
74#define user_termios_to_kernel_termios(k, u) \
75 copy_from_user(k, u, sizeof(struct termios2))
76#define kernel_termios_to_user_termios(u, k) \
77 copy_to_user(u, k, sizeof(struct termios2))
78#define user_termios_to_kernel_termios_1(k, u) \
79 copy_from_user(k, u, sizeof(struct termios))
80#define kernel_termios_to_user_termios_1(u, k) \
81 copy_to_user(u, k, sizeof(struct termios))
82
83#endif /* _UAPI_ASM_TERMIOS_H */