home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / tty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  5.1 KB  |  189 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_TTY_H
  11. #define _SYS_TTY_H
  12.  
  13. #ident    "@(#)/usr/include/sys/tty.h.sl 1.1 4.0 12/08/90 53779 AT&T-USL"
  14. /*
  15.  * A clist structure is the head of a linked list queue of characters.
  16.  * The routines getc* and putc* manipulate these structures.
  17.  */
  18.  
  19. struct clist {
  20.     int    c_cc;        /* character count */
  21.     struct cblock *c_cf;    /* pointer to first */
  22.     struct cblock *c_cl;    /* pointer to last */
  23. };
  24.  
  25. /* Macro to find clist structure given pointer into it    */
  26. #define CMATCH(pointer)        (char *)(cfree + (pointer - cfree))
  27.  
  28. /* Character control block for interrupt level control    */
  29.  
  30. struct ccblock {
  31.     caddr_t    c_ptr;        /* buffer address    */
  32.     ushort    c_count;    /* character count    */
  33.     ushort    c_size;        /* buffer size        */
  34. };
  35.  
  36. /*
  37.  * A tty structure is needed for each UNIX character device that
  38.  * is used for normal terminal IO.
  39.  */
  40. #define    NCC    8
  41. struct tty {
  42.     struct    clist t_rawq;    /* raw input queue */
  43.     struct    clist t_canq;    /* canonical queue */
  44.     struct    clist t_outq;    /* output queue */
  45.     struct    ccblock    t_tbuf;    /* tx control block */
  46.     struct    ccblock t_rbuf;    /* rx control block */
  47.     int    (* t_proc)();    /* routine for device functions */
  48.     ushort    t_iflag;    /* input modes */
  49.     ushort    t_oflag;    /* output modes */
  50.     ushort    t_cflag;    /* control modes */
  51.     ushort    t_lflag;    /* line discipline modes */
  52.     short    t_state;    /* internal state */
  53.     o_pid_t    t_pgrp;        /* process group name */
  54.     char    t_line;        /* line discipline */
  55.     char    t_delct;    /* delimiter count */
  56.     char    t_term;        /* terminal type */    
  57.     char    t_tmflag;    /* terminal flags */
  58.     char    t_col;        /* current column */
  59.     char    t_row;        /* current row */
  60.     char    t_vrow;        /* variable row */
  61.     char    t_lrow;        /* last physical row */
  62.     char    t_hqcnt;    /* no. high queue packets on t_outq */    
  63.     char    t_dstat;    /* used by terminal handlers
  64.                         and line disciplines */
  65.     unsigned char    t_cc[NCC+2];    /* settable control chars */
  66.     char    t_mstate;    /* emapping state */
  67.     unsigned char    t_mchar;/* saved emapping char */
  68.     char    t_merr;        /* emapping error flag */
  69.     char    t_xstate;    /* extended state */
  70.     struct emap    *t_mp;    /* emapping table */
  71.     unsigned char    t_schar;/* save timeout char instead of using lflag */
  72.     char    t_yyy[3];    /* reserved */
  73. };
  74.  
  75. /*
  76.  * The structure of a clist block
  77.  */
  78. #define    CLSIZE    64
  79. struct cblock {
  80.     struct cblock *c_next;
  81.     unsigned char    c_first;
  82.     unsigned char    c_last;
  83.     unsigned char    c_data[CLSIZE];
  84. };
  85.  
  86. extern struct cblock    *cfree;
  87. extern struct cblock    *getcb();
  88. extern struct cblock    *getcf();
  89. extern struct clist    ttnulq;
  90. extern int        cfreecnt;
  91.  
  92. struct chead {
  93.     struct cblock *c_next;
  94.     int    c_size;
  95.     int    c_flag;
  96. };
  97. extern struct chead cfreelist;
  98.  
  99. struct inter {
  100.     int    cnt;
  101. };
  102.  
  103. #define    QESC    0200    /* queue escape */
  104. #define    HQEND    01    /* high queue end */
  105.  
  106. #define    TTIPRI    28
  107. #define    TTOPRI    29
  108.  
  109. #ifdef u3b15
  110. /* following defs allow for job control in both vpm and stand-alone
  111.    tty environments */
  112. #define VPMTTY    1
  113. #define SATTY    2
  114. #endif
  115.  
  116. /* limits */
  117. extern int ttlowat[], tthiwat[];
  118. #define    TTYHOG    256
  119. #define    TTXOLO    132
  120. #define    TTXOHI    180
  121.  
  122. /* Hardware bits */
  123. #define    DONE    0200
  124. #define    IENABLE    0100
  125. #define    OVERRUN    040000
  126. #define    FRERROR    020000
  127. #define    PERROR    010000
  128.  
  129. /* Internal state */
  130. #define    TIMEOUT    01        /* Delay timeout in progress */
  131. #define    WOPEN    02        /* Waiting for open to complete */
  132. #define    ISOPEN    04        /* Device is open */
  133. #define    TBLOCK    010
  134. #define    CARR_ON    020        /* Software copy of carrier-present */
  135. #define    BUSY    040        /* Output in progress */
  136. #define    OASLP    0100        /* Wakeup when output done */
  137. #define    IASLP    0200        /* Wakeup when input done */
  138. #define    TTSTOP    0400        /* Output stopped by ctl-s */
  139. #define    EXTPROC    01000        /* External processing */
  140. #define    TACT    02000
  141. #define    CLESC    04000        /* Last char escape */
  142. #define    RTO    010000        /* Raw Timeout */
  143. #define    TTIOW    020000
  144. #define    TTXON    040000
  145. #define    TTXOFF    0100000
  146.  
  147. /* l_output status */
  148. #define    CPRES    0100000
  149.  
  150. /* device commands */
  151. #define    T_OUTPUT    0
  152. #define    T_TIME        1
  153. #define    T_SUSPEND    2
  154. #define    T_RESUME    3
  155. #define    T_BLOCK        4
  156. #define    T_UNBLOCK    5
  157. #define    T_RFLUSH    6
  158. #define    T_WFLUSH    7
  159. #define    T_BREAK        8
  160. #define    T_INPUT        9
  161. #define T_DISCONNECT    10
  162. #define    T_PARM        11
  163. #define    T_SWTCH        12
  164.  
  165. /*
  166.  * Terminal flags (set in t_tmflgs).
  167.  */
  168.  
  169. #define SNL    1        /* non-standard new-line needed */
  170. #define ANL    2        /* automatic new-line */
  171. #define LCF    4        /* Special treatment of last col, row */
  172. #define TERM_CTLECHO    010    /* Echo terminal control characters */
  173. #define TERM_INVIS    020    /* do not send escape sequences to user */
  174. #define QLOCKB        040    /* high queue locked for base level */
  175. #define QLOCKI        0100    /* high queue locked for interrupts */
  176. #define    TERM_BIT 0200        /* Bit reserved for terminal drivers. */
  177.                 /* Usually used to indicate that an esc*/
  178.                 /* character has arrived and that the  */
  179.                 /* next character is special.          */
  180.                 /* This bit is the same as the TM_SET  */
  181.                 /* bit which may never be set by a user*/
  182. /*
  183.  *    device reports
  184.  */
  185. #define    L_BUF        0
  186. #define    L_BREAK        3
  187.  
  188. #endif    /* _SYS_TTY_H */
  189.