Annotation of 41BSD/4.0.upgrade/sys/h/tty.h, revision 1.1

1.1     ! root        1: /*     tty.h   4.5     81/06/11        */
        !             2: 
        !             3: #ifdef KERNEL
        !             4: #include "../h/ioctl.h"
        !             5: #else
        !             6: #include <sys/ioctl.h>
        !             7: #endif
        !             8: #include <sgtty.h>
        !             9: 
        !            10: /*
        !            11:  * A clist structure is the head
        !            12:  * of a linked list queue of characters.
        !            13:  * The characters are stored in
        !            14:  * blocks containing a link and CBSIZE (param.h)
        !            15:  * characters.  The routines getc, putc, ... in prim.c
        !            16:  * manipulate these structures.
        !            17:  */
        !            18: struct clist
        !            19: {
        !            20:        int     c_cc;           /* character count */
        !            21:        char    *c_cf;          /* pointer to first char */
        !            22:        char    *c_cl;          /* pointer to last char */
        !            23: };
        !            24: 
        !            25: /*
        !            26:  * A tty structure is needed for
        !            27:  * each UNIX character device that
        !            28:  * is used for normal terminal IO.
        !            29:  * The routines in tty.c handle the
        !            30:  * common code associated with
        !            31:  * these structures.  The definition
        !            32:  * and device dependent code is in
        !            33:  * each driver. (cons.c, dh.c, dz.c, kl.c)
        !            34:  */
        !            35: struct tty
        !            36: {
        !            37:        union {
        !            38:                struct {
        !            39:                        struct  clist T_rawq;
        !            40:                        struct  clist T_canq;
        !            41:                } t_t;
        !            42: #define        t_rawq  t_nu.t_t.T_rawq         /* raw characters or partial line */
        !            43: #define        t_canq  t_nu.t_t.T_canq         /* complete input lines */
        !            44:                struct {
        !            45:                        struct  buf *T_bufp;
        !            46:                        char    *T_cp;
        !            47:                        int     T_inbuf;
        !            48:                        int     T_rec;
        !            49:                } t_n;
        !            50: #define        t_bufp  t_nu.t_n.T_bufp         /* buffer allocated to protocol */
        !            51: #define        t_cp    t_nu.t_n.T_cp           /* pointer into the ripped off buffer */
        !            52: #define        t_inbuf t_nu.t_n.T_inbuf        /* number chars in the buffer */
        !            53: #define        t_rec   t_nu.t_n.T_rec          /* have a complete record */
        !            54:        } t_nu;
        !            55:        struct  clist t_outq;   /* output list to device */
        !            56:        int     (*t_oproc)();   /* routine to start output */
        !            57:        int     (*t_iproc)();   /* routine to start input */
        !            58:        struct chan *t_chan;    /* destination channel */
        !            59:        caddr_t t_linep;        /* aux line discipline pointer */
        !            60:        caddr_t t_addr;         /* device address */
        !            61:        dev_t   t_dev;          /* device number */
        !            62:        short   t_flags;        /* mode, settable by ioctl call */
        !            63:        short   t_state;        /* internal state, not visible externally */
        !            64:        short   t_pgrp;         /* process group name */
        !            65:        char    t_delct;        /* number of delimiters in raw q */
        !            66:        char    t_line;         /* line discipline */
        !            67:        char    t_col;          /* printing column of device */
        !            68:        char    t_erase;        /* erase character */
        !            69:        char    t_kill;         /* kill character */
        !            70:        char    t_char;         /* character temporary */
        !            71:        char    t_ispeed;       /* input speed */
        !            72:        char    t_ospeed;       /* output speed */
        !            73: /* begin local */
        !            74:        char    t_rocount;      /* chars input since a ttwrite() */
        !            75:        char    t_rocol;        /* t_col when first input this line */
        !            76:        struct  ltchars t_lchr; /* local special characters */
        !            77:        short   t_local;        /* local mode word */
        !            78:        short   t_lstate;       /* local state bits */
        !            79: /* end local */
        !            80:        union {
        !            81:                struct tchars t_chr;
        !            82:                struct clist t_ctlq;
        !            83:        } t_un;
        !            84: };
        !            85: 
        !            86: #define        tun     tp->t_un.t_chr
        !            87: #define        tlun    tp->t_lchr
        !            88: 
        !            89: #define        TTIPRI  28
        !            90: #define        TTOPRI  29
        !            91: 
        !            92: #define        CTRL(c) ('c'&037)
        !            93: 
        !            94: /* default special characters */
        !            95: #define        CERASE  '#'
        !            96: #define        CEOT    CTRL(d)
        !            97: #define        CKILL   '@'
        !            98: #define        CQUIT   034             /* FS, cntl shift L */
        !            99: #define        CINTR   0177            /* DEL */
        !           100: #define        CSTOP   CTRL(s)
        !           101: #define        CSTART  CTRL(q)
        !           102: #define        CBRK    0377
        !           103: 
        !           104: /* limits */
        !           105: #define        NSPEEDS 16
        !           106: #define        TTMASK  15
        !           107: #ifdef KERNEL
        !           108: short  tthiwat[NSPEEDS], ttlowat[NSPEEDS];
        !           109: #define        TTHIWAT(tp)     tthiwat[(tp)->t_ospeed&TTMASK]
        !           110: #define        TTLOWAT(tp)     ttlowat[(tp)->t_ospeed&TTMASK]
        !           111: #endif
        !           112: #define        TTYHOG  255
        !           113: 
        !           114: /* hardware bits */
        !           115: #define        DONE    0200
        !           116: #define        IENABLE 0100
        !           117: 
        !           118: /* internal state bits */
        !           119: #define        TIMEOUT 01              /* delay timeout in progress */
        !           120: #define        WOPEN   02              /* waiting for open to complete */
        !           121: #define        ISOPEN  04              /* device is open */
        !           122: #define        FLUSH   010             /* outq has been flushed during DMA */
        !           123: #define        CARR_ON 020             /* software copy of carrier-present */
        !           124: #define        BUSY    040             /* output in progress */
        !           125: #define        ASLEEP  0100            /* wakeup when output done */
        !           126: #define        XCLUDE  0200            /* exclusive-use flag against open */
        !           127: #define        TTSTOP  0400            /* output stopped by ctl-s */
        !           128: #define        HUPCLS  01000           /* hang up upon last close */
        !           129: #define        TBLOCK  02000           /* tandem queue blocked */
        !           130: #define        SPEEDS  04000           /* t_ispeed and t_ospeed used by driver */
        !           131: #define        NDQB    010000
        !           132: #define        EXTPROC 020000          /* external processor (kmc) */
        !           133: #define        FSLEEP  040000          /* Wakeup on input framing */
        !           134: #define        BEXT    0100000         /* use (external) system buffers */
        !           135: 
        !           136: /* define partab character types */
        !           137: #define        ORDINARY        0
        !           138: #define        CONTROL         1
        !           139: #define        BACKSPACE       2
        !           140: #define        NEWLINE         3
        !           141: #define        TAB             4
        !           142: #define        VTAB            5
        !           143: #define        RETURN          6
        !           144: 
        !           145: /* define dmctl actions */
        !           146: #define        DMSET           0
        !           147: #define        DMBIS           1
        !           148: #define        DMBIC           2

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.