1 1.5 christos /* $NetBSD: if_ilreg.h,v 1.5 2005/12/11 12:23:29 christos Exp $ */ 2 1.1 ragge /* 3 1.1 ragge * Copyright (c) 1982, 1986 Regents of the University of California. 4 1.1 ragge * All rights reserved. 5 1.1 ragge * 6 1.1 ragge * Redistribution and use in source and binary forms, with or without 7 1.1 ragge * modification, are permitted provided that the following conditions 8 1.1 ragge * are met: 9 1.1 ragge * 1. Redistributions of source code must retain the above copyright 10 1.1 ragge * notice, this list of conditions and the following disclaimer. 11 1.1 ragge * 2. Redistributions in binary form must reproduce the above copyright 12 1.1 ragge * notice, this list of conditions and the following disclaimer in the 13 1.1 ragge * documentation and/or other materials provided with the distribution. 14 1.3 agc * 3. Neither the name of the University nor the names of its contributors 15 1.1 ragge * may be used to endorse or promote products derived from this software 16 1.1 ragge * without specific prior written permission. 17 1.1 ragge * 18 1.1 ragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19 1.1 ragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 1.1 ragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 1.1 ragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 1.1 ragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 1.1 ragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 1.1 ragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 1.1 ragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 1.1 ragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 1.1 ragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 1.1 ragge * SUCH DAMAGE. 29 1.1 ragge * 30 1.1 ragge * @(#)if_ilreg.h 7.3 (Berkeley) 6/28/90 31 1.1 ragge */ 32 1.1 ragge 33 1.1 ragge /* 34 1.1 ragge * Interlan Ethernet Communications Controller interface 35 1.1 ragge */ 36 1.1 ragge #ifdef notdef 37 1.1 ragge struct ildevice { 38 1.1 ragge short il_csr; /* Command and Status Register */ 39 1.1 ragge short il_bar; /* Buffer Address Register */ 40 1.1 ragge short il_bcr; /* Byte Count Register */ 41 1.1 ragge }; 42 1.1 ragge #endif 43 1.1 ragge 44 1.1 ragge #define IL_CSR 0 45 1.1 ragge #define IL_BAR 2 46 1.1 ragge #define IL_BCR 4 47 1.1 ragge 48 1.1 ragge /* 49 1.1 ragge * Command and status bits 50 1.1 ragge */ 51 1.1 ragge #define IL_EUA 0xc000 /* Extended Unibus Address */ 52 1.1 ragge #define IL_CMD 0x3f00 /* Command Function Code */ 53 1.1 ragge #define IL_CDONE 0x0080 /* Command Done */ 54 1.1 ragge #define IL_CIE 0x0040 /* Command Interrupt Enable */ 55 1.1 ragge #define IL_RDONE 0x0020 /* Receive DMA Done */ 56 1.1 ragge #define IL_RIE 0x0010 /* Receive Interrupt Enable */ 57 1.1 ragge #define IL_STATUS 0x000f /* Command Status Code */ 58 1.1 ragge 59 1.1 ragge #define IL_BITS "\20\10CDONE\7CIE\6RDONE\5RIE" 60 1.1 ragge 61 1.1 ragge /* command definitions */ 62 1.1 ragge #define ILC_MLPBAK 0x0100 /* Set Module Interface Loopback Mode */ 63 1.1 ragge #define ILC_ILPBAK 0x0200 /* Set Internal Loopback Mode */ 64 1.1 ragge #define ILC_CLPBAK 0x0300 /* Clear Loopback Mode */ 65 1.1 ragge #define ILC_PRMSC 0x0400 /* Set Promiscuous Receive Mode */ 66 1.1 ragge #define ILC_CLPRMSC 0x0500 /* Clear Promiscuous Receive Mode */ 67 1.1 ragge #define ILC_RCVERR 0x0600 /* Set Receive-On-Error Bit */ 68 1.1 ragge #define ILC_CRCVERR 0x0700 /* Clear Receive-On-Error Bit */ 69 1.1 ragge #define ILC_OFFLINE 0x0800 /* Go Offline */ 70 1.1 ragge #define ILC_ONLINE 0x0900 /* Go Online */ 71 1.1 ragge #define ILC_DIAG 0x0a00 /* Run On-board Diagnostics */ 72 1.1 ragge #define ILC_ISA 0x0d00 /* Set Insert Source Address Mode */ 73 1.1 ragge #define ILC_CISA 0x0e00 /* Clear Insert Source Address Mode */ 74 1.1 ragge #define ILC_DEFPA 0x0f00 /* Set Physical Address to Default */ 75 1.1 ragge #define ILC_ALLMC 0x1000 /* Set Receive All Multicast Packets */ 76 1.1 ragge #define ILC_CALLMC 0x1100 /* Clear Receive All Multicast */ 77 1.1 ragge #define ILC_STAT 0x1800 /* Report and Reset Statistics */ 78 1.1 ragge #define ILC_DELAYS 0x1900 /* Report Collision Delay Times */ 79 1.1 ragge #define ILC_RCV 0x2000 /* Supply Receive Buffer */ 80 1.1 ragge #define ILC_LDXMIT 0x2800 /* Load Transmit Data */ 81 1.1 ragge #define ILC_XMIT 0x2900 /* Load Transmit Data and Send */ 82 1.1 ragge #define ILC_LDGRPS 0x2a00 /* Load Group Addresses */ 83 1.1 ragge #define ILC_RMGRPS 0x2b00 /* Delete Group Addresses */ 84 1.1 ragge #define ILC_LDPA 0x2c00 /* Load Physical Address */ 85 1.1 ragge #define ILC_FLUSH 0x3000 /* Flush Receive BAR/BCR Queue */ 86 1.1 ragge #define ILC_RESET 0x3f00 /* Reset */ 87 1.1 ragge 88 1.1 ragge /* 89 1.1 ragge * Error codes found in the status bits of the csr. 90 1.1 ragge */ 91 1.1 ragge #define ILERR_SUCCESS 0 /* command successful */ 92 1.1 ragge #define ILERR_RETRIES 1 /* " " with retries */ 93 1.1 ragge #define ILERR_BADCMD 2 /* illegal command */ 94 1.1 ragge #define ILERR_INVCMD 3 /* invalid command */ 95 1.1 ragge #define ILERR_RECVERR 4 /* receiver error */ 96 1.1 ragge #define ILERR_BUFSIZ 5 /* buffer size too big */ 97 1.1 ragge #define ILERR_FRAMESIZ 6 /* frame size too small */ 98 1.1 ragge #define ILERR_COLLISIONS 8 /* excessive collisions */ 99 1.1 ragge #define ILERR_BUFALIGNMENT 10 /* buffer not word aligned */ 100 1.1 ragge #define ILERR_NXM 15 /* non-existent memory */ 101 1.1 ragge 102 1.1 ragge #define NILERRS 16 103 1.1 ragge #ifdef ILERRS 104 1.1 ragge char *ilerrs[NILERRS] = { 105 1.1 ragge "success", /* 0 */ 106 1.4 simonb "success with retries", /* 1 */ 107 1.1 ragge "illegal command", /* 2 */ 108 1.1 ragge "inappropriate command", /* 3 */ 109 1.1 ragge "failure", /* 4 */ 110 1.1 ragge "buffer size exceeded", /* 5 */ 111 1.1 ragge "frame too small", /* 6 */ 112 1.1 ragge 0, /* 7 */ 113 1.1 ragge "excessive collisions", /* 8 */ 114 1.1 ragge 0, /* 9 */ 115 1.1 ragge "buffer alignment error", /* 10 */ 116 1.1 ragge 0, /* 11 */ 117 1.1 ragge 0, /* 12 */ 118 1.1 ragge 0, /* 13 */ 119 1.1 ragge 0, /* 14 */ 120 1.1 ragge "non-existent memory" /* 15 */ 121 1.1 ragge }; 122 1.1 ragge #endif 123 1.1 ragge 124 1.1 ragge /* 125 1.1 ragge * Diagnostics codes. 126 1.1 ragge */ 127 1.1 ragge #define ILDIAG_SUCCESS 0 /* no problems */ 128 1.1 ragge #define ILDIAG_CHKSUMERR 1 /* ROM/RAM checksum error */ 129 1.1 ragge #define ILDIAG_DMAERR 2 /* DMA not working */ 130 1.1 ragge #define ILDIAG_XMITERR 3 /* xmit circuitry failure */ 131 1.1 ragge #define ILDIAG_RECVERR 4 /* rcvr circuitry failure */ 132 1.1 ragge #define ILDIAG_LOOPBACK 5 /* loopback test failed */ 133 1.1 ragge 134 1.1 ragge #define NILDIAGS 6 135 1.1 ragge #ifdef ILDIAGS 136 1.1 ragge char *ildiag[NILDIAGS] = { 137 1.1 ragge "success", /* 0 */ 138 1.1 ragge "checksum error", /* 1 */ 139 1.2 wiz "NM10 DMA error", /* 2 */ 140 1.1 ragge "transmitter error", /* 3 */ 141 1.1 ragge "receiver error", /* 4 */ 142 1.1 ragge "loopback failure", /* 5 */ 143 1.1 ragge }; 144 1.1 ragge #endif 145 1.1 ragge 146 1.1 ragge /* 147 1.1 ragge * Frame status bits, returned in frame status byte 148 1.1 ragge * at the top of each received packet. 149 1.1 ragge */ 150 1.1 ragge #define ILFSTAT_C 0x1 /* CRC error */ 151 1.1 ragge #define ILFSTAT_A 0x2 /* alignment error */ 152 1.1 ragge #define ILFSTAT_L 0x4 /* 1+ frames lost just before */ 153