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