new fields for new tty driver
authorBill Joy <bill@ucbvax.Berkeley.EDU>
Fri, 16 May 1980 08:18:19 +0000 (00:18 -0800)
committerBill Joy <bill@ucbvax.Berkeley.EDU>
Fri, 16 May 1980 08:18:19 +0000 (00:18 -0800)
SCCS-vsn: sys/sys/tty.h 3.3

usr/src/sys/sys/tty.h

index 5c7bc70..0d70ec4 100644 (file)
@@ -1,10 +1,14 @@
-/*     tty.h   3.2     %H%     */
+/*     tty.h   3.3     %H%     */
+
+#include <sgtty.h>
+#include <sys/ioctl.h>
+
 /*
  * A clist structure is the head
  * of a linked list queue of characters.
 /*
  * A clist structure is the head
  * of a linked list queue of characters.
- * The characters are stored in 4-word
- * blocks containing a link and several characters.
- * The routines getc and putc
+ * The characters are stored in
+ * blocks containing a link and CBSIZE (param.h)
+ * characters.  The routines getc, putc, ... in prim.c
  * manipulate these structures.
  */
 struct clist
  * manipulate these structures.
  */
 struct clist
@@ -20,20 +24,10 @@ struct clist
  * is used for normal terminal IO.
  * The routines in tty.c handle the
  * common code associated with
  * is used for normal terminal IO.
  * The routines in tty.c handle the
  * common code associated with
- * these structures.
- * The definition and device dependent
- * code is in each driver. (kl.c dz.c)
+ * these structures.  The definition
+ * and device dependent code is in
+ * each driver. (cons.c, dh.c, dz.c, kl.c)
  */
  */
-
-struct tc {
-       char    t_intrc;        /* interrupt */
-       char    t_quitc;        /* quit */
-       char    t_startc;       /* start output */
-       char    t_stopc;        /* stop output */
-       char    t_eofc;         /* end-of-file */
-       char    t_brkc;         /* input delimiter (like nl) */
-};
-
 struct tty
 {
        union {
 struct tty
 {
        union {
@@ -41,18 +35,18 @@ struct tty
                        struct  clist T_rawq;
                        struct  clist T_canq;
                } t_t;
                        struct  clist T_rawq;
                        struct  clist T_canq;
                } t_t;
-#define        t_rawq  t_nu.t_t.T_rawq /* input chars right off device */
-#define        t_canq  t_nu.t_t.T_canq /* input chars after erase and kill */
-#ifdef BERKNET
+#define        t_rawq  t_nu.t_t.T_rawq         /* raw characters or partial line */
+#define        t_canq  t_nu.t_t.T_canq         /* complete input lines */
                struct {
                        struct  buf *T_bufp;
                        char    *T_cp;
                        int     T_inbuf;
                struct {
                        struct  buf *T_bufp;
                        char    *T_cp;
                        int     T_inbuf;
+                       int     T_rec;
                } t_n;
                } t_n;
-#define        t_bufp  t_nu.t_n.T_bufp /* buffer we ripped off for network */
-#define        t_cp    t_nu.t_n.T_cp   /* pointer into the ripped off buffer */
-#define        t_inbuf t_nu.t_n.T_inbuf/* number chars in the magic buffer */
-#endif
+#define        t_bufp  t_nu.t_n.T_bufp         /* buffer allocated to protocol */
+#define        t_cp    t_nu.t_n.T_cp           /* pointer into the ripped off buffer */
+#define        t_inbuf t_nu.t_n.T_inbuf        /* number chars in the buffer */
+#define        t_rec   t_nu.t_n.T_rec          /* have a complete record */
        } t_nu;
        struct  clist t_outq;   /* output list to device */
        int     (*t_oproc)();   /* routine to start output */
        } t_nu;
        struct  clist t_outq;   /* output list to device */
        int     (*t_oproc)();   /* routine to start output */
@@ -72,35 +66,35 @@ struct tty
        char    t_char;         /* character temporary */
        char    t_ispeed;       /* input speed */
        char    t_ospeed;       /* output speed */
        char    t_char;         /* character temporary */
        char    t_ispeed;       /* input speed */
        char    t_ospeed;       /* output speed */
