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