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

  1. /*-
  2.  * Copyright (c) 1991 The 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.  *    @(#)if_enpreg.h    7.2 (Berkeley) 5/8/91
  37.  */
  38.  
  39. /*    Copyright (c) 1984 by Communication Machinery Corporation
  40.  *
  41.  *    This file contains material which is proprietary to
  42.  *    Communication Machinery Corporation (CMC) and which
  43.  *    may not be divulged without the written permission
  44.  *    of CMC.
  45.  *
  46.  *    ENP-10 Ram Definition
  47.  *
  48.  *    3/15/85 Jon Phares
  49.  *    Update 7/10/85 S. Holmgren
  50.  *    ENP-10 update 7/21/85 J. Mullen
  51.  *    ENP-20 update 8/11/85 J. Mullen
  52.  *    Mods for CCI TAHOE system 8/14/85 J. Mullen
  53.  */
  54.  
  55. #define K        *1024
  56.  
  57. struct ether_addr {
  58.     u_char ea_addr[6];
  59. };
  60.  
  61. typedef struct ethlist {
  62.     int    e_listsize;        /* active addr entries */
  63.     struct    ether_addr e_baseaddr;    /* addr lance is working with */
  64.     struct    ether_addr e_addrs[16];    /* possible addresses */
  65. } ETHLIST;
  66.  
  67. typedef struct {
  68.     u_long    e_xmit_successful;    /* Successful transmissions */
  69.     u_long    e_mult_retry;        /* multiple retries on xmit */
  70.     u_long    e_one_retry;        /* single retries */
  71.     u_long    e_fail_retry;        /* too many retries */
  72.     u_long    e_deferrals;        /* xmit delayed 'cuz cable busy */
  73.     u_long    e_xmit_buff_err;    /* xmit data chaining failed --
  74.                            "can't happen" */
  75.     u_long    e_silo_underrun;    /* transmit data fetch failed */
  76.     u_long    e_late_coll;        /* collision after xmit */
  77.     u_long    e_lost_carrier;
  78.     u_long    e_babble;        /* xmit length > 1518 */
  79.     u_long    e_collision;
  80.     u_long    e_xmit_mem_err;
  81.     u_long    e_rcv_successful;    /* good receptions */
  82.     u_long    e_rcv_missed;        /* no recv buff available */
  83.     u_long    e_crc_err;        /* checksum failed */
  84.     u_long    e_frame_err;        /* crc error & data length != 0 mod 8 */
  85.     u_long    e_rcv_buff_err;        /* rcv data chain failure --
  86.                            "can't happen" */
  87.     u_long    e_silo_overrun;        /* receive data store failed */
  88.     u_long    e_rcv_mem_err;
  89. } ENPSTAT;
  90.  
  91. typedef struct RING {
  92.     short    r_rdidx;
  93.     short    r_wrtidx;
  94.     short    r_size;
  95.     short    r_pad;
  96.     int    r_slot[1];
  97. } RING;
  98.  
  99. typedef struct RING32 {
  100.     short    r_rdidx;
  101.     short    r_wrtidx;
  102.     short    r_size;
  103.     short    r_pad;            /* to make VAXen happy */
  104.     int    r_slot[32];
  105. } RING32;
  106.  
  107. /*
  108.  * ENP Ram data layout
  109.  */
  110.  
  111. /*
  112.  * Note: paged window (4 K) is identity mapped by ENP kernel to provide
  113.  * 124 K contiguous RAM (as reflected in RAM_SIZE)
  114.  */
  115. #define RAM_WINDOW    (128 K)
  116. #define IOACCESS_WINDOW (512)
  117. #define FIXED_WINDOW    (RAM_WINDOW - IOACCESS_WINDOW)
  118. #define RAMROM_SWAP    (4 K)
  119. #define RAM_SIZE    (FIXED_WINDOW - RAMROM_SWAP)
  120.  
  121. #define HOST_RAMSIZE    (48 K)
  122. #define ENP_RAMSIZE    (20 K)
  123.  
  124. typedef    struct iow20 {
  125.     char    pad0;    
  126.     char    hst2enp_interrupt;
  127.     char    pad1[510];
  128. } iow20;
  129.  
  130. struct enpdevice {
  131. #ifdef notdef
  132.     char    enp_ram_rom[4 K];
  133. #endif notdef
  134.     union {
  135.         char    all_ram[RAM_SIZE];
  136.         struct {
  137.             u_int    t_go;
  138.             u_int    t_pstart;
  139.         } t;
  140.         struct {
  141.             char    nram[RAM_SIZE - (HOST_RAMSIZE + ENP_RAMSIZE)];
  142.             char    hram[HOST_RAMSIZE];
  143.             char    kram[ENP_RAMSIZE];
  144.         } u_ram;
  145.         struct {
  146.             char    pad7[0x100];    /* starts 0x1100 - 0x2000 */
  147.             short    e_enpstate;    /* 1102 */
  148.             short    e_enpmode;    /* 1104 */
  149.             int    e_enpbase;    /* 1104 */
  150.             int    e_enprun;    /* 1108 */
  151.             u_short    e_intrvec;
  152.             u_short    e_dummy[3];
  153.             RING32    h_toenp;    /* 110C */
  154.             RING32    h_hostfree;        
  155.             RING32    e_tohost;        
  156.             RING32     e_enpfree;        
  157.             ENPSTAT    e_stat;
  158.             ETHLIST    e_netaddr;        
  159.         } iface;
  160.     } enp_u;
  161.     iow20    enp_iow;
  162. };
  163.  
  164. #define    enp_ram        enp_u.all_ram
  165. #define    enp_nram    enp_u.u_ram.nram
  166. #define    enp_hram    enp_u.u_ram.hram
  167. #define    enp_kram    enp_u.u_ram.kram
  168. #define    enp_go        enp_u.t.t_go
  169. #define    enp_prog_start    enp_u.t.t_pstart
  170. #define    enp_intrvec    enp_u.iface.e_intrvec
  171. #define enp_state    enp_u.iface.e_enpstate
  172. #define enp_mode    enp_u.iface.e_enpmode
  173. #define enp_base    enp_u.iface.e_enpbase
  174. #define enp_enprun    enp_u.iface.e_enprun
  175. #define enp_toenp    enp_u.iface.h_toenp
  176. #define enp_hostfree    enp_u.iface.h_hostfree
  177. #define enp_tohost    enp_u.iface.e_tohost
  178. #define enp_enpfree    enp_u.iface.e_enpfree
  179. #define enp_freembuf    enp_u.iface.h_freembuf
  180. #define enp_stat    enp_u.iface.e_stat
  181. #define enp_addr    enp_u.iface.e_netaddr
  182.  
  183. #define ENPVAL        0xff    /* enp_iow.hst2enp_interrupt poke value */
  184. #define RESETVAL    0x00    /* enp_iow.enp2hst_clear_intr poke value */
  185.  
  186. #define INTR_ENP(addr)        (addr->enp_iow.hst2enp_interrupt = ENPVAL)
  187.  
  188. #if ENP == 30
  189. #define ACK_ENP_INTR(addr)    (addr->enp_iow.enp2hst_clear_intr = RESETVAL)
  190. #define IS_ENP_INTR(addr)    (addr->enp_iow.enp2hst_clear_intr&0x80)
  191. #endif
  192.  
  193. #ifdef notdef
  194. #define RESET_ENP(addr)        (addr->enp_iow.hst2enp_reset = 01)
  195. #else
  196. #ifdef lint
  197. #define RESET_ENP(addr)        ((addr) = (addr))
  198. #else
  199. #define RESET_ENP(addr)
  200. #endif lint
  201. #endif notdef
  202.  
  203. #ifdef tahoe
  204. #define ENP_GO(addr,start) { \
  205.     int v = start; \
  206.     enpcopy((u_char *)&v, (u_char *)&addr->enp_prog_start, sizeof(v) ); \
  207.     v = 0x80800000; \
  208.     enpcopy((u_char *)&v, (u_char *)&addr->enp_go, sizeof(v) ); \
  209. }
  210. #else
  211. #define ENP_GO(addr,start,intvec ) { \
  212.     addr->enp_prog_start = (u_int)(start); \
  213.     addr->enp_intrvec = (u_short) intvec; \
  214.     addr->enp_go = 0x80800000; \
  215. }
  216. #endif tahoe
  217.  
  218. /*
  219.  * State bits
  220.  */
  221. #define S_ENPRESET    01        /* enp is in reset state */
  222. #define S_ENPRUN    02        /* enp is in run state */
  223.  
  224. /*
  225.  * Mode bits
  226.  */
  227. #define E_SWAP16    0x1        /* swap two octets within 16 */
  228. #define E_SWAP32    0x2        /* swap 16s within 32 */
  229. #define E_SWAPRD    0x4        /* swap on read */
  230. #define E_SWAPWRT    0x8        /* swap on write */
  231. #define E_DMA        0x10        /* enp does data moving */
  232.  
  233. #define E_EXAM_LIST    0x80000000    /* enp should examine addrlist */
  234. #define E_ADDR_SUPP    0x40000000    /* enp should use supplied addr */
  235.  
  236. /*
  237.  * Download ioctl definitions
  238.  */
  239. #define ENPIOGO        _IO('S',1)        /* start the enp */
  240. #define ENPIORESET    _IO('S',2)        /* reset the enp */
  241.  
  242. /*
  243.  * The ENP Data Buffer Structure
  244.  */
  245. typedef struct BCB {
  246.     struct    BCB *b_link;
  247.     short     b_stat;
  248.     short     b_len;
  249.     u_char    *b_addr;
  250.     short     b_msglen;
  251.     short     b_reserved;
  252. } BCB;
  253.