1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)tty.h	7.1 (Berkeley) 6/4/86
   7:  */
   8: 
   9: #ifdef KERNEL
  10: #include "ttychars.h"
  11: #include "ttydev.h"
  12: #else
  13: #include <sys/ttychars.h>
  14: #include <sys/ttydev.h>
  15: #endif
  16: 
  17: /*
  18:  * A clist structure is the head of a linked list queue
  19:  * of characters.  The characters are stored in blocks
  20:  * containing a link and CBSIZE (param.h) characters.
  21:  * The routines in tty_subr.c manipulate these structures.
  22:  */
  23: struct clist {
  24:     int c_cc;       /* character count */
  25:     char    *c_cf;      /* pointer to first char */
  26:     char    *c_cl;      /* pointer to last char */
  27: };
  28: 
  29: /*
  30:  * Per-tty structure.
  31:  *
  32:  * Should be split in two, into device and tty drivers.
  33:  * Glue could be masks of what to echo and circular buffer
  34:  * (low, high, timeout).
  35:  */
  36: struct tty {
  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     /* raw characters or partial line */
  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;       /* device */
  56:     int (*t_oproc)();       /* device */
  57:     struct  proc *t_rsel;       /* tty */
  58:     struct  proc *t_wsel;
  59:                 caddr_t T_LINEP;    /* ### */
  60:     caddr_t t_addr;         /* ??? */
  61:     dev_t   t_dev;          /* device */
  62:     int t_flags;        /* some of both */
  63:     int t_state;        /* some of both */
  64:     short   t_pgrp;         /* tty */
  65:     char    t_delct;        /* tty */
  66:     char    t_line;         /* glue */
  67:     char    t_col;          /* tty */
  68:     char    t_ispeed, t_ospeed; /* device */
  69:     char    t_rocount, t_rocol; /* tty */
  70:     struct  ttychars t_chars;   /* tty */
  71:     struct  winsize t_winsize;  /* window size */
  72: /* be careful of tchars & co. */
  73: #define t_erase     t_chars.tc_erase
  74: #define t_kill      t_chars.tc_kill
  75: #define t_intrc     t_chars.tc_intrc
  76: #define t_quitc     t_chars.tc_quitc
  77: #define t_startc    t_chars.tc_startc
  78: #define t_stopc     t_chars.tc_stopc
  79: #define t_eofc      t_chars.tc_eofc
  80: #define t_brkc      t_chars.tc_brkc
  81: #define t_suspc     t_chars.tc_suspc
  82: #define t_dsuspc    t_chars.tc_dsuspc
  83: #define t_rprntc    t_chars.tc_rprntc
  84: #define t_flushc    t_chars.tc_flushc
  85: #define t_werasc    t_chars.tc_werasc
  86: #define t_lnextc    t_chars.tc_lnextc
  87: };
  88: 
  89: #define TTIPRI  28
  90: #define TTOPRI  29
  91: 
  92: /* limits */
  93: #define NSPEEDS 16
  94: #define TTMASK  15
  95: #define OBUFSIZ 100
  96: #define TTYHOG  255
  97: #ifdef KERNEL
  98: short   tthiwat[NSPEEDS], ttlowat[NSPEEDS];
  99: #define TTHIWAT(tp) tthiwat[(tp)->t_ospeed&TTMASK]
 100: #define TTLOWAT(tp) ttlowat[(tp)->t_ospeed&TTMASK]
 101: extern  struct ttychars ttydefaults;
 102: #endif
 103: 
 104: /* internal state bits */
 105: #define TS_TIMEOUT  0x000001    /* delay timeout in progress */
 106: #define TS_WOPEN    0x000002    /* waiting for open to complete */
 107: #define TS_ISOPEN   0x000004    /* device is open */
 108: #define TS_FLUSH    0x000008    /* outq has been flushed during DMA */
 109: #define TS_CARR_ON  0x000010    /* software copy of carrier-present */
 110: #define TS_BUSY     0x000020    /* output in progress */
 111: #define TS_ASLEEP   0x000040    /* wakeup when output done */
 112: #define TS_XCLUDE   0x000080    /* exclusive-use flag against open */
 113: #define TS_TTSTOP   0x000100    /* output stopped by ctl-s */
 114: #define TS_HUPCLS   0x000200    /* hang up upon last close */
 115: #define TS_TBLOCK   0x000400    /* tandem queue blocked */
 116: #define TS_RCOLL    0x000800    /* collision in read select */
 117: #define TS_WCOLL    0x001000    /* collision in write select */
 118: #define TS_NBIO     0x002000    /* tty in non-blocking mode */
 119: #define TS_ASYNC    0x004000    /* tty in async i/o mode */
 120: /* state for intra-line fancy editing work */
 121: #define TS_BKSL     0x010000    /* state for lowercase \ work */
 122: #define TS_QUOT     0x020000    /* last character input was \ */
 123: #define TS_ERASE    0x040000    /* within a \.../ for PRTRUB */
 124: #define TS_LNCH     0x080000    /* next character is literal */
 125: #define TS_TYPEN    0x100000    /* retyping suspended input (PENDIN) */
 126: #define TS_CNTTB    0x200000    /* counting tab width; leave FLUSHO alone */
 127: 
 128: #define TS_LOCAL    (TS_BKSL|TS_QUOT|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB)
 129: 
 130: /* define partab character types */
 131: #define ORDINARY    0
 132: #define CONTROL     1
 133: #define BACKSPACE   2
 134: #define NEWLINE     3
 135: #define TAB     4
 136: #define VTAB        5
 137: #define RETURN      6

