home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / tahoe / vba / vxreg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  6.8 KB  |  179 lines

  1. /*
  2.  * Copyright (c) 1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * This code is derived from software contributed to Berkeley by
  6.  * Computer Consoles Inc.
  7.  *
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Redistributions in binary form must reproduce the above copyright
  14.  *    notice, this list of conditions and the following disclaimer in the
  15.  *    documentation and/or other materials provided with the distribution.
  16.  * 3. All advertising materials mentioning features or use of this software
  17.  *    must display the following acknowledgement:
  18.  *    This product includes software developed by the University of
  19.  *    California, Berkeley and its contributors.
  20.  * 4. Neither the name of the University nor the names of its contributors
  21.  *    may be used to endorse or promote products derived from this software
  22.  *    without specific prior written permission.
  23.  *
  24.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  25.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34.  * SUCH DAMAGE.
  35.  *
  36.  *    @(#)vxreg.h    7.4 (Berkeley) 6/28/90
  37.  */
  38.  
  39. /*
  40.  * Vioc hardware interface structure.
  41.  */
  42. struct    vxdevice {
  43.     char    v_vioc;        /*  0 type of interrupt + vioc busy flag */
  44.     char    v_hdwre;    /*  1 trap, reset, or hard interrupt */
  45.     char    v_vcbsy;    /*  2 command busy (set by host) */
  46.     char    v_vcid;        /*  3 command identifier */
  47.     short    v_vcp[2];    /*  4 command pointer (sent by host) */
  48.     short    v_unused;    /*  8 unused */
  49.     short    v_rspoff;    /*  a offset into vblock for response buf */
  50.     char    v_ustat;    /*  c status */
  51.     char    v_uqual;    /*  d interrupt qualifier */
  52.     char    v_usdata[0x3E];    /*  e unsolicited interrupt data */
  53.     short    v_maxxmt;    /* 4C max xmit block size */
  54.     short    v_maxsilo;    /* 4E max silo size */
  55.     char    v_ident;    /* 50 identifies type of vioc */
  56.     char    v_fault;    /* 51 denotes fault or ready after reset */
  57.     short    v_dcd;        /* 52 bit mask for carr detect by port */
  58.     short    v_cts;        /* 54 bit mask for cts by port */
  59.     short    v_dsr;        /* 56 bit mask for dsr by port */
  60.     short    v_secrec;    /* 58 bit mask for secondary receive */
  61.     short    v_badport;    /* 5a bit mask of failed ports */
  62.     char    v_portyp[16];    /* 5c type of each port */
  63. };
  64.  
  65. /* control bits for v_vioc and v_hdwre */
  66. #define    V_RESET 0x1        /* cause a vioc reset */
  67. #define    V_TRP    0x2        /* cause a vioc trap */
  68. #define    V_INTR    0x4        /* cause a vioc interrupt */
  69. #define    V_ERR    0x80        /* generic error flag */
  70. #define    V_BSY    0x80        /* generic busy flag */
  71. #define    V_UNBSY    0x80        /* not busy for unsolicited interrupt */
  72.  
  73. /* command identifier codes */
  74. #define    VXC_LIDENT    0x0000        /* load ident, set int vectors */
  75. #define    VXC_XMITDTA    0x0200        /* transmit */
  76. #define    VXC_XMITIMM    0x0400        /* xmit immediate */
  77. #define    VXC_FDTATOX    0x0300        /* flush data */
  78. #define    VXC_LPARAX    0x0600        /* load params */
  79. #define    VXC_SNDBRKX    0x0C00        /* send break to port */
  80. #define    VXC_MDMCTL    0x1000        /* auto modem control */
  81. /* bisync specific command identifiers */
  82. #define    VXC_LPARAX1    0x060a
  83. #define    VXC_MDMCTL1    0x1004
  84. #define    VXC_HUNTMD1    0x0804
  85.  
  86. /* vioc types returned during config */
  87. #define    VXT_VIOCBOP    0x05        /* vioc-bop */
  88. #define    VXT_PVIOCX    0x0A        /* old connector panel vioc-x */
  89. #define    VXT_VIOCX    0x0B        /* new connector panel vioc-x */
  90. #define    VXT_VIOCB    0x0C        /* vioc-bisync */
  91. #define    VXT_NEW        0x10        /* new type bit (or'd in) */
  92.  
  93. #define    VX_BISYNC    0x1        /* bisync flag indicator for bscport */
  94.  
  95. /* connector panel types (per port) */
  96. #define    VXT_NONE    0        /* no connector panel */
  97. #define    VXT_8PORT    1        /* 8 port RS-232C */
  98. #define    VXT_RS422    2        /* 8 port RS-422 (nonexistent) */
  99. #define    VXT_4PORT    3        /* 4 port RS-232 (with DSR/RING) */
  100. #define    VXT_PARALLEL    4        /* 4 port panel parallel port */
  101.  
  102. /* v_fault status values */
  103. #define    VXF_READY    0x55        /* no err in vioc self-initializaton */
  104.  
  105. /* line parameters, set with VXC_LPARAX */
  106. #define    BITS5        0x00        /* 5 bits per character */
  107. #define    BITS6        0x80        /* 6 bits per character */
  108. #define    BITS7        0x40        /* 7 bits per character */
  109. #define    BITS8        0xc0        /* 8 bits per character */
  110.  
  111. #define    VNOPARITY    0x00        /* no parity bit */
  112. #define    VODDP        0x01        /* odd parity bit */
  113. #define    VEVENP        0x03        /* even parity bit */
  114.  
  115. #define    VSTOP1        0x04        /* 1 stop bit */
  116. #define    VSTOP2        0x0c        /* 2 stop bit */
  117.  
  118. #define    V19200        0x13        /* 19.2 kbaud */
  119.  
  120. /* modem control flags */
  121. #define    VMOD_ON        1
  122. #define    VMOD_OFF    0
  123.  
  124. #define    V_AUTO        0x00        /* auto control of RTS, uses CTS */
  125. #define    V_MANUAL    0x80        /* manual control of RTS, ignore CTS */
  126. #define    V_DTR_ON    0x02        /* set DTR output */
  127. #define    V_DTR_OFF    0x00        /* drop DTR output */
  128. #define    V_RTS        0x01        /* set RTS output (manual only) */
  129.  
  130. #define    BRK_CHR    040            /* break character */
  131. #define    DCD_ON    020            /* */
  132. #define    DCD_OFF    010            /* */
  133. #define    CTS_ON    004            /* */
  134. #define    DSR_ON    0200            /* modem signal states for bisync */
  135. #define    DSR_OFF 0100
  136. #define    DSR_CHG    (DSR_ON|DSR_OFF)
  137.  
  138. #define    VX_SILO    0x800            /* offset to base of silo */
  139.  
  140. /* input status bits returned in silo */
  141. #define    VX_PE    0x40            /* parity error */
  142. #define    VX_FE    0x80            /* framing error */
  143. #define    VX_RO    0xc0            /* receiver overrun */
  144.  
  145. /* VIOC Process Error (PROCER) codes */
  146. #define    VP_SILO_OFLOW    0x40        /* input silo error, non-fatal */
  147.  
  148. #define    VRESPLEN    12
  149. #define    VCMDLEN        64
  150. #define    VC_IQLEN    64        /* Interrupt circular queue length */
  151. #define    NVCXBUFS    16*3        /* 3 bufs per port per viocx */
  152. #define    VC_CMDBUFL    NVCXBUFS    /* circular cmd (to exec) queue len*/
  153.  
  154. struct    vcmds {
  155.     int    v_cmdsem;        /* # cmds waiting for itrque */
  156.     int    v_curcnt;        /* # cmds in itrque and executing */
  157.     caddr_t    v_curcmd[VCMDLEN];    /* pointers to cmds being executed */
  158.     int    v_fill;            /* circular fill index */
  159.     int    v_empty;        /* circular empty index */
  160.     caddr_t    cmdbuf[VC_CMDBUFL];    /* circular cmd (to exec) queue */
  161.     int    v_itrfill;        /* circular intr issue queue fill */
  162.     int    v_itrempt;        /* circular intr issue queue empty */
  163.     short    v_itrqueu[VC_IQLEN];    /* circular intr issue queue */
  164. };
  165.  
  166. struct    vxcmd {
  167.     struct    vxcmd *c_fwd;
  168.     short    cmd;
  169.     char    par[58];        /* pad to 64 total size */
  170. };
  171.  
  172. struct    vxmit {
  173.     char    line;
  174.     char    bcount;
  175.     char    ostream[6];
  176. };
  177.  
  178. #define    SSPEED    13            /* standard speed 9600 bps */
  179.