+/* begin local */
+       char    t_rocount;      /* chars input since a ttwrite() */
+       char    t_rocol;        /* t_col when first input this line */
+       struct  ltchars t_lchr; /* local special characters */
+       short   t_local;        /* local mode word */
+       short   t_lstate;       /* local state bits */
+/* end local */
        union {
        union {
-               struct tc t_chr;
+               struct tchars t_chr;
                struct clist t_ctlq;
        } t_un;
 };
 
 #define        tun     tp->t_un.t_chr
                struct clist t_ctlq;
        } t_un;
 };
 
 #define        tun     tp->t_un.t_chr
-
-/*
- * structure of arg for ioctl
- */
-struct ttiocb {
-       char    ioc_ispeed;
-       char    ioc_ospeed;
-       char    ioc_erase;
-       char    ioc_kill;
-       short   ioc_flags;
-};
+#define        tlun    tp->t_lchr
 
 #define        TTIPRI  28
 #define        TTOPRI  29
 
 
 #define        TTIPRI  28
 #define        TTOPRI  29
 
-#define        CERASE  '#'             /* default special characters */
-#define        CEOT    004
+#define        CTRL(c) ('c'&037)
+
+/* default special characters */
+#define        CERASE  '#'
+#define        CEOT    CTRL(d)
 #define        CKILL   '@'
 #define        CQUIT   034             /* FS, cntl shift L */
 #define        CINTR   0177            /* DEL */
 #define        CKILL   '@'
 #define        CQUIT   034             /* FS, cntl shift L */
 #define        CINTR   0177            /* DEL */
-#define        CSTOP   023             /* Stop output: ctl-s */
-#define        CSTART  021             /* Start output: ctl-q */
+#define        CSTOP   CTRL(s)
+#define        CSTART  CTRL(q)
 #define        CBRK    0377
 
 /* limits */
 #define        CBRK    0377
 
 /* limits */
