|
|
1.1 ! root 1: /* tty.h 6.1 83/07/29 */ ! 2: ! 3: #ifdef KERNEL ! 4: #include "../h/ttychars.h" ! 5: #include "../h/ttydev.h" ! 6: #include "../tahoeif/sl_softc.h" ! 7: ! 8: #else ! 9: #include <sys/ttychars.h> ! 10: #include <sys/ttydev.h> ! 11: #include <tahoeif/sl_softc.h> ! 12: #endif ! 13: ! 14: /* ! 15: * A clist structure is the head of a linked list queue ! 16: * of characters. The characters are stored in blocks ! 17: * containing a link and CBSIZE (param.h) characters. ! 18: * The routines in tty_subr.c manipulate these structures. ! 19: */ ! 20: struct clist { ! 21: int c_cc; /* character count */ ! 22: char *c_cf; /* pointer to first char */ ! 23: char *c_cl; /* pointer to last char */ ! 24: }; ! 25: ! 26: /* ! 27: * Per-tty structure. ! 28: * ! 29: * Should be split in two, into device and tty drivers. ! 30: * Glue could be masks of what to echo and circular buffer ! 31: * (low, high, timeout). ! 32: */ ! 33: struct tty { ! 34: union { ! 35: struct { ! 36: struct clist T_rawq; ! 37: struct clist T_canq; ! 38: } t_t; ! 39: #define t_rawq t_nu.t_t.T_rawq /* raw characters or partial line */ ! 40: #define t_canq t_nu.t_t.T_canq /* raw characters or partial line */ ! 41: struct { ! 42: struct buf *T_bufp; ! 43: char *T_cp; ! 44: int T_inbuf; ! 45: int T_rec; ! 46: } t_n; ! 47: #define t_bufp t_nu.t_n.T_bufp /* buffer allocated to protocol */ ! 48: #define t_cp t_nu.t_n.T_cp /* pointer into the ripped off buffer */ ! 49: #define t_inbuf t_nu.t_n.T_inbuf /* number chars in the buffer */ ! 50: #define t_rec t_nu.t_n.T_rec /* have a complete record */ ! 51: } t_nu; ! 52: struct clist t_outq; /* device */ ! 53: int (*t_oproc)(); /* device */ ! 54: struct proc *t_rsel; /* tty */ ! 55: struct proc *t_wsel; ! 56: caddr_t T_LINEP; /* ### */ ! 57: caddr_t t_addr; /* ??? */ ! 58: dev_t t_dev; /* device */ ! 59: int t_flags; /* some of both */ ! 60: int t_state; /* some of both */ ! 61: short t_pgrp; /* tty */ ! 62: char t_delct; /* tty */ ! 63: char t_line; /* glue */ ! 64: char t_col; /* tty */ ! 65: char t_ispeed, t_ospeed; /* device */ ! 66: char t_rocount, t_rocol; /* tty */ ! 67: char t_stopbits; /* device */ ! 68: struct ttychars t_chars; /* tty */ ! 69: struct sl_softc *t_slsoftc; /* For network serial line interface */ ! 70: /* be careful of tchars & co. */ ! 71: #define t_erase t_chars.tc_erase ! 72: #define t_kill t_chars.tc_kill ! 73: #define t_intrc t_chars.tc_intrc ! 74: #define t_quitc t_chars.tc_quitc ! 75: #define t_startc t_chars.tc_startc ! 76: #define t_stopc t_chars.tc_stopc ! 77: #define t_eofc t_chars.tc_eofc ! 78: #define t_brkc t_chars.tc_brkc ! 79: #define t_suspc t_chars.tc_suspc ! 80: #define t_dsuspc t_chars.tc_dsuspc ! 81: #define t_rprntc t_chars.tc_rprntc ! 82: #define t_flushc t_chars.tc_flushc ! 83: #define t_werasc t_chars.tc_werasc ! 84: #define t_lnextc t_chars.tc_lnextc ! 85: }; ! 86: ! 87: #define TTIPRI 28 ! 88: #define TTOPRI 29 ! 89: ! 90: /* limits */ ! 91: #define NSPEEDS 16 ! 92: #define TTMASK 15 ! 93: #define OBUFSIZ 100 ! 94: #define TTYHOG 255 ! 95: #ifdef KERNEL ! 96: short tthiwat[NSPEEDS], ttlowat[NSPEEDS]; ! 97: #define TTHIWAT(tp) tthiwat[(tp)->t_ospeed&TTMASK] ! 98: #define TTLOWAT(tp) ttlowat[(tp)->t_ospeed&TTMASK] ! 99: extern struct ttychars ttydefaults; ! 100: #endif ! 101: ! 102: /* internal state bits */ ! 103: #define TS_TIMEOUT 0x000001 /* delay timeout in progress */ ! 104: #define TS_WOPEN 0x000002 /* waiting for open to complete */ ! 105: #define TS_ISOPEN 0x000004 /* device is open */ ! 106: #define TS_FLUSH 0x000008 /* outq has been flushed during DMA */ ! 107: #define TS_CARR_ON 0x000010 /* software copy of carrier-present */ ! 108: #define TS_BUSY 0x000020 /* output in progress */ ! 109: #define TS_ASLEEP 0x000040 /* wakeup when output done */ ! 110: #define TS_XCLUDE 0x000080 /* exclusive-use flag against open */ ! 111: #define TS_TTSTOP 0x000100 /* output stopped by ctl-s */ ! 112: #define TS_HUPCLS 0x000200 /* hang up upon last close */ ! 113: #define TS_TBLOCK 0x000400 /* tandem queue blocked */ ! 114: #define TS_RCOLL 0x000800 /* collision in read select */ ! 115: #define TS_WCOLL 0x001000 /* collision in write select */ ! 116: #define TS_NBIO 0x002000 /* tty in non-blocking mode */ ! 117: #define TS_ASYNC 0x004000 /* tty in async i/o mode */ ! 118: /* state for intra-line fancy editing work */ ! 119: #define TS_BKSL 0x010000 /* state for lowercase \ work */ ! 120: #define TS_QUOT 0x020000 /* last character input was \ */ ! 121: #define TS_ERASE 0x040000 /* within a \.../ for PRTRUB */ ! 122: #define TS_LNCH 0x080000 /* next character is literal */ ! 123: #define TS_TYPEN 0x100000 /* retyping suspended input (PENDIN) */ ! 124: #define TS_CNTTB 0x200000 /* counting tab width; leave FLUSHO alone */ ! 125: ! 126: #define TS_LOCAL (TS_BKSL|TS_QUOT|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB) ! 127: ! 128: /* define partab character types */ ! 129: #define ORDINARY 0 ! 130: #define CONTROL 1 ! 131: #define BACKSPACE 2 ! 132: #define NEWLINE 3 ! 133: #define TAB 4 ! 134: #define VTAB 5 ! 135: #define RETURN 6
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.