if_dereg.h revision 1.2 1 1.2 ragge /* $NetBSD: if_dereg.h,v 1.2 2000/05/28 17:23:44 ragge Exp $ */
2 1.1 ragge
3 1.1 ragge /*
4 1.1 ragge * Copyright (c) 1982, 1986 Regents of the University of California.
5 1.1 ragge * All rights reserved.
6 1.1 ragge *
7 1.1 ragge * Redistribution and use in source and binary forms, with or without
8 1.1 ragge * modification, are permitted provided that the following conditions
9 1.1 ragge * are met:
10 1.1 ragge * 1. Redistributions of source code must retain the above copyright
11 1.1 ragge * notice, this list of conditions and the following disclaimer.
12 1.1 ragge * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 ragge * notice, this list of conditions and the following disclaimer in the
14 1.1 ragge * documentation and/or other materials provided with the distribution.
15 1.1 ragge * 3. All advertising materials mentioning features or use of this software
16 1.1 ragge * must display the following acknowledgement:
17 1.1 ragge * This product includes software developed by the University of
18 1.1 ragge * California, Berkeley and its contributors.
19 1.1 ragge * 4. Neither the name of the University nor the names of its contributors
20 1.1 ragge * may be used to endorse or promote products derived from this software
21 1.1 ragge * without specific prior written permission.
22 1.1 ragge *
23 1.1 ragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 ragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 ragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 ragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 ragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 ragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 ragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 ragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 ragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 ragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 ragge * SUCH DAMAGE.
34 1.1 ragge *
35 1.1 ragge * @(#)if_dereg.h 7.3 (Berkeley) 6/28/90
36 1.1 ragge */
37 1.1 ragge
38 1.1 ragge /*
39 1.1 ragge * DEC DEUNA interface
40 1.1 ragge */
41 1.1 ragge #ifdef notdef
42 1.1 ragge struct dedevice {
43 1.1 ragge union {
44 1.1 ragge short p0_w;
45 1.1 ragge char p0_b[2];
46 1.1 ragge } u_p0;
47 1.1 ragge #define pcsr0 u_p0.p0_w
48 1.1 ragge #define pclow u_p0.p0_b[0]
49 1.1 ragge #define pchigh u_p0.p0_b[1]
50 1.1 ragge short pcsr1;
51 1.1 ragge short pcsr2;
52 1.1 ragge short pcsr3;
53 1.1 ragge };
54 1.1 ragge #endif
55 1.1 ragge
56 1.1 ragge #define DE_PCSR0 0
57 1.1 ragge #define DE_PCSR1 2
58 1.1 ragge #define DE_PCSR2 4
59 1.1 ragge #define DE_PCSR3 6
60 1.1 ragge
61 1.1 ragge /*
62 1.1 ragge * PCSR 0 bit descriptions
63 1.1 ragge */
64 1.1 ragge #define PCSR0_SERI 0x8000 /* Status error interrupt */
65 1.1 ragge #define PCSR0_PCEI 0x4000 /* Port command error interrupt */
66 1.1 ragge #define PCSR0_RXI 0x2000 /* Receive done interrupt */
67 1.1 ragge #define PCSR0_TXI 0x1000 /* Transmit done interrupt */
68 1.1 ragge #define PCSR0_DNI 0x0800 /* Done interrupt */
69 1.1 ragge #define PCSR0_RCBI 0x0400 /* Receive buffer unavail intrpt */
70 1.1 ragge #define PCSR0_FATI 0x0100 /* Fatal error interrupt */
71 1.1 ragge #define PCSR0_INTR 0x0080 /* Interrupt summary */
72 1.1 ragge #define PCSR0_INTE 0x0040 /* Interrupt enable */
73 1.1 ragge #define PCSR0_RSET 0x0020 /* DEUNA reset */
74 1.1 ragge #define PCSR0_CMASK 0x000f /* command mask */
75 1.1 ragge
76 1.1 ragge #define PCSR0_BITS "\20\20SERI\17PCEI\16RXI\15TXI\14DNI\13RCBI\11FATI\10INTR\7INTE\6RSET"
77 1.1 ragge
78 1.1 ragge /* bits 0-3 are for the PORT_COMMAND */
79 1.1 ragge #define CMD_NOOP 0x0
80 1.1 ragge #define CMD_GETPCBB 0x1 /* Get PCB Block */
81 1.1 ragge #define CMD_GETCMD 0x2 /* Execute command in PCB */
82 1.1 ragge #define CMD_STEST 0x3 /* Self test mode */
83 1.1 ragge #define CMD_START 0x4 /* Reset xmit and receive ring ptrs */
84 1.1 ragge #define CMD_BOOT 0x5 /* Boot DEUNA */
85 1.1 ragge #define CMD_PDMD 0x8 /* Polling demand */
86 1.1 ragge #define CMD_TMRO 0x9 /* Sanity timer on */
87 1.1 ragge #define CMD_TMRF 0xa /* Sanity timer off */
88 1.1 ragge #define CMD_RSTT 0xb /* Reset sanity timer */
89 1.1 ragge #define CMD_STOP 0xf /* Suspend operation */
90 1.1 ragge
91 1.1 ragge /*
92 1.1 ragge * PCSR 1 bit descriptions
93 1.1 ragge */
94 1.1 ragge #define PCSR1_XPWR 0x8000 /* Transceiver power BAD */
95 1.1 ragge #define PCSR1_ICAB 0x4000 /* Interconnect cabling BAD */
96 1.1 ragge #define PCSR1_STCODE 0x3f00 /* Self test error code */
97 1.1 ragge #define PCSR1_PCTO 0x0080 /* Port command timed out */
98 1.1 ragge #define PCSR1_ILLINT 0x0040 /* Illegal interrupt */
99 1.1 ragge #define PCSR1_TIMEOUT 0x0020 /* Timeout */
100 1.1 ragge #define PCSR1_POWER 0x0010 /* Power fail */
101 1.1 ragge #define PCSR1_RMTC 0x0008 /* Remote console reserved */
102 1.1 ragge #define PCSR1_STMASK 0x0007 /* State */
103 1.1 ragge
104 1.1 ragge /* bit 0-3 are for STATE */
105 1.1 ragge #define STAT_RESET 0x0
106 1.1 ragge #define STAT_PRIMLD 0x1 /* Primary load */
107 1.1 ragge #define STAT_READY 0x2
108 1.1 ragge #define STAT_RUN 0x3
109 1.1 ragge #define STAT_UHALT 0x5 /* UNIBUS halted */
110 1.1 ragge #define STAT_NIHALT 0x6 /* NI halted */
111 1.1 ragge #define STAT_NIUHALT 0x7 /* NI and UNIBUS Halted */
112 1.1 ragge
113 1.1 ragge #define PCSR1_BITS "\20\20XPWR\17ICAB\10PCTO\7ILLINT\6TIMEOUT\5POWER\4RMTC"
114 1.1 ragge
115 1.1 ragge /*
116 1.1 ragge * Port Control Block Base
117 1.1 ragge */
118 1.1 ragge struct de_pcbb {
119 1.1 ragge int16_t pcbb0; /* function */
120 1.1 ragge int16_t pcbb2; /* command specific */
121 1.1 ragge int16_t pcbb4;
122 1.1 ragge int16_t pcbb6;
123 1.1 ragge };
124 1.1 ragge
125 1.1 ragge /* PCBB function codes */
126 1.1 ragge #define FC_NOOP 0x00 /* NO-OP */
127 1.1 ragge #define FC_LSUADDR 0x01 /* Load and start microaddress */
128 1.1 ragge #define FC_RDDEFAULT 0x02 /* Read default physical address */
129 1.1 ragge #define FC_RDPHYAD 0x04 /* Read physical address */
130 1.1 ragge #define FC_WTPHYAD 0x05 /* Write physical address */
131 1.1 ragge #define FC_RDMULTI 0x06 /* Read multicast address list */
132 1.1 ragge #define FC_WTMULTI 0x07 /* Read multicast address list */
133 1.1 ragge #define FC_RDRING 0x08 /* Read ring format */
134 1.1 ragge #define FC_WTRING 0x09 /* Write ring format */
135 1.1 ragge #define FC_RDCNTS 0x0a /* Read counters */
136 1.1 ragge #define FC_RCCNTS 0x0b /* Read and clear counters */
137 1.1 ragge #define FC_RDMODE 0x0c /* Read mode */
138 1.1 ragge #define FC_WTMODE 0x0d /* Write mode */
139 1.1 ragge #define FC_RDSTATUS 0x0e /* Read port status */
140 1.1 ragge #define FC_RCSTATUS 0x0f /* Read and clear port status */
141 1.1 ragge #define FC_DUMPMEM 0x10 /* Dump internal memory */
142 1.1 ragge #define FC_LOADMEM 0x11 /* Load internal memory */
143 1.1 ragge #define FC_RDSYSID 0x12 /* Read system ID parameters */
144 1.1 ragge #define FC_WTSYSID 0x13 /* Write system ID parameters */
145 1.1 ragge #define FC_RDSERAD 0x14 /* Read load server address */
146 1.1 ragge #define FC_WTSERAD 0x15 /* Write load server address */
147 1.1 ragge
148 1.1 ragge /*
149 1.1 ragge * Unibus Data Block Base (UDBB) for ring buffers
150 1.1 ragge */
151 1.1 ragge struct de_udbbuf {
152 1.1 ragge int16_t b_tdrbl; /* Transmit desc ring base low 16 bits */
153 1.1 ragge int8_t b_tdrbh; /* Transmit desc ring base high 2 bits */
154 1.1 ragge int8_t b_telen; /* Length of each transmit entry */
155 1.1 ragge int16_t b_trlen; /* Number of entries in the XMIT desc ring */
156 1.1 ragge int16_t b_rdrbl; /* Receive desc ring base low 16 bits */
157 1.1 ragge int8_t b_rdrbh; /* Receive desc ring base high 2 bits */
158 1.1 ragge int8_t b_relen; /* Length of each receive entry */
159 1.1 ragge int16_t b_rrlen; /* Number of entries in the RECV desc ring */
160 1.1 ragge };
161 1.1 ragge
162 1.1 ragge /*
163 1.1 ragge * Transmit/Receive Ring Entry
164 1.1 ragge */
165 1.1 ragge struct de_ring {
166 1.1 ragge int16_t r_slen; /* Segment length */
167 1.1 ragge int16_t r_segbl; /* Segment address (low 16 bits) */
168 1.1 ragge int8_t r_segbh; /* Segment address (hi 2 bits) */
169 1.1 ragge u_int8_t r_flags; /* Status flags */
170 1.1 ragge u_int16_t r_tdrerr; /* Errors */
171 1.1 ragge #define r_lenerr r_tdrerr
172 1.1 ragge };
173 1.1 ragge
174 1.1 ragge #define XFLG_OWN 0x80 /* If 0 then owned by driver */
175 1.1 ragge #define XFLG_ERRS 0x40 /* Error summary */
176 1.1 ragge #define XFLG_MTCH 0x20 /* Address match on xmit request */
177 1.1 ragge #define XFLG_MORE 0x10 /* More than one entry required */
178 1.1 ragge #define XFLG_ONE 0x08 /* One collision encountered */
179 1.1 ragge #define XFLG_DEF 0x04 /* Transmit deferred */
180 1.1 ragge #define XFLG_STP 0x02 /* Start of packet */
181 1.1 ragge #define XFLG_ENP 0x01 /* End of packet */
182 1.1 ragge
183 1.1 ragge #define XFLG_BITS "\10\10OWN\7ERRS\6MTCH\5MORE\4ONE\3DEF\2STP\1ENP"
184 1.1 ragge
185 1.1 ragge #define XERR_BUFL 0x8000 /* Buffer length error */
186 1.1 ragge #define XERR_UBTO 0x4000 /* UNIBUS tiemout */
187 1.1 ragge #define XERR_LCOL 0x1000 /* Late collision */
188 1.1 ragge #define XERR_LCAR 0x0800 /* Loss of carrier */
189 1.1 ragge #define XERR_RTRY 0x0400 /* Failed after 16 retries */
190 1.1 ragge #define XERR_TDR 0x03ff /* TDR value */
191 1.1 ragge
192 1.1 ragge #define XERR_BITS "\20\20BUFL\17UBTO\15LCOL\14LCAR\13RTRY"
193 1.1 ragge
194 1.1 ragge #define RFLG_OWN 0x80 /* If 0 then owned by driver */
195 1.1 ragge #define RFLG_ERRS 0x40 /* Error summary */
196 1.1 ragge #define RFLG_FRAM 0x20 /* Framing error */
197 1.1 ragge #define RFLG_OFLO 0x10 /* Message overflow */
198 1.1 ragge #define RFLG_CRC 0x08 /* CRC error */
199 1.1 ragge #define RFLG_STP 0x02 /* Start of packet */
200 1.1 ragge #define RFLG_ENP 0x01 /* End of packet */
201 1.1 ragge
202 1.1 ragge #define RFLG_BITS "\10\10OWN\7ERRS\6FRAM\5OFLO\4CRC\2STP\1ENP"
203 1.1 ragge
204 1.1 ragge #define RERR_BUFL 0x8000 /* Buffer length error */
205 1.1 ragge #define RERR_UBTO 0x4000 /* UNIBUS tiemout */
206 1.1 ragge #define RERR_NCHN 0x2000 /* No data chaining */
207 1.1 ragge #define RERR_MLEN 0x0fff /* Message length */
208 1.1 ragge
209 1.1 ragge #define RERR_BITS "\20\20BUFL\17UBTO\16NCHN"
210 1.1 ragge
211 1.1 ragge /* mode description bits */
212 1.1 ragge #define MOD_HDX 0x0001 /* Half duplex mode */
213 1.1 ragge #define MOD_LOOP 0x0004 /* Enable internal loopback */
214 1.1 ragge #define MOD_DTCR 0x0008 /* Disables CRC generation */
215 1.1 ragge #define MOD_DMNT 0x0200 /* Disable maintenance features */
216 1.1 ragge #define MOD_ECT 0x0400 /* Enable collision test */
217 1.1 ragge #define MOD_TPAD 0x1000 /* Transmit message pad enable */
218 1.1 ragge #define MOD_DRDC 0x2000 /* Disable data chaining */
219 1.1 ragge #define MOD_ENAL 0x4000 /* Enable all multicast */
220 1.1 ragge #define MOD_PROM 0x8000 /* Enable promiscuous mode */
221