@@ -108,36 +102,21 @@ struct    ttiocb {
 #define        TTLOWAT 125
 #define        TTYHOG  256
 
 #define        TTLOWAT 125
 #define        TTYHOG  256
 
-/* modes */
-#define        TANDEM  01
-#define        CBREAK  02
-#define        LCASE   04
-#define        ECHO    010
-#define        CRMOD   020
-#define        RAW     040
-#define        ODDP    0100
-#define        EVENP   0200
-#define        NLDELAY 001400
-#define        TBDELAY 006000
-#define        XTABS   006000
-#define        CRDELAY 030000
-#define        VTDELAY 040000
-
-/* Hardware bits */
+/* hardware bits */
 #define        DONE    0200
 #define        IENABLE 0100
 
 #define        DONE    0200
 #define        IENABLE 0100
 
-/* Internal state bits */
-#define        TIMEOUT 01              /* Delay timeout in progress */
-#define        WOPEN   02              /* Waiting for open to complete */
-#define        ISOPEN  04              /* Device is open */
+/* internal state bits */
+#define        TIMEOUT 01              /* delay timeout in progress */
+#define        WOPEN   02              /* waiting for open to complete */
+#define        ISOPEN  04              /* device is open */
 #define        FLUSH   010             /* outq has been flushed during DMA */
 #define        FLUSH   010             /* outq has been flushed during DMA */
-#define        CARR_ON 020             /* Software copy of carrier-present */
-#define        BUSY    040             /* Output in progress */
-#define        ASLEEP  0100            /* Wakeup when output done */
+#define        CARR_ON 020             /* software copy of carrier-present */
+#define        BUSY    040             /* output in progress */
+#define        ASLEEP  0100            /* wakeup when output done */
 #define        XCLUDE  0200            /* exclusive-use flag against open */
 #define        XCLUDE  0200            /* exclusive-use flag against open */
-#define        TTSTOP  0400            /* Output stopped by ctl-s */
-#define        HUPCLS  01000           /* Hang up upon last close */
+#define        TTSTOP  0400            /* output stopped by ctl-s */
+#define        HUPCLS  01000           /* hang up upon last close */
 #define        TBLOCK  02000           /* tandem queue blocked */
 #define        SPEEDS  04000           /* t_ispeed and t_ospeed used by driver */
 #define        PROTO1  010000          /* reserved for line discipline */
 #define        TBLOCK  02000           /* tandem queue blocked */
 #define        SPEEDS  04000           /* t_ispeed and t_ospeed used by driver */
 #define        PROTO1  010000          /* reserved for line discipline */
@@ -145,56 +124,16 @@ struct    ttiocb {
 #define        FSLEEP  040000          /* Wakeup on input framing */
 #define        CNTLQ   0100000         /* interpret t_un as clist */
 
 #define        FSLEEP  040000          /* Wakeup on input framing */
 #define        CNTLQ   0100000         /* interpret t_un as clist */
 
-/*
- * tty ioctl commands
- */
-#define        TIOCGETD        (('t'<<8)|0)
-#define        TIOCSETD        (('t'<<8)|1)
-#define        TIOCHPCL        (('t'<<8)|2)
-#define        TIOCMODG        (('t'<<8)|3)
-#define        TIOCMODS        (('t'<<8)|4)
-#define        TIOCGETP        (('t'<<8)|8)
-#define        TIOCSETP        (('t'<<8)|9)
-#define        TIOCSETN        (('t'<<8)|10)
-#define        TIOCEXCL        (('t'<<8)|13)
-#define        TIOCNXCL        (('t'<<8)|14)
-#define        TIOCFLUSH       (('t'<<8)|16)
-#define        TIOCSETC        (('t'<<8)|17)
-#define        TIOCGETC        (('t'<<8)|18)
-#define        TIOCSBRK        (('t'<<8)|19)
-#define        DIOCLSTN        (('d'<<8)|1)
-#define        DIOCNTRL        (('d'<<8)|2)
-#define        DIOCMPX         (('d'<<8)|3)
-#define        DIOCNMPX        (('d'<<8)|4)
-#define        DIOCSCALL       (('d'<<8)|5)
-#define        DIOCRCALL       (('d'<<8)|6)
-#define        DIOCPGRP        (('d'<<8)|7)
-#define        DIOCGETP        (('d'<<8)|8)
-#define        DIOCSETP        (('d'<<8)|9)
-#define        DIOCLOSE        (('d'<<8)|10)
-#define        DIOCTIME        (('d'<<8)|11)
-#define        DIOCRESET       (('d'<<8)|12)
-#define        DIOCSMETA       (('d'<<8)|13)
-#define        DIOCMERGE       (('d'<<8)|14)
-#define        DIOCICHAN       (('d'<<8)|15)
-#define        DIOCPAD         (('d'<<8)|16)
-#define        DIOCRMETA       (('d'<<8)|17)
-#define        DIOCXOUT        (('d'<<8)|18)
-#define        DIOCBMETA       (('d'<<8)|19)
-#define        DIOCAMETA       (('d'<<8)|20)
-#define        DIOCSBMETA      (('d'<<8)|21)
-#define        FIOCLEX         (('f'<<8)|1)
-#define        FIONCLEX        (('f'<<8)|2)
-#define        MXLSTN          (('x'<<8)|1)
-#define        MXNBLK          (('x'<<8)|2)
-
-/* ##bsb 1/12/80 (from stt) ioctl code for "capacity" call */
-/* returns no. of bytes left before EOF or hang in cp_nbytes */
-/* returns flag indicating EOF versus hang in cp_eof */
+/* define partab character types */
+#define        ORDINARY        0
+#define        CONTROL         1
+#define        BACKSPACE       2
+#define        NEWLINE         3
+#define        TAB             4
+#define        VTAB            5
+#define        RETURN          6
 
 
-#define        FIOCAPACITY     (('f'<<8)|99)
-
-struct capacity {
-       off_t   cp_nbytes;
-       int     cp_eof;
-};
+/* define dmctl actions */
+#define        DMSET           0
+#define        DMBIS           1
+#define        DMBIC           2