xref: /titanic_41/usr/src/uts/common/sys/strtty.h (revision 9512fe850e98fdd448c638ca63fdd92a8a510255)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * header file for STREAMS TTY subsystem
41  */
42 
43 /*
44  * The t_buf data structure holds information about a message
45  * block and its associated data buffer.  One is used for received
46  * blocks, and another is used for blocks to be transmitted to
47  * a user terminal or a printer.
48  */
49 
50 struct t_buf
51 {
52 	mblk_t *bu_bp;	/* message block pointer */
53 	unsigned char *bu_ptr;	/* data buffer pointer */
54 	ushort_t bu_cnt;	/* data buffer character count */
55 };
56 
57 /*
58  * A tty structure is needed for each character device used for normal
59  * tty I/O.  Each PORTS board supports 4 user terminals and 1 CENTRONICS-
60  * TYPE printer.
61  */
62 
63 struct strtty
64 {
65 	struct t_buf t_in;	/* input buffer info */
66 	struct t_buf t_out;	/* output buffer info */
67 	queue_t *t_rdqp;	/* pointer to tty read queue */
68 	mblk_t  *t_ioctlp;	/* ioctl block pointer */
69 	mblk_t  *t_lbuf;	/* pointer to a large data buffer */
70 	int	t_dev;		/* tty minor device number */
71 	int	t_iflag;	/* input setting  flags */
72 	int	t_oflag;	/* output setting flags */
73 	int	t_cflag;	/* physical setting flags */
74 	int	t_lflag;	/* "line discipline" flags */
75 	short	t_state;	/* internal state */
76 	char	t_line;		/* active line discipline */
77 	char	t_dstat;	/* more internal state flags */
78 	unsigned char t_cc[NCCS]; /* settable control chars */
79 };
80 
81 /*
82  * Size of internal ports data buffer, one per port
83  */
84 #define	LARGEBUFSZ	512
85 
86 #define	TTIPRI	28
87 #define	TTOPRI	29
88 
89 /* Internal state */
90 #define	TIMEOUT	01		/* Delay timeout in progress */
91 #define	WOPEN	02		/* Waiting for open to complete */
92 #define	ISOPEN	04		/* Device is open */
93 #define	TBLOCK	010
94 #define	CARR_ON	020		/* Software copy of carrier-present */
95 #define	BUSY	040		/* Output in progress */
96 #define	WIOC	0100		/* Wait for ioctl to complete */
97 #define	WGETTY	0200		/* opened by supergetty, waiting for getty */
98 #define	TTSTOP	0400		/* Output stopped by ctl-s */
99 #define	EXTPROC	01000		/* External processing */
100 #define	TACT	02000
101 #define	CLESC	04000		/* Last char escape */
102 #define	RTO	010000		/* Raw Timeout */
103 #define	TTIOW	020000
104 #define	TTXON	040000
105 #define	TTXOFF	0100000
106 
107 /* l_output status */
108 #define	CPRES	0100000
109 
110 /* device commands */
111 #define	T_OUTPUT	0
112 #define	T_TIME		1
113 #define	T_SUSPEND	2
114 #define	T_RESUME	3
115 #define	T_BLOCK		4
116 #define	T_UNBLOCK	5
117 #define	T_RFLUSH	6
118 #define	T_WFLUSH	7
119 #define	T_BREAK		8
120 #define	T_INPUT		9
121 #define	T_DISCONNECT	10
122 #define	T_PARM		11
123 #define	T_SWTCH		12
124 /*
125  * M_CTL message types.
126  */
127 #define	MC_NO_CANON	0	/* module below saying it will canonicalize */
128 #define	MC_DO_CANON	1	/* module below saying it won't canonicalize */
129 #define	MC_CANONQUERY	2	/* module above asking whether module below */
130 				/* canonicalizes */
131 #define	MC_PART_CANON	3	/* tell line discipline to do some */
132 				/* canonicalization */
133 /* XXX - These seem pretty device dependent... */
134 #define	MC_SERVICEIMM	3	/* tell the ZS driver to return input */
135 				/* immediately */
136 #define	MC_SERVICEDEF	4	/* tell the ZS driver it can wait */
137 #define	MC_POSIXQUERY	5	/* check if driver has POSIX close semantics */
138 #define	MC_HAS_POSIX	6	/* driver does support POSIX */
139 
140 #ifdef	__cplusplus
141 }
142 #endif
143 
144 #endif	/* _SYS_STRTTY_H */
145