xref: /NextBSD/sys/sys/mach/device/tty_status.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.5.3.2  92/04/30  11:49:34  bernadat
27  * 	16-Apr-92  emcmanus at gr.osf.org
28  * 	Define TOOB_FLUSHED.
29  * 	[92/04/22  10:00:03  bernadat]
30  *
31  * Revision 2.5.3.1  92/03/28  10:05:07  jeffreyh
32  * 	04-Mar-92  emcmanus at gr.osf.org
33  * 		New tt_flags bits in TTY_STATUS request: TF_OUT_OF_BAND, TF_INPCK.
34  * 		New device_set/get_status requests: TTY_OUT_OF_BAND, TTY_DRAIN,
35  * 		and corresponding support definitions.
36  * 	[92/03/10  07:56:17  bernadat]
37  *
38  * Revision 2.5  91/05/14  16:02:15  mrt
39  * 	Correcting copyright
40  *
41  * Revision 2.4  91/02/05  17:10:33  mrt
42  * 	Changed to new Mach copyright
43  * 	[91/01/31  17:31:01  mrt]
44  *
45  * Revision 2.3  90/12/05  23:28:49  af
46  * 	Merge problems.
47  *
48  * Revision 2.2  90/12/05  20:42:12  af
49  * 	Created by dbg, I believe.  Added a couple of modem switches.
50  * 	[90/11/13            af]
51  *
52  */
53 /* CMU_ENDHIST */
54 /*
55  * Mach Operating System
56  * Copyright (c) 1991,1990 Carnegie Mellon University
57  * All Rights Reserved.
58  *
59  * Permission to use, copy, modify and distribute this software and its
60  * documentation is hereby granted, provided that both the copyright
61  * notice and this permission notice appear in all copies of the
62  * software, derivative works or modified versions, and any portions
63  * thereof, and that both notices appear in supporting documentation.
64  *
65  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
66  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
67  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
68  *
69  * Carnegie Mellon requests users of this software to return to
70  *
71  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
72  *  School of Computer Science
73  *  Carnegie Mellon University
74  *  Pittsburgh PA 15213-3890
75  *
76  * any improvements or extensions that they make and grant Carnegie Mellon
77  * the rights to redistribute these changes.
78  */
79 /*
80  */
81 /*
82  *	Author: David B. Golub, Carnegie Mellon University
83  *	Date: 	ll/90
84  *
85  * 	Status information for tty.
86  */
87 
88 #include <device/ds_status.h>
89 
90 struct tty_status {
91 	int	tt_ispeed;		/* input speed */
92 	int	tt_ospeed;		/* output speed */
93 	int	tt_breakc;		/* character to deliver when break
94 					   detected on line */
95 	int	tt_flags;		/* mode flags */
96 };
97 #define	TTY_STATUS_COUNT	(sizeof(struct tty_status)/sizeof(int))
98 #define	TTY_STATUS_COMPAT	(dev_flavor_t)(('t'<<16) + 1)
99 #define	TTY_STATUS		(dev_flavor_t)(('t'<<16) + 1)
100 #define	TTY_STATUS_NEW		(dev_flavor_t)(('t'<<16) + 11)
101 
102 /*
103  * Flags
104  */
105 #define	TF_TANDEM	0x00000001	/* send stop character when input
106 					   queue full */
107 #define	TF_ODDP		0x00000002	/* get/send odd parity */
108 #define	TF_EVENP	0x00000004	/* get/send even parity */
109 #define	TF_ANYP		(TF_ODDP|TF_EVENP)
110 					/* get any parity/send none */
111 #define	TF_LITOUT	0x00000008	/* output all 8 bits
112 					   otherwise, characters >= 0x80
113 					   are time delays	XXX */
114 #define	TF_MDMBUF	0x00000010	/* start/stop output on carrier
115 					   interrupt
116 					   otherwise, dropping carrier
117 					   hangs up line */
118 #define	TF_NOHANG	0x00000020	/* no hangup signal on carrier drop */
119 #define	TF_HUPCLS	0x00000040	/* hang up (outgoing) on last close */
120 
121 /*
122  * Read-only flags - information about device
123  */
124 #define	TF_ECHO		0x00000080	/* device wants user to echo input */
125 #define	TF_CRMOD	0x00000100	/* device wants \r\n, not \n */
126 #define	TF_XTABS	0x00000200	/* device does not understand tabs */
127 
128 #define TF_OUT_OF_BAND	0x00000400	/* enable out-of-band notification */
129 #define TF_INPCK	0x00000800	/* check parity of incoming chars */
130 
131 #define TF_CRTSCTS	0x00001000	/* do RTS/CTS hardware flow control  */
132 #define TF_8BIT		0x00002000	/* 8 bit? If not, then 7-bit */
133 #define TF_READ		0x00004000	/* Enable receiver? */
134 
135 /*
136  * Modem control
137  */
138 #define	TTY_MODEM_COUNT		(1)	/* one integer */
139 #define	TTY_MODEM		(dev_flavor_t)(('t'<<16) + 2)
140 
141 #define	TM_LE		0x0001		/* line enable */
142 #define	TM_DTR		0x0002		/* data terminal ready */
143 #define	TM_RTS		0x0004		/* request to send */
144 #define	TM_ST		0x0008		/* secondary transmit */
145 #define	TM_SR		0x0010		/* secondary receive */
146 #define	TM_CTS		0x0020		/* clear to send */
147 #define	TM_CAR		0x0040		/* carrier detect */
148 #define	TM_RNG		0x0080		/* ring */
149 #define	TM_DSR		0x0100		/* data set ready */
150 
151 #define	TM_BRK		0x0200		/* set line break (internal) */
152 #define	TM_HUP		0x0000		/* close line (internal) */
153 
154 /*
155  * Other controls
156  */
157 #define	TTY_FLUSH_COUNT		(1)	/* one integer - D_READ|D_WRITE */
158 #define	TTY_FLUSH		(dev_flavor_t)(('t'<<16) + 3)
159 					/* flush input or output */
160 #define	TTY_STOP		(dev_flavor_t)(('t'<<16) + 4)
161 					/* stop output */
162 #define	TTY_START		(dev_flavor_t)(('t'<<16) + 5)
163 					/* start output */
164 #define	TTY_SET_BREAK		(dev_flavor_t)(('t'<<16) + 6)
165 					/* set break condition */
166 #define	TTY_CLEAR_BREAK		(dev_flavor_t)(('t'<<16) + 7)
167 					/* clear break condition */
168 #define TTY_SET_TRANSLATION	(dev_flavor_t)(('t'<<16) + 8)
169 					/* set translation table */
170 #define TTY_NMODEM		(('t'<<16) + 9)
171 					/* set/clr soft carrier */
172 
173 struct tty_out_of_band {
174 	int toob_event;		/* event bitmask */
175 	int toob_arg;		/* argument for first event */
176 };
177 #define TTY_OUT_OF_BAND_COUNT	(sizeof(struct tty_out_of_band)/sizeof(int))
178 #define TTY_OUT_OF_BAND		(('t'<<16) + 9)
179 					/* get out of band events */
180 #define TOOB_NO_EVENT		0
181 #define TOOB_BREAK		1
182 #define TOOB_BAD_PARITY		2
183 #define TOOB_FLUSHED		3
184 #define TOOB_CARRIER		4
185 
186 #define TTY_DRAIN		(('t'<<16) + 10)
187 					/* wait for output to drain */
188 
189 /*
190  * WARNING - TTY_STATUS is (('t'<<16) + 11) due to i/f changes...
191  */
192