home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#) tty.h 2.3 88/05/18
- *
- * Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
- * Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
- * This Module contains Proprietary Information of
- * The Santa Cruz Operation, Microsoft Corporation
- * and AT&T, and should be treated as Confidential.
- */
-
- /*
- * A clist structure is the head of a linked list queue of characters.
- * The routines getc* and putc* manipulate these structures.
- */
-
- #include "termio.h"
-
- struct clist {
- int c_cc; /* character count */
- struct cblock *c_cf; /* pointer to first */
- struct cblock *c_cl; /* pointer to last */
- };
-
- /* Macro to find cblock structure given pointer into it */
- #define CMATCH(pointer) (cfree + (pointer - cfree))
-
- /* Character control block for interrupt level control */
-
- struct ccblock {
- unsigned char *c_ptr; /* buffer address */
- ushort c_count; /* character count */
- ushort c_size; /* buffer size */
- };
-
- /*
- * A tty structure is needed for each UNIX character device that
- * is used for normal terminal IO.
- */
- #define NCC 8
- struct tty {
- struct clist t_rawq; /* raw input queue */
- struct clist t_canq; /* canonical queue */
- struct clist t_outq; /* output queue */
- struct ccblock t_tbuf; /* tx control block */
- struct ccblock t_rbuf; /* rx control block */
- #ifdef M_I386
- int (*t_proc)();/* routine for device functions */
- #else
- int (far *t_proc)();/* routine for device functions */
- #endif
- ushort t_iflag; /* input modes */
- ushort t_oflag; /* output modes */
- ushort t_cflag; /* control modes */
- ushort t_lflag; /* line discipline modes */
- short t_state; /* internal state */
- short t_pgrp; /* process group name */
- char t_line; /* line discipline */
- char t_delct; /* delimiter count */
- char t_mstate; /* emapping state (t_xmp valid if non-null) */
- char t_yyy; /* reserved (was t_mchar:saved emapping char) */
- char t_col; /* current column */
- char t_merr; /* emapping error flag */
- struct xmap *t_xmp; /* ptr to struct for emap and nmap routines */
- char t_xstate; /* extended state */
- char t_dstat; /* used by line disciplines */
- unsigned char t_schar;/* save timeout char instead of using lflag */
- char t_xxx; /* reserved */
- unsigned char t_cc[NCC+2]; /* settable control chars */
- };
-
- /*
- * The structure of a clist block
- */
- #define CLSIZE 32
- #define CLFSIZE ((CLSIZE + 7) / 8)
- struct cblock {
- struct cblock *c_next;
- unsigned char c_first;
- unsigned char c_last;
- unsigned char c_data[CLSIZE];
- unsigned char c_dflags[CLFSIZE];
- };
-
- extern struct cblock cfree[];
- extern struct cblock * getcb();
- extern struct cblock * getcf();
- extern struct clist ttnulq;
-
- struct chead {
- struct cblock *c_next;
- int c_size;
- int c_flag;
- };
- extern struct chead cfreelist;
-
- struct inter {
- int cnt;
- };
-
- #define QESC 0400 /* queue escape */
- #define QDELAY 0400 /* delay output */
-
- #define TTIPRI 28
- #define TTOPRI 29
-
- /* limits */
- extern int ttlowat[], tthiwat[], ttyhog;
- #define TTYHOG 256
- #define TTXOLO 60
- #define TTXOHI 180
- #define TTECHI 80
-
- #define TTHIWAT(tp) tthiwat[(tp)->t_cflag & CBAUD]
- #define TTLOWAT(tp) ttlowat[(tp)->t_cflag & CBAUD]
-
- /* Hardware bits */
- #define DONE 0200
- #define IENABLE 0100
- #define OVERRUN 040000
- #define FRERROR 020000
- #define PERROR 010000
-
- /* Internal state */
- #define TIMEOUT 01 /* Delay timeout in progress */
- #define WOPEN 02 /* Waiting for open to complete */
- #define ISOPEN 04 /* Device is open */
- #define TBLOCK 010
- #define CARR_ON 020 /* Software copy of carrier-present */
- #define BUSY 040 /* Output in progress */
- #define OASLP 0100 /* Wakeup when output done */
- #define IASLP 0200 /* Wakeup when input done */
- #define TTSTOP 0400 /* Output stopped by ctl-s */
- #define EXTPROC 01000 /* External processing */
- #define TACT 02000
- #define CLESC 04000 /* Last char escape */
- #define RTO 010000 /* Raw Timeout */
- #define TTIOW 020000
- #define TTXON 040000
- #define TTXOFF 0100000
-
- /* Extended internal state */
- #define EXTDLY 01 /* External delay processing */
- #define TRCOLL 02 /* Collision in select (read fd) */
- #define TWCOLL 04 /* Collision in select (write fd) */
- #define TECOLL 010 /* Collision in select (exception fd) */
-
- /* l_output status */
- #define CPRES 0100000
-
- /* device commands */
- #define T_OUTPUT 0
- #define T_TIME 1
- #define T_SUSPEND 2
- #define T_RESUME 3
- #define T_BLOCK 4
- #define T_UNBLOCK 5
- #define T_RFLUSH 6
- #define T_WFLUSH 7
- #define T_BREAK 8
- #define T_INPUT 9
- #define T_PARM 11
- #define T_SWTCH 12
-
- /*
- * device report
- */
- #define L_BUF 0
- #define L_BREAK 3
-
- /* Extract minor device bits not associated with modem control */
- #define UNMODEM(dev) (dev & 0x7f)
- /* does this dev have modem support */
- #define ISMODEM(dev) ((dev & 0x80) == 0)
-