xref: /illumos-gate/usr/src/uts/common/sys/strtty.h (revision b4203d75)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*b4203d75SMarcel Telka /*	  All Rights Reserved	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_STRTTY_H
317c478bd9Sstevel@tonic-gate #define	_SYS_STRTTY_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * header file for STREAMS TTY subsystem
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * The t_buf data structure holds information about a message
437c478bd9Sstevel@tonic-gate  * block and its associated data buffer.  One is used for received
447c478bd9Sstevel@tonic-gate  * blocks, and another is used for blocks to be transmitted to
457c478bd9Sstevel@tonic-gate  * a user terminal or a printer.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate struct t_buf
497c478bd9Sstevel@tonic-gate {
507c478bd9Sstevel@tonic-gate 	mblk_t *bu_bp;	/* message block pointer */
517c478bd9Sstevel@tonic-gate 	unsigned char *bu_ptr;	/* data buffer pointer */
527c478bd9Sstevel@tonic-gate 	ushort_t bu_cnt;	/* data buffer character count */
537c478bd9Sstevel@tonic-gate };
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * A tty structure is needed for each character device used for normal
577c478bd9Sstevel@tonic-gate  * tty I/O.  Each PORTS board supports 4 user terminals and 1 CENTRONICS-
587c478bd9Sstevel@tonic-gate  * TYPE printer.
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate struct strtty
627c478bd9Sstevel@tonic-gate {
637c478bd9Sstevel@tonic-gate 	struct t_buf t_in;	/* input buffer info */
647c478bd9Sstevel@tonic-gate 	struct t_buf t_out;	/* output buffer info */
657c478bd9Sstevel@tonic-gate 	queue_t *t_rdqp;	/* pointer to tty read queue */
667c478bd9Sstevel@tonic-gate 	mblk_t  *t_ioctlp;	/* ioctl block pointer */
677c478bd9Sstevel@tonic-gate 	mblk_t  *t_lbuf;	/* pointer to a large data buffer */
687c478bd9Sstevel@tonic-gate 	int	t_dev;		/* tty minor device number */
697c478bd9Sstevel@tonic-gate 	int	t_iflag;	/* input setting  flags */
707c478bd9Sstevel@tonic-gate 	int	t_oflag;	/* output setting flags */
717c478bd9Sstevel@tonic-gate 	int	t_cflag;	/* physical setting flags */
727c478bd9Sstevel@tonic-gate 	int	t_lflag;	/* "line discipline" flags */
737c478bd9Sstevel@tonic-gate 	short	t_state;	/* internal state */
747c478bd9Sstevel@tonic-gate 	char	t_line;		/* active line discipline */
757c478bd9Sstevel@tonic-gate 	char	t_dstat;	/* more internal state flags */
767c478bd9Sstevel@tonic-gate 	unsigned char t_cc[NCCS]; /* settable control chars */
777c478bd9Sstevel@tonic-gate };
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Size of internal ports data buffer, one per port
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate #define	LARGEBUFSZ	512
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #define	TTIPRI	28
857c478bd9Sstevel@tonic-gate #define	TTOPRI	29
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /* Internal state */
887c478bd9Sstevel@tonic-gate #define	TIMEOUT	01		/* Delay timeout in progress */
897c478bd9Sstevel@tonic-gate #define	WOPEN	02		/* Waiting for open to complete */
907c478bd9Sstevel@tonic-gate #define	ISOPEN	04		/* Device is open */
917c478bd9Sstevel@tonic-gate #define	TBLOCK	010
927c478bd9Sstevel@tonic-gate #define	CARR_ON	020		/* Software copy of carrier-present */
937c478bd9Sstevel@tonic-gate #define	BUSY	040		/* Output in progress */
947c478bd9Sstevel@tonic-gate #define	WIOC	0100		/* Wait for ioctl to complete */
957c478bd9Sstevel@tonic-gate #define	WGETTY	0200		/* opened by supergetty, waiting for getty */
967c478bd9Sstevel@tonic-gate #define	TTSTOP	0400		/* Output stopped by ctl-s */
977c478bd9Sstevel@tonic-gate #define	EXTPROC	01000		/* External processing */
987c478bd9Sstevel@tonic-gate #define	TACT	02000
997c478bd9Sstevel@tonic-gate #define	CLESC	04000		/* Last char escape */
1007c478bd9Sstevel@tonic-gate #define	RTO	010000		/* Raw Timeout */
1017c478bd9Sstevel@tonic-gate #define	TTIOW	020000
1027c478bd9Sstevel@tonic-gate #define	TTXON	040000
1037c478bd9Sstevel@tonic-gate #define	TTXOFF	0100000
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate /* l_output status */
1067c478bd9Sstevel@tonic-gate #define	CPRES	0100000
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate /* device commands */
1097c478bd9Sstevel@tonic-gate #define	T_OUTPUT	0
1107c478bd9Sstevel@tonic-gate #define	T_TIME		1
1117c478bd9Sstevel@tonic-gate #define	T_SUSPEND	2
1127c478bd9Sstevel@tonic-gate #define	T_RESUME	3
1137c478bd9Sstevel@tonic-gate #define	T_BLOCK		4
1147c478bd9Sstevel@tonic-gate #define	T_UNBLOCK	5
1157c478bd9Sstevel@tonic-gate #define	T_RFLUSH	6
1167c478bd9Sstevel@tonic-gate #define	T_WFLUSH	7
1177c478bd9Sstevel@tonic-gate #define	T_BREAK		8
1187c478bd9Sstevel@tonic-gate #define	T_INPUT		9
1197c478bd9Sstevel@tonic-gate #define	T_DISCONNECT	10
1207c478bd9Sstevel@tonic-gate #define	T_PARM		11
1217c478bd9Sstevel@tonic-gate #define	T_SWTCH		12
1227c478bd9Sstevel@tonic-gate /*
1237c478bd9Sstevel@tonic-gate  * M_CTL message types.
1247c478bd9Sstevel@tonic-gate  */
1257c478bd9Sstevel@tonic-gate #define	MC_NO_CANON	0	/* module below saying it will canonicalize */
1267c478bd9Sstevel@tonic-gate #define	MC_DO_CANON	1	/* module below saying it won't canonicalize */
1277c478bd9Sstevel@tonic-gate #define	MC_CANONQUERY	2	/* module above asking whether module below */
1287c478bd9Sstevel@tonic-gate 				/* canonicalizes */
1297c478bd9Sstevel@tonic-gate #define	MC_PART_CANON	3	/* tell line discipline to do some */
1307c478bd9Sstevel@tonic-gate 				/* canonicalization */
1317c478bd9Sstevel@tonic-gate /* XXX - These seem pretty device dependent... */
1327c478bd9Sstevel@tonic-gate #define	MC_SERVICEIMM	3	/* tell the ZS driver to return input */
1337c478bd9Sstevel@tonic-gate 				/* immediately */
1347c478bd9Sstevel@tonic-gate #define	MC_SERVICEDEF	4	/* tell the ZS driver it can wait */
1357c478bd9Sstevel@tonic-gate #define	MC_POSIXQUERY	5	/* check if driver has POSIX close semantics */
1367c478bd9Sstevel@tonic-gate #define	MC_HAS_POSIX	6	/* driver does support POSIX */
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1397c478bd9Sstevel@tonic-gate }
1407c478bd9Sstevel@tonic-gate #endif
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #endif	/* _SYS_STRTTY_H */
143