xref: /netbsd-src/sys/compat/linux/common/linux_termios.h (revision 481fca6e59249d8ffcf24fef7cfbe7b131bfb080)
1 /*	$NetBSD: linux_termios.h,v 1.5 1998/12/15 19:31:40 itohy Exp $	*/
2 
3 /*-
4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Eric Haszlakiewicz.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _LINUX_TERMIOS_H
40 #define _LINUX_TERMIOS_H
41 
42 struct linux_winsize {
43 	unsigned short ws_row;
44 	unsigned short ws_col;
45 	unsigned short ws_xpixel;
46 	unsigned short ws_ypixel;
47 };
48 
49 #define LINUX_NCC 8
50 struct linux_termio {
51 	unsigned short c_iflag;
52 	unsigned short c_oflag;
53 	unsigned short c_cflag;
54 	unsigned short c_lflag;
55 	unsigned char c_line;
56 	unsigned char c_cc[LINUX_NCC];
57 };
58 
59 #define LINUX_NCCS 19
60 struct linux_termios {
61 	linux_tcflag_t	c_iflag;
62 	linux_tcflag_t	c_oflag;
63 	linux_tcflag_t	c_cflag;
64 	linux_tcflag_t	c_lflag;
65 	linux_cc_t	c_line;
66 	linux_cc_t	c_cc[LINUX_NCCS];
67 #if 0
68 	/* Present on some linux ports but unused: */
69 	linux_speed_t	c_ispeed;
70 	linux_speed_t	c_ospeed;
71 #endif
72 };
73 
74 /* Linux modem line defines.. not sure if they'll be used */
75 #define LINUX_TIOCM_LE		0x0001
76 #define LINUX_TIOCM_DTR		0x0002
77 #define LINUX_TIOCM_RTS		0x0004
78 #define LINUX_TIOCM_ST		0x0008
79 #define LINUX_TIOCM_SR		0x0010
80 #define LINUX_TIOCM_CTS		0x0020
81 #define LINUX_TIOCM_CAR		0x0040
82 #define LINUX_TIOCM_RNG		0x0080
83 #define LINUX_TIOCM_DSR		0x0100
84 #define LINUX_TIOCM_CD		LINUX_TIOCM_CAR
85 #define LINUX_TIOCM_RI 		LINUX_TIOCM_RNG
86 
87 #define	LINUX_TCIFLUSH		0
88 #define	LINUX_TCOFLUSH		1
89 #define	LINUX_TCIOFLUSH		2
90 
91 #define	LINUX_TCOOFF		0
92 #define	LINUX_TCOON		1
93 #define	LINUX_TCIOFF		2
94 #define	LINUX_TCION		3
95 
96 #define	LINUX_TCSANOW		0
97 #define	LINUX_TCSADRAIN		1
98 #define	LINUX_TCSAFLUSH		2
99 
100 /* Linux line disciplines */
101 #define LINUX_N_TTY		0
102 #define LINUX_N_SLIP		1
103 #define LINUX_N_MOUSE		2
104 #define LINUX_N_PPP		3
105 #define	LINUX_N_STRIP		4
106 
107 /* currently unused: */
108 #define	LINUX_N_AX25		5
109 #define	LINUX_N_X25		6
110 #define	LINUX_N_6PACK		7
111 
112 #if defined(__i386__)
113 #include <compat/linux/arch/i386/linux_termios.h>
114 #elif defined(__m68k__)
115 #include <compat/linux/arch/m68k/linux_termios.h>
116 #elif defined(__alpha__)
117 #include <compat/linux/arch/alpha/linux_termios.h>
118 #else
119 #error Undefined linux_termios.h machine type.
120 #endif
121 #endif /* !_LINUX_TERMIOS_H */
122