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