if_esreg.h revision 1.5 1 1.5 mhitch /* $NetBSD: if_esreg.h,v 1.5 2002/03/03 18:21:37 mhitch Exp $ */
2 1.1 chopps
3 1.1 chopps /*
4 1.1 chopps * Copyright (c) 1995 Michael L. Hitch
5 1.1 chopps * All rights reserved.
6 1.1 chopps *
7 1.1 chopps * Redistribution and use in source and binary forms, with or without
8 1.1 chopps * modification, are permitted provided that the following conditions
9 1.1 chopps * are met:
10 1.1 chopps * 1. Redistributions of source code must retain the above copyright
11 1.1 chopps * notice, this list of conditions and the following disclaimer.
12 1.1 chopps * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 chopps * notice, this list of conditions and the following disclaimer in the
14 1.1 chopps * documentation and/or other materials provided with the distribution.
15 1.1 chopps * 3. All advertising materials mentioning features or use of this software
16 1.1 chopps * must display the following acknowledgement:
17 1.1 chopps * This product includes software developed by Michael L. Hitch.
18 1.1 chopps * 4. The name of the author may not be used to endorse or promote products
19 1.1 chopps * derived from this software without specific prior written permission
20 1.1 chopps *
21 1.1 chopps * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.1 chopps * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.1 chopps * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.1 chopps * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.1 chopps * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.1 chopps * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.1 chopps * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.1 chopps * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.1 chopps * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.1 chopps * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.1 chopps */
32 1.1 chopps
33 1.1 chopps /*
34 1.1 chopps * SMC 91C90 register definitions
35 1.1 chopps */
36 1.1 chopps
37 1.1 chopps union smcregs {
38 1.1 chopps struct {
39 1.1 chopps volatile u_short tcr; /* Transmit Control Register */
40 1.1 chopps volatile u_short ephsr; /* EPH Status Register */
41 1.1 chopps volatile u_short rcr; /* Receive Control Register */
42 1.1 chopps volatile u_short ecr; /* Counter Register */
43 1.1 chopps volatile u_short mir; /* Memory Information Register */
44 1.1 chopps volatile u_short mcr; /* Memory Configuration Register */
45 1.1 chopps volatile u_short resv;
46 1.1 chopps volatile u_short bsr; /* Bank Select Register */
47 1.1 chopps } b0;
48 1.1 chopps struct {
49 1.1 chopps volatile u_short cr; /* Configuration Register */
50 1.1 chopps volatile u_short bar; /* Base Address Register */
51 1.1 chopps volatile u_short iar[3]; /* Individual Address Registers */
52 1.1 chopps volatile u_short gpr; /* General Purpose Register */
53 1.1 chopps volatile u_short ctr; /* Control Register */
54 1.1 chopps volatile u_short bsr; /* Bank Select Register */
55 1.1 chopps } b1;
56 1.1 chopps struct {
57 1.1 chopps volatile u_short mmucr; /* MMU Command Register */
58 1.1 chopps volatile u_char pnr; /* Packet Number Register */
59 1.1 chopps volatile u_char arr; /* Allocation Result Register */
60 1.1 chopps volatile u_short fifo; /* FIFO Ports Register */
61 1.1 chopps volatile u_short ptr; /* Pointer Register */
62 1.1 chopps volatile u_short data; /* Data Register */
63 1.1 chopps volatile u_short datax; /* Data Register (2nd mapping) */
64 1.1 chopps volatile u_char ist; /* Interrupt Status Register */
65 1.1 chopps volatile u_char msk; /* Interrupt Mask Register */
66 1.1 chopps volatile u_short bsr; /* Bank Select Register */
67 1.1 chopps } b2;
68 1.1 chopps struct {
69 1.1 chopps volatile u_short mt[4]; /* Multicast Table */
70 1.1 chopps volatile u_short resv[3];
71 1.1 chopps volatile u_short bsr; /* Bank Select Register */
72 1.1 chopps } b3;
73 1.3 chopps /*
74 1.3 chopps * Bank 2 registers defined as u_short fields
75 1.3 chopps */
76 1.3 chopps struct {
77 1.3 chopps volatile u_short mmucr; /* MMU Command Register */
78 1.3 chopps volatile u_short pnrarr;/* Packet Number/Allocation Result */
79 1.3 chopps volatile u_short fifo; /* FIFO Ports Register */
80 1.3 chopps volatile u_short ptr; /* Pointer Register */
81 1.3 chopps volatile u_short data; /* Data Register */
82 1.3 chopps volatile u_short datax; /* Data Register (2nd mapping) */
83 1.3 chopps volatile u_short istmsk;/* Interrupt Status/Mask Register */
84 1.3 chopps volatile u_short bsr; /* Bank Select Register */
85 1.3 chopps } w2;
86 1.1 chopps };
87 1.1 chopps
88 1.1 chopps /* Transmit Control Register */
89 1.1 chopps #define TCR_PAD_EN 0x8000 /* Pad short frames */
90 1.1 chopps #define TCR_TXENA 0x0100 /* Transmit enabled */
91 1.1 chopps #define TCR_MON_CSN 0x0004 /* Monitor carrier */
92 1.1 chopps
93 1.1 chopps /* EPH Status Register */
94 1.1 chopps #define EPHSR_16COL 0x1000 /* 16 collisions reached */
95 1.1 chopps #define EPHSR_MULCOL 0x0400 /* Multiple collsions */
96 1.1 chopps #define EPHSR_TX_SUC 0x0100 /* Last transmit sucessful */
97 1.1 chopps #define EPHSR_LOST_CAR 0x0004 /* Lost carrier */
98 1.1 chopps
99 1.1 chopps /* Receive Control Register */
100 1.1 chopps #define RCR_ALLMUL 0x0400 /* Accept all Multicast frames */
101 1.1 chopps #define RCR_PRMS 0x0200 /* Promiscuous mode */
102 1.1 chopps #define RCR_EPH_RST 0x0080 /* Software activated Reset */
103 1.1 chopps #define RCR_FILT_CAR 0x0040 /* Filter carrier */
104 1.1 chopps #define RCR_STRIP_CRC 0x0002 /* Strip CRC */
105 1.1 chopps #define RCR_RXEN 0x0001 /* Receiver enabled */
106 1.1 chopps
107 1.1 chopps /* Counter Register */
108 1.1 chopps #define ECR_MCC 0xf000 /* Multiple collision count */
109 1.1 chopps #define ECR_SCC 0x0f00 /* Single collision count */
110 1.1 chopps #define ECR_EDTX 0x00f0 /* Excess deferred TX count */
111 1.1 chopps #define ECR_DTX 0x000f /* Deferred TX count */
112 1.1 chopps
113 1.1 chopps /* Configuration Register */
114 1.1 chopps #define CR_RAM32K 0x2000 /* 32Kx16 RAM */
115 1.1 chopps #define CR_NO_WAIT_ST 0x0010 /* No wait state */
116 1.1 chopps #define CR_SET_SQLCH 0x0002 /* Squelch level 240mv */
117 1.1 chopps
118 1.1 chopps /* Control Register */
119 1.5 mhitch #define CTR_TE_ENA 0x2000 /* Transmit Error enable */
120 1.1 chopps #define CTR_AUTO_RLSE 0x0008 /* Auto Release */
121 1.1 chopps
122 1.1 chopps /* MMU Command Register */
123 1.1 chopps #define MMUCR_NOOP 0x0000 /* No operation */
124 1.1 chopps #define MMUCR_ALLOC 0x2000 /* Allocate memory for TX */
125 1.1 chopps #define MMUCR_RESET 0x4000 /* Reset to intitial state */
126 1.1 chopps #define MMUCR_REM_RX 0x6000 /* Remove frame from top of RX FIFO */
127 1.1 chopps #define MMUCR_REMRLS_RX 0x8000 /* Remove & release from top of RX FIFO */
128 1.1 chopps #define MMUCR_RLSPKT 0xa000 /* Release specific packet */
129 1.1 chopps #define MMUCR_ENQ_TX 0xc000 /* Enqueue packet into TX FIFO */
130 1.1 chopps #define MMUCR_RESET_TX 0xe000 /* Reset TX FIFOs */
131 1.1 chopps #define MMUCR_BUSY 0x0100 /* MMU busy */
132 1.1 chopps
133 1.1 chopps /* Allocation Result Register */
134 1.1 chopps #define ARR_FAILED 0x80 /* Allocation failed */
135 1.1 chopps #define ARR_APN 0x1f /* Allocated packet number */
136 1.1 chopps
137 1.1 chopps /* FIFO Ports Register */
138 1.1 chopps #define FIFO_TEMPTY 0x8000 /* TX queue empty */
139 1.1 chopps #define FIFO_TXPNR 0x1f00 /* TX done packet number */
140 1.1 chopps #define FIFO_REMPTY 0x0080 /* RX FIFO empty */
141 1.1 chopps #define FIFO_RXPNR 0x001f /* RX FIFO packet number */
142 1.1 chopps
143 1.1 chopps /* Pointer Register */
144 1.1 chopps #define PTR_RCV 0x0080 /* Use Receive area */
145 1.1 chopps #define PTR_AUTOINCR 0x0040 /* Auto increment pointer on access */
146 1.1 chopps #define PTR_READ 0x0020 /* Read access */
147 1.1 chopps
148 1.1 chopps /* Interrupt Status Register */
149 1.1 chopps #define IST_EPHINT 0x20 /* EPH Interrupt */
150 1.1 chopps #define IST_RX_OVRN 0x10 /* RX Overrun */
151 1.1 chopps #define IST_ALLOC 0x08 /* MMU Allocation completed */
152 1.1 chopps #define IST_TX_EMPTY 0x04 /* TX FIFO empty */
153 1.1 chopps #define IST_TX 0x02 /* TX complete */
154 1.1 chopps #define IST_RX 0x01 /* RX complete */
155 1.1 chopps
156 1.1 chopps /* Interrupt Acknowlege Register */
157 1.1 chopps #define ACK_RX_OVRN IST_RX_OVRN
158 1.1 chopps #define ACK_TX_EMPTY IST_TX_EMPTY
159 1.1 chopps #define ACK_TX IST_TX
160 1.1 chopps
161 1.1 chopps /* Interrupt Mask Register */
162 1.1 chopps #define MSK_EPHINT 0x20 /* EPH Interrupt */
163 1.1 chopps #define MSK_RX_OVRN 0x10 /* RX Overrun */
164 1.1 chopps #define MSK_ALLOC 0x08 /* MMU Allocation completed */
165 1.1 chopps #define MSK_TX_EMPTY 0x04 /* TX FIFO empty */
166 1.1 chopps #define MSK_TX 0x02 /* TX complete */
167 1.1 chopps #define MSK_RX 0x01 /* RX complete */
168 1.2 mycroft
169 1.2 mycroft /* Bank Select Register */
170 1.4 mhitch #define BSR_MASK 0x0300
171 1.2 mycroft #define BSR_BANK0 0x0000 /* Select bank 0 */
172 1.2 mycroft #define BSR_BANK1 0x0100 /* Select bank 1 */
173 1.2 mycroft #define BSR_BANK2 0x0200 /* Select bank 2 */
174 1.2 mycroft #define BSR_BANK3 0x0300 /* Select bank 3 */
175 1.1 chopps
176 1.1 chopps /* Packet Receive Frame Status Word */
177 1.1 chopps #define RFSW_ALGNERR 0x8000 /* Alignment Error */
178 1.1 chopps #define RFSW_BRDCST 0x4000 /* Broadcast frame */
179 1.1 chopps #define RFSW_BADCRC 0x2000 /* Bad CRC */
180 1.1 chopps #define RFSW_ODDFRM 0x1000 /* Odd number of bytes in frame */
181 1.1 chopps #define RFSW_TOOLNG 0x0800 /* Frame was too long */
182 1.1 chopps #define RFSW_TOOSHORT 0x0400 /* Frame was too short */
183 1.1 chopps #define RFSW_HASH 0x007e /* Multicast hash value */
184 1.1 chopps #define RFSW_MULTCAST 0x0001 /* Multicast frame */
185 1.1 chopps
186 1.1 chopps /* Control byte */
187 1.1 chopps #define CTLB_ODD 0x20 /* Odd number of bytes in frame */
188 1.1 chopps #define CTLB_CRC 0x10 /* Append CRC to transmitted frame */
189