1 /* $OpenBSD: hpux_termio.h,v 1.5 2003/06/02 23:28:00 millert Exp $ */
2 /* $NetBSD: hpux_termio.h,v 1.7 1997/04/01 19:59:04 scottr Exp $ */
3
4 /*
5 * Copyright (c) 1988 University of Utah.
6 * Copyright (c) 1990, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
10 * the Systems Programming Group of the University of Utah Computer
11 * Science Department.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: Utah $Hdr: hpux_termio.h 1.1 90/07/09$
38 *
39 * @(#)hpux_termio.h 8.1 (Berkeley) 6/10/93
40 */
41
42 /* HP-UX termio stuff */
43
44 #define HPUXNCC 8
45
46 /* control characters */
47 #define HPUXVINTR 0
48 #define HPUXVQUIT 1
49 #define HPUXVERASE 2
50 #define HPUXVKILL 3
51 #define HPUXVEOF 4
52 #define HPUXVEOL 5
53 #define HPUXVMIN 4
54 #define HPUXVTIME 5
55 #define HPUXVEOL2 6
56 #define HPUXVSWTCH 7
57
58 /* input modes */
59 #define TIO_IGNBRK 0x00000001 /* 0000001 */
60 #define TIO_BRKINT 0x00000002 /* 0000002 */
61 #define TIO_IGNPAR 0x00000004 /* 0000004 */
62 #define TIO_PARMRK 0x00000008 /* 0000010 */
63 #define TIO_INPCK 0x00000010 /* 0000020 */
64 #define TIO_ISTRIP 0x00000020 /* 0000040 */
65 #define TIO_INLCR 0x00000040 /* 0000100 */
66 #define TIO_IGNCR 0x00000080 /* 0000200 */
67 #define TIO_ICRNL 0x00000100 /* 0000400 */
68 #define TIO_IUCLC 0x00000200 /* 0001000 */
69 #define TIO_IXON 0x00000400 /* 0002000 */
70 #define TIO_IXANY 0x00000800 /* 0004000 */
71 #define TIO_IXOFF 0x00001000 /* 0010000 */
72 #define TIO_IENQAK 0x00002000 /* 0020000 */
73
74 /* output modes */
75 #define TIO_OPOST 0x00000001 /* 0000001 */
76 #define TIO_OLCUC 0x00000002 /* 0000002 */
77 #define TIO_ONLCR 0x00000004 /* 0000004 */
78 #define TIO_OCRNL 0x00000008 /* 0000010 */
79 #define TIO_ONOCR 0x00000010 /* 0000020 */
80 #define TIO_ONLRET 0x00000020 /* 0000040 */
81 #define TIO_OFILL 0x00000040 /* 0000100 */
82 #define TIO_OFDEL 0x00000080 /* 0000200 */
83 #define TIO_NLDLY 0x00000100 /* 0000400 */
84 #define TIO_NL0 0
85 #define TIO_NL1 0x00000100 /* 0000400 */
86 #define TIO_CRDLY 0x00000600 /* 0003000 */
87 #define TIO_CR0 0
88 #define TIO_CR1 0x00000200 /* 0001000 */
89 #define TIO_CR2 0x00000400 /* 0002000 */
90 #define TIO_CR3 0x00000600 /* 0003000 */
91 #define TIO_TABDLY 0x00001800 /* 0014000 */
92 #define TIO_TAB0 0
93 #define TIO_TAB1 0x00000800 /* 0004000 */
94 #define TIO_TAB2 0x00001000 /* 0010000 */
95 #define TIO_TAB3 0x00001800 /* 0014000 */
96 #define TIO_BSDLY 0x00002000 /* 0020000 */
97 #define TIO_BS0 0
98 #define TIO_BS1 0x00002000 /* 0020000 */
99 #define TIO_VTDLY 0x00004000 /* 0040000 */
100 #define TIO_VT0 0
101 #define TIO_VT1 0x00004000 /* 0040000 */
102 #define TIO_FFDLY 0x00008000 /* 0100000 */
103 #define TIO_FF0 0
104 #define TIO_FF1 0x00008000 /* 0100000 */
105
106 /* control modes */
107 #define TIO_CBAUD 0x0000001f /* 0000037 */
108 #define TIO_B0 0
109 #define TIO_B50 0x00000001 /* 0000001 */
110 #define TIO_B75 0x00000002 /* 0000002 */
111 #define TIO_B110 0x00000003 /* 0000003 */
112 #define TIO_B134 0x00000004 /* 0000004 */
113 #define TIO_B150 0x00000005 /* 0000005 */
114 #define TIO_B200 0x00000006 /* 0000006 */
115 #define TIO_B300 0x00000007 /* 0000007 */
116 #define TIO_B600 0x00000008 /* 0000010 */
117 #define TIO_B900 0x00000009 /* 0000011 */
118 #define TIO_B1200 0x0000000a /* 0000012 */
119 #define TIO_B1800 0x0000000b /* 0000013 */
120 #define TIO_B2400 0x0000000c /* 0000014 */
121 #define TIO_B3600 0x0000000d /* 0000015 */
122 #define TIO_B4800 0x0000000e /* 0000016 */
123 #define TIO_B7200 0x0000000f /* 0000017 */
124 #define TIO_B9600 0x00000010 /* 0000020 */
125 #define TIO_B19200 0x00000011 /* 0000021 */
126 #define TIO_B38400 0x00000012 /* 0000022 */
127 #define TIO_EXTA 0x0000001e /* 0000036 */
128 #define TIO_EXTB 0x0000001f /* 0000037 */
129 #define TIO_CSIZE 0x00000060 /* 0000140 */
130 #define TIO_CS5 0
131 #define TIO_CS6 0x00000020 /* 0000040 */
132 #define TIO_CS7 0x00000040 /* 0000100 */
133 #define TIO_CS8 0x00000060 /* 0000140 */
134 #define TIO_CSTOPB 0x00000080 /* 0000200 */
135 #define TIO_CREAD 0x00000100 /* 0000400 */
136 #define TIO_PARENB 0x00000200 /* 0001000 */
137 #define TIO_PARODD 0x00000400 /* 0002000 */
138 #define TIO_HUPCL 0x00000800 /* 0004000 */
139 #define TIO_CLOCAL 0x00001000 /* 0010000 */
140 #define TIO_CRTS 0x00002000 /* 0020000 */ /* Obsolete */
141
142 /* line discipline 0 modes */
143 #define TIO_ISIG 0x00000001 /* 0000001 */
144 #define TIO_ICANON 0x00000002 /* 0000002 */
145 #define TIO_XCASE 0x00000004 /* 0000004 */
146 #define TIO_ECHO 0x00000008 /* 0000010 */
147 #define TIO_ECHOE 0x00000010 /* 0000020 */
148 #define TIO_ECHOK 0x00000020 /* 0000040 */
149 #define TIO_ECHONL 0x00000040 /* 0000100 */
150 #define TIO_NOFLSH 0x00000080 /* 0000200 */
151
152 struct hpux_termio {
153 u_short c_iflag; /* input modes */
154 u_short c_oflag; /* output modes */
155 u_short c_cflag; /* control modes */
156 u_short c_lflag; /* line discipline modes */
157 char c_line; /* line discipline */
158 u_char c_cc[HPUXNCC]; /* control chars */
159 };
160
161 #define HPUXTCGETA _IOR('T', 1, struct hpux_termio)
162 #define HPUXTCSETA _IOW('T', 2, struct hpux_termio)
163 #define HPUXTCSETAW _IOW('T', 3, struct hpux_termio)
164 #define HPUXTCSETAF _IOW('T', 4, struct hpux_termio)
165
166 /* HP-UX termios stuff */
167
168 #define HPUXNCCS 16
169
170 /* control characters */
171 #define HPUXVMINS 11 /* different than termio */
172 #define HPUXVTIMES 12 /* different than termio */
173 #define HPUXVSUSP 13
174 #define HPUXVSTART 14
175 #define HPUXVSTOP 15
176
177 struct hpux_termios {
178 u_int c_iflag; /* input modes */
179 u_int c_oflag; /* output modes */
180 u_int c_cflag; /* control modes */
181 u_int c_lflag; /* line discipline modes */
182 u_int c_reserved; /* future use */
183 u_char c_cc[HPUXNCCS]; /* control chars */
184 };
185
186 #define HPUXTCGETATTR _IOR('T', 16, struct hpux_termios)
187 #define HPUXTCSETATTR _IOW('T', 17, struct hpux_termios)
188 #define HPUXTCSETATTRD _IOW('T', 18, struct hpux_termios)
189 #define HPUXTCSETATTRF _IOW('T', 19, struct hpux_termios)
190
191 #ifdef _KERNEL
192 struct termio;
193 struct termios;
194
195 int hpux_termio(int, int, caddr_t, struct proc *);
196 void termiototermios(struct hpux_termio *, struct hpux_termios *,
197 struct termios *);
198 void termiostotermio(struct hpux_termios *, struct hpux_termio *);
199 int bsdtohpuxbaud(long);
200 int hpuxtobsdbaud(int);
201 int getsettty(struct proc *, int, int, caddr_t);
202 #endif /* _KERNEL */