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