Defined variables

tthiwat defined in line 98; used 1 times
  • in line 99
ttlowat defined in line 98; used 1 times

Defined struct's

clist defined in line 23; used 38 times
tty defined in line 36; used 334 times

Defined macros

BACKSPACE defined in line 133; never used
CONTROL defined in line 132; never used
NEWLINE defined in line 134; never used
NSPEEDS defined in line 93; used 2 times
  • in line 98(2)
OBUFSIZ defined in line 95; used 3 times
ORDINARY defined in line 131; never used
RETURN defined in line 137; never used
TAB defined in line 135; never used
TS_ASYNC defined in line 119; used 3 times
TS_BKSL defined in line 121; used 4 times
TS_CNTTB defined in line 126; used 4 times
TS_ERASE defined in line 123; used 6 times
TS_LNCH defined in line 124; used 4 times
TS_LOCAL defined in line 128; used 2 times
TS_NBIO defined in line 118; used 6 times
TS_QUOT defined in line 122; used 5 times
TS_RCOLL defined in line 116; used 3 times
TS_TBLOCK defined in line 115; used 4 times
TS_TYPEN defined in line 125; used 4 times
TTHIWAT defined in line 99; used 3 times
TTMASK defined in line 94; used 2 times
TTOPRI defined in line 90; used 8 times
TTYHOG defined in line 96; used 10 times
VTAB defined in line 136; never used
t_brkc defined in line 80; used 1 times
t_bufp defined in line 50; used 6 times
t_canq defined in line 43; used 32 times
t_cp defined in line 51; used 8 times
t_dsuspc defined in line 82; used 1 times
t_eofc defined in line 79; used 3 times
t_erase defined in line 73; used 5 times
t_flushc defined in line 84; used 1 times
t_inbuf defined in line 52; used 10 times
t_kill defined in line 74; used 4 times
t_lnextc defined in line 86; used 1 times
t_quitc defined in line 76; used 1 times
t_rec defined in line 53; used 6 times
t_rprntc defined in line 83; used 3 times
t_startc defined in line 77; used 5 times
t_stopc defined in line 78; used 4 times
t_suspc defined in line 81; used 3 times
t_werasc defined in line 85; used 1 times

Usage of this include

Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1529
Valid CSS Valid XHTML 1.0 Strict