mb8795reg.h revision 1.3 1 1.3 mycroft /* $NetBSD: mb8795reg.h,v 1.3 2002/09/11 01:46:32 mycroft Exp $ */
2 1.1 dbj /*
3 1.1 dbj * Copyright (c) 1998 Darrin B. Jewell
4 1.1 dbj * All rights reserved.
5 1.1 dbj *
6 1.1 dbj * Redistribution and use in source and binary forms, with or without
7 1.1 dbj * modification, are permitted provided that the following conditions
8 1.1 dbj * are met:
9 1.1 dbj * 1. Redistributions of source code must retain the above copyright
10 1.1 dbj * notice, this list of conditions and the following disclaimer.
11 1.1 dbj * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 dbj * notice, this list of conditions and the following disclaimer in the
13 1.1 dbj * documentation and/or other materials provided with the distribution.
14 1.1 dbj * 3. All advertising materials mentioning features or use of this software
15 1.1 dbj * must display the following acknowledgement:
16 1.1 dbj * This product includes software developed by Darrin B. Jewell
17 1.1 dbj * 4. The name of the author may not be used to endorse or promote products
18 1.1 dbj * derived from this software without specific prior written permission
19 1.1 dbj *
20 1.1 dbj * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 dbj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 dbj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 dbj * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 dbj * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 dbj * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 dbj * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 dbj * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 dbj * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 dbj * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 dbj */
31 1.1 dbj
32 1.1 dbj /*
33 1.1 dbj * Fujitsu Ethernet Data Link Controller (MB8795)
34 1.1 dbj * and the Fujitsu Manchester Encoder/Decoder (MB502).
35 1.1 dbj */
36 1.1 dbj
37 1.2 dbj #if 0
38 1.3 mycroft struct mb8795_regs {
39 1.3 mycroft unsigned char mb8795_txstat; /* tx status */
40 1.3 mycroft unsigned char mb8795_txmask; /* tx interrupt condition mask */
41 1.3 mycroft unsigned char mb8795_rxstat; /* rx status */
42 1.3 mycroft unsigned char mb8795_rxmask; /* rx interrupt condition mask */
43 1.3 mycroft unsigned char mb8795_txmode; /* tx control/mode register */
44 1.3 mycroft unsigned char mb8795_rxmode; /* rx control/mode register */
45 1.3 mycroft unsigned char mb8795_reset; /* reset mode */
46 1.3 mycroft unsigned char mb8795_tdc_lsb; /* transmit data count LSB */
47 1.3 mycroft unsigned char mb8795_addr[6]; /* physical address */
48 1.3 mycroft unsigned char mb8795_reserved;
49 1.3 mycroft unsigned char mb8795_tdc_msb; /* transmit data count MSB */
50 1.1 dbj };
51 1.2 dbj #endif
52 1.1 dbj
53 1.1 dbj /* transmitter status (address 0) */
54 1.3 mycroft #define MB8795_TXSTAT 0
55 1.1 dbj
56 1.3 mycroft #define MB8795_TXSTAT_READY 0x80 /* ready for packet */
57 1.3 mycroft #define MB8795_TXSTAT_BUSY 0x40 /* receive carrier detect */
58 1.3 mycroft #define MB8795_TXSTAT_TXRECV 0x20 /* transmission received */
59 1.3 mycroft #define MB8795_TXSTAT_SHORTED 0x10 /* possible coax short */
60 1.3 mycroft #define MB8795_TXSTAT_UNDERFLOW 0x08 /* underflow on xmit */
61 1.3 mycroft #define MB8795_TXSTAT_COLLERR 0x04 /* collision detected */
62 1.3 mycroft #define MB8795_TXSTAT_COLLERR16 0x02 /* 16th collision error */
63 1.3 mycroft #define MB8795_TXSTAT_PARERR 0x01 /* parity error in tx data */
64 1.3 mycroft #define MB8795_TXSTAT_CLEAR 0xff /* clear all status bits */
65 1.1 dbj
66 1.3 mycroft #define MB8795_TXSTAT_BITS \
67 1.1 dbj "\20\10READY\07BUSY\06TXRECV\05SHORTED\
68 1.1 dbj \04UNDERFLOW\03COLLERR\02COLLERR16\01PARERR"
69 1.1 dbj
70 1.1 dbj /* transmit masks (address 1) */
71 1.3 mycroft #define MB8795_TXMASK 1
72 1.1 dbj
73 1.3 mycroft #define MB8795_TXMASK_READYIE 0x80 /* tx int on packet ready */
74 1.3 mycroft #define MB8795_TXMASK_TXRXIE 0x20 /* tx int on transmit rec'd */
75 1.3 mycroft #define MB8795_TXMASK_UNDERFLOWIE 0x08 /* tx int on underflow */
76 1.3 mycroft #define MB8795_TXMASK_COLLIE 0x04 /* tx int on collision */
77 1.3 mycroft #define MB8795_TXMASK_COLL16IE 0x02 /* tx int on 16th collision */
78 1.3 mycroft #define MB8795_TXMASK_PARERRIE 0x01 /* tx int on parity error */
79 1.1 dbj
80 1.3 mycroft #define MB8795_TXMASK_BITS \
81 1.1 dbj "\20\10READYIE\06TXRXIE\04UNDERFLOWIE\03COLLIE\02COLL16IE\01PARERRIE"
82 1.1 dbj
83 1.1 dbj /* cummulative receiver status (address 2) */
84 1.3 mycroft #define MB8795_RXSTAT 2
85 1.1 dbj
86 1.3 mycroft #define MB8795_RXSTAT_OK 0x80 /* packet received is correct */
87 1.3 mycroft #define MB8795_RXSTAT_RESET 0x10 /* reset packet received */
88 1.3 mycroft #define MB8795_RXSTAT_SHORT 0x08 /* < minimum length */
89 1.3 mycroft #define MB8795_RXSTAT_ALIGNERR 0x04 /* alignment error */
90 1.3 mycroft #define MB8795_RXSTAT_CRCERR 0x02 /* CRC error */
91 1.3 mycroft #define MB8795_RXSTAT_OVERFLOW 0x01 /* receiver FIFO overflow */
92 1.3 mycroft #define MB8795_RXSTAT_CLEAR 0xff /* clear all status bits */
93 1.1 dbj
94 1.3 mycroft #define MB8795_RXSTAT_BITS \
95 1.1 dbj "\20\10OK\05RESET\04SHORT\03ALIGNERR\02CRCERR\01OVERFLOW"
96 1.1 dbj
97 1.1 dbj /* receiver masks (address 3) */
98 1.3 mycroft #define MB8795_RXMASK 3
99 1.1 dbj
100 1.3 mycroft #define MB8795_RXMASK_OKIE 0x80 /* rx int on packet ok */
101 1.3 mycroft #define MB8795_RXMASK_RESETIE 0x10 /* rx int on reset packet */
102 1.3 mycroft #define MB8795_RXMASK_SHORTIE 0x08 /* rx int on short packet */
103 1.3 mycroft #define MB8795_RXMASK_ALIGNERRIE 0x04 /* rx int on align error */
104 1.3 mycroft #define MB8795_RXMASK_CRCERRIE 0x02 /* rx int on CRC error */
105 1.3 mycroft #define MB8795_RXMASK_OVERFLOWIE 0x01 /* rx int on overflow error */
106 1.1 dbj
107 1.3 mycroft #define MB8795_RXMASK_BITS \
108 1.1 dbj "\20\10OKIE\05RESETIE\04SHORTIE\03ALIGNERRIE\02CRCERRIE\01OVERFLOWIE"
109 1.1 dbj
110 1.1 dbj /* transmitter mode (address 4) */
111 1.3 mycroft #define MB8795_TXMODE 4
112 1.1 dbj
113 1.3 mycroft #define MB8795_TXMODE_COLLMASK 0xF0 /* collision count */
114 1.3 mycroft #define MB8795_TXMODE_TURBOSTART 0x80
115 1.3 mycroft #define MB8795_TXMODE_PARIGNORE 0x08 /* ignore parity */
116 1.3 mycroft #define MB8795_TXMODE_TURBO1 0x04
117 1.3 mycroft #define MB8795_TXMODE_LB_DISABLE 0x02 /* loop back disabled */
118 1.3 mycroft #define MB8795_TXMODE_DISCONTENT 0x01 /* disable contention (rx carrier) */
119 1.1 dbj
120 1.1 dbj /* Should probably figure out how to put in the COLLMASK value in here */
121 1.3 mycroft #define MB8795_TXMODE_BITS \
122 1.1 dbj "\20\04PARIGNORE\02LB_DISABLE\01DISCONTENT"
123 1.1 dbj
124 1.1 dbj /* receiver mode (address 5) */
125 1.3 mycroft #define MB8795_RXMODE 5
126 1.1 dbj
127 1.3 mycroft #define MB8795_RXMODE_TEST 0x80 /* Must be zero for normal op */
128 1.3 mycroft #define MB8795_RXMODE_ADDRSIZE 0x10 /* reduces NODE match to 5 chars */
129 1.3 mycroft #define MB8795_RXMODE_SHORTENABLE 0x08 /* rx packets >= 10 bytes */
130 1.3 mycroft #define MB8795_RXMODE_RESETENABLE 0x04 /* must be zero */
131 1.3 mycroft #define MB8795_RXMODE_PROMISCUOUS 0x03 /* accept all packets */
132 1.3 mycroft #define MB8795_RXMODE_MULTICAST 0x02 /* accept broad/multicasts */
133 1.3 mycroft #define MB8795_RXMODE_NORMAL 0x01 /* accept broad/limited multicasts */
134 1.3 mycroft #define MB8795_RXMODE_OFF 0x00 /* accept no packets */
135 1.1 dbj
136 1.1 dbj /* this define is less useful for the promiscuous bits, bit I leave it here */
137 1.3 mycroft #define MB8795_RXMODE_BITS \
138 1.1 dbj "\20\10TEST\05ADDRSIZE\04SHORTENABLE\03RESETENABLE\02MULTICAST\01NORMAL"
139 1.1 dbj
140 1.1 dbj /* reset mode (address 6) */
141 1.3 mycroft #define MB8795_RESET_MODE 0x80 /* reset mode */
142 1.3 mycroft #define MB8795_RESET 6
143 1.1 dbj
144 1.3 mycroft #define MB8795_TDC_LSB 7
145 1.3 mycroft #define MB8795_ENADDR 8
146 1.3 mycroft #define MB8795_TDC_MSB 15
147 1.1 dbj
148 1.1 dbj #define ENRX_EOP 0x80000000 /* end-of-packet flag */
149 1.1 dbj #define ENRX_BOP 0x40000000 /* beginning-of-packet flag */
150 1.1 dbj #define ENTX_EOP 0x80000000 /* end-of-packet flag */
151