xref: /illumos-gate/usr/src/uts/common/sys/strtty.h (revision b4203d75)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 #ifndef _SYS_STRTTY_H
31 #define	_SYS_STRTTY_H
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * header file for STREAMS TTY subsystem
39  */
40 
41 /*
42  * The t_buf data structure holds information about a message
43  * block and its associated data buffer.  One is used for received
44  * blocks, and another is used for blocks to be transmitted to
45  * a user terminal or a printer.
46  */
47 
48 struct t_buf
49 {
50 	mblk_t *bu_bp;	/* message block pointer */
51 	unsigned char *bu_ptr;	/* data buffer pointer */
52 	ushort_t bu_cnt;	/* data buffer character count */
53 };
54 
55 /*
56  * A tty structure is needed for each character device used for normal
57  * tty I/O.  Each PORTS board supports 4 user terminals and 1 CENTRONICS-
58  * TYPE printer.
59  */
60 
61 struct strtty
62 {
63 	struct t_buf t_in;	/* input buffer info */
64 	struct t_buf t_out;	/* output buffer info */
65 	queue_t *t_rdqp;	/* pointer to tty read queue */
66 	mblk_t  *t_ioctlp;	/* ioctl block pointer */
67 	mblk_t  *t_lbuf;	/* pointer to a large data buffer */
68 	int	t_dev;		/* tty minor device number */
69 	int	t_iflag;	/* input setting  flags */
70 	int	t_oflag;	/* output setting flags */
71 	int	t_cflag;	/* physical setting flags */
72 	int	t_lflag;	/* "line discipline" flags */
73 	short	t_state;	/* internal state */
74 	char	t_line;		/* active line discipline */
75 	char	t_dstat;	/* more internal state flags */
76 	unsigned char t_cc[NCCS]; /* settable control chars */
77 };
78 
79 /*
80  * Size of internal ports data buffer, one per port
81  */
82 #define	LARGEBUFSZ	512
83 
84 #define	TTIPRI	28
85 #define	TTOPRI	29
86 
87 /* Internal state */
88 #define	TIMEOUT	01		/* Delay timeout in progress */
89 #define	WOPEN	02		/* Waiting for open to complete */
90 #define	ISOPEN	04		/* Device is open */
91 #define	TBLOCK	010
92 #define	CARR_ON	020		/* Software copy of carrier-present */
93 #define	BUSY	040		/* Output in progress */
94 #define	WIOC	0100		/* Wait for ioctl to complete */
95 #define	WGETTY	0200		/* opened by supergetty, waiting for getty */
96 #define	TTSTOP	0400		/* Output stopped by ctl-s */
97 #define	EXTPROC	01000		/* External processing */
98 #define	TACT	02000
99 #define	CLESC	04000		/* Last char escape */
100 #define	RTO	010000		/* Raw Timeout */
101 #define	TTIOW	020000
102 #define	TTXON	040000
103 #define	TTXOFF	0100000
104 
105 /* l_output status */
106 #define	CPRES	0100000
107 
108 /* device commands */
109 #define	T_OUTPUT	0
110 #define	T_TIME		1
111 #define	T_SUSPEND	2
112 #define	T_RESUME	3
113 #define	T_BLOCK		4
114 #define	T_UNBLOCK	5
115 #define	T_RFLUSH	6
116 #define	T_WFLUSH	7
117 #define	T_BREAK		8
118 #define	T_INPUT		9
119 #define	T_DISCONNECT	10
120 #define	T_PARM		11
121 #define	T_SWTCH		12
122 /*
123  * M_CTL message types.
124  */
125 #define	MC_NO_CANON	0	/* module below saying it will canonicalize */
126 #define	MC_DO_CANON	1	/* module below saying it won't canonicalize */
127 #define	MC_CANONQUERY	2	/* module above asking whether module below */
128 				/* canonicalizes */
129 #define	MC_PART_CANON	3	/* tell line discipline to do some */
130 				/* canonicalization */
131 /* XXX - These seem pretty device dependent... */
132 #define	MC_SERVICEIMM	3	/* tell the ZS driver to return input */
133 				/* immediately */
134 #define	MC_SERVICEDEF	4	/* tell the ZS driver it can wait */
135 #define	MC_POSIXQUERY	5	/* check if driver has POSIX close semantics */
136 #define	MC_HAS_POSIX	6	/* driver does support POSIX */
137 
138 #ifdef	__cplusplus
139 }
140 #endif
141 
142 #endif	/* _SYS_STRTTY_H */
143