1 #ifndef _NIOS_TERMIOS_H
2 #define _NIOS_TERMIOS_H
4 /*--------------------------------------------------------------------
6 * include/asm-nios2nommu/termios.h
8 * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
10 * Copyright (C) 2004 Microtronix Datacom Ltd
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
23 * Jan/20/2004 dgt NiosII
25 ---------------------------------------------------------------------*/
28 #include <asm/termbits.h>
29 #include <asm/ioctls.h>
32 unsigned short ws_row
;
33 unsigned short ws_col
;
34 unsigned short ws_xpixel
;
35 unsigned short ws_ypixel
;
40 unsigned short c_iflag
; /* input mode flags */
41 unsigned short c_oflag
; /* output mode flags */
42 unsigned short c_cflag
; /* control mode flags */
43 unsigned short c_lflag
; /* local mode flags */
44 unsigned char c_line
; /* line discipline */
45 unsigned char c_cc
[NCC
]; /* control characters */
49 /* intr=^C quit=^| erase=del kill=^U
50 eof=^D vtime=\0 vmin=\1 sxtc=\0
51 start=^Q stop=^S susp=^Z eol=\0
52 reprint=^R discard=^U werase=^W lnext=^V
55 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
59 #define TIOCM_LE 0x001
60 #define TIOCM_DTR 0x002
61 #define TIOCM_RTS 0x004
62 #define TIOCM_ST 0x008
63 #define TIOCM_SR 0x010
64 #define TIOCM_CTS 0x020
65 #define TIOCM_CAR 0x040
66 #define TIOCM_RNG 0x080
67 #define TIOCM_DSR 0x100
68 #define TIOCM_CD TIOCM_CAR
69 #define TIOCM_RI TIOCM_RNG
70 #define TIOCM_OUT1 0x2000
71 #define TIOCM_OUT2 0x4000
72 #define TIOCM_LOOP 0x8000
74 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
76 /* line disciplines */
83 #define N_X25 6 /* X.25 async */
85 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
86 #define N_R3964 9 /* Reserved for Simatic R3964 module */
87 #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
88 #define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
89 #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
90 #define N_HDLC 13 /* synchronous HDLC */
92 #define N_HCI 15 /* Bluetooth HCI UART */
97 * Translate a "termio" structure into a "termios". Ugh.
99 #define user_termio_to_kernel_termios(termios, termio) \
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 get_user((termios)->c_line, &(termio)->c_line); \
111 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
115 * Translate a "termios" structure into a "termio". Ugh.
117 #define kernel_termios_to_user_termio(termio, termios) \
119 put_user((termios)->c_iflag, &(termio)->c_iflag); \
120 put_user((termios)->c_oflag, &(termio)->c_oflag); \
121 put_user((termios)->c_cflag, &(termio)->c_cflag); \
122 put_user((termios)->c_lflag, &(termio)->c_lflag); \
123 put_user((termios)->c_line, &(termio)->c_line); \
124 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
127 #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
128 #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
130 #endif /* __KERNEL__ */
132 #endif /* _NIOS_TERMIOS_H */