home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / include / sys / tty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1979-05-05  |  4.4 KB  |  163 lines

  1. /*
  2.  * A clist structure is the head
  3.  * of a linked list queue of characters.
  4.  * The characters are stored in 4-word
  5.  * blocks containing a link and several characters.
  6.  * The routines getc and putc
  7.  * manipulate these structures.
  8.  */
  9. struct clist
  10. {
  11.     int    c_cc;        /* character count */
  12.     char    *c_cf;        /* pointer to first char */
  13.     char    *c_cl;        /* pointer to last char */
  14. };
  15.  
  16. /*
  17.  * A tty structure is needed for
  18.  * each UNIX character device that
  19.  * is used for normal terminal IO.
  20.  * The routines in tty.c handle the
  21.  * common code associated with
  22.  * these structures.
  23.  * The definition and device dependent
  24.  * code is in each driver. (kl.c dc.c dh.c)
  25.  */
  26.  
  27. struct tc {
  28.     char    t_intrc;    /* interrupt */
  29.     char    t_quitc;    /* quit */
  30.     char    t_startc;    /* start output */
  31.     char    t_stopc;    /* stop output */
  32.     char    t_eofc;        /* end-of-file */
  33.     char    t_brkc;        /* input delimiter (like nl) */
  34. };
  35.  
  36. struct tty
  37. {
  38.     struct    clist t_rawq;    /* input chars right off device */
  39.     struct    clist t_canq;    /* input chars after erase and kill */
  40.     struct    clist t_outq;    /* output list to device */
  41.     int    (* t_oproc)();    /* routine to start output */
  42.     int    (* t_iproc)();    /* routine to start input */
  43.     struct chan *t_chan;    /* destination channel */
  44.     caddr_t    t_linep;    /* aux line discipline pointer */
  45.     caddr_t    t_addr;        /* device address */
  46.     dev_t    t_dev;        /* device number */
  47.     short    t_flags;    /* mode, settable by ioctl call */
  48.     short    t_state;    /* internal state, not visible externally */
  49.     short    t_pgrp;        /* process group name */
  50.     char    t_delct;    /* number of delimiters in raw q */
  51.     char    t_line;        /* line discipline */
  52.     char    t_col;        /* printing column of device */
  53.     char    t_erase;    /* erase character */
  54.     char    t_kill;        /* kill character */
  55.     char    t_char;        /* character temporary */
  56.     char    t_ispeed;    /* input speed */
  57.     char    t_ospeed;    /* output speed */
  58.     union {
  59.         struct tc;
  60.         struct clist t_ctlq;
  61.     } t_un;
  62. };
  63.  
  64. #define    tun    tp->t_un
  65.  
  66. /*
  67.  * structure of arg for ioctl
  68.  */
  69. struct    ttiocb {
  70.     char    ioc_ispeed;
  71.     char    ioc_ospeed;
  72.     char    ioc_erase;
  73.     char    ioc_kill;
  74.     int    ioc_flags;
  75. };
  76.  
  77. #define    TTIPRI    28
  78. #define    TTOPRI    29
  79.  
  80. #define    CERASE    '#'        /* default special characters */
  81. #define    CEOT    004
  82. #define    CKILL    '@'
  83. #define    CQUIT    034        /* FS, cntl shift L */
  84. #define    CINTR    0177        /* DEL */
  85. #define    CSTOP    023        /* Stop output: ctl-s */
  86. #define    CSTART    021        /* Start output: ctl-q */
  87. #define    CBRK    0377
  88.  
  89. /* limits */
  90. #define    TTHIWAT    100
  91. #define    TTLOWAT    50
  92. #define    TTYHOG    256
  93.  
  94. /* modes */
  95. #define    TANDEM    01
  96. #define    CBREAK    02
  97. #define    LCASE    04
  98. #define    ECHO    010
  99. #define    CRMOD    020
  100. #define    RAW    040
  101. #define    ODDP    0100
  102. #define    EVENP    0200
  103. #define    NLDELAY    001400
  104. #define    TBDELAY    006000
  105. #define    XTABS    006000
  106. #define    CRDELAY    030000
  107. #define    VTDELAY    040000
  108.  
  109. /* Hardware bits */
  110. #define    DONE    0200
  111. #define    IENABLE    0100
  112.  
  113. /* Internal state bits */
  114. #define    TIMEOUT    01        /* Delay timeout in progress */
  115. #define    WOPEN    02        /* Waiting for open to complete */
  116. #define    ISOPEN    04        /* Device is open */
  117. #define    FLUSH    010        /* outq has been flushed during DMA */
  118. #define    CARR_ON    020        /* Software copy of carrier-present */
  119. #define    BUSY    040        /* Output in progress */
  120. #define    ASLEEP    0100        /* Wakeup when output done */
  121. #define    XCLUDE    0200        /* exclusive-use flag against open */
  122. #define    TTSTOP    0400        /* Output stopped by ctl-s */
  123. #define    HUPCLS    01000        /* Hang up upon last close */
  124. #define    TBLOCK    02000        /* tandem queue blocked */
  125. #define    DKCMD    04000        /* datakit command channel */
  126. #define    DKMPX    010000        /* datakit user-multiplexed mode */
  127. #define    DKCALL    020000        /* datakit dial mode */
  128. #define    DKLINGR    040000        /* datakit lingering close mode */
  129. #define    CNTLQ    0100000        /* interpret t_un as clist */
  130.  
  131. /*
  132.  * tty ioctl commands
  133.  */
  134. #define    TIOCGETD    (('t'<<8)|0)
  135. #define    TIOCSETD    (('t'<<8)|1)
  136. #define    TIOCHPCL    (('t'<<8)|2)
  137. #define    TIOCMODG    (('t'<<8)|3)
  138. #define    TIOCMODS    (('t'<<8)|4)
  139. #define    TIOCGETP    (('t'<<8)|8)
  140. #define    TIOCSETP    (('t'<<8)|9)
  141. #define    TIOCSETN    (('t'<<8)|10)
  142. #define    TIOCEXCL    (('t'<<8)|13)
  143. #define    TIOCNXCL    (('t'<<8)|14)
  144. #define    TIOCFLUSH    (('t'<<8)|16)
  145. #define    TIOCSETC    (('t'<<8)|17)
  146. #define    TIOCGETC    (('t'<<8)|18)
  147. #define    DIOCLSTN    (('d'<<8)|1)
  148. #define    DIOCNTRL    (('d'<<8)|2)
  149. #define    DIOCMPX        (('d'<<8)|3)
  150. #define    DIOCNMPX    (('d'<<8)|4)
  151. #define    DIOCSCALL    (('d'<<8)|5)
  152. #define    DIOCRCALL    (('d'<<8)|6)
  153. #define    DIOCPGRP    (('d'<<8)|7)
  154. #define    DIOCGETP    (('d'<<8)|8)
  155. #define    DIOCSETP    (('d'<<8)|9)
  156. #define    DIOCLOSE    (('d'<<8)|10)
  157. #define    DIOCTIME    (('d'<<8)|11)
  158. #define    DIOCRESET    (('d'<<8)|12)
  159. #define    FIOCLEX        (('f'<<8)|1)
  160. #define    FIONCLEX    (('f'<<8)|2)
  161. #define    MXLSTN        (('x'<<8)|1)
  162. #define    MXNBLK        (('x'<<8)|2)
  163.