home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / tty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  5.1 KB  |  189 lines

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