xref: /netbsd/sys/arch/next68k/dev/enreg.h (revision 6550d01e)
1 /*	$NetBSD: enreg.h,v 1.2 2002/09/11 01:46:30 mycroft Exp $ */
2 /*
3  * Copyright (c) 1997 Rolf Grossmann
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by Rolf Grossmann.
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Ethernet chip description
34  */
35 
36 struct en_regs {
37     unsigned char txstat; /* 0 */
38     unsigned char txmask; /* 1 */
39     unsigned char rxstat; /* 2 */
40     unsigned char rxmask; /* 3 */
41     unsigned char txmode; /* 4 */
42     unsigned char rxmode; /* 5 */
43     unsigned char reset; /* 6 */
44     char pad;
45     unsigned char addr[6]; /* 8 to d - "physical" network address */
46 };
47 
48 #define EN_TXS_READY     0x80 /* ready for packet */
49 #define EN_TXS_BUSY      0x40 /* receive carrier detect */
50 #define EN_TXS_TXRECV    0x20 /* transmission received */
51 #define EN_TXS_SHORTED   0x10 /* possible coax short */
52 #define EN_TXS_UNDERFLOW 0x08 /* underflow on xmit */
53 #define EN_TXS_COLLERR   0x04 /* collision detected */
54 #define EN_TXS_COLLERR16 0x02 /* 16th collision error */
55 #define EN_TXS_PARERR    0x01 /* parity error in tx data */
56 
57 #define EN_TXM_READYIE     0x80 /* tx int on packet ready */
58 #define EN_TXM_TXRXIE      0x20 /* tx int on transmit rec'd */
59 #define EN_TXM_UNDERFLOWIE 0x08 /* tx int on underflow */
60 #define EN_TXM_COLLIE      0x04 /* tx int on collision */
61 #define EN_TXM_COLL16IE    0x02 /* tx int on 16th collision */
62 #define EN_TXM_PARERRIE    0x01 /* tx int on parity error */
63 
64 /* same bits for rxstat and rxmask */
65 #define EN_RX_OK       0x80 /* packet received ok */
66 #define EN_RX_RESET    0x10 /* reset packet received */
67 #define EN_RX_SHORT    0x08 /* < minimum length */
68 #define EN_RX_ALIGNERR 0x04 /* alignment error */
69 #define EN_RX_CRCERR   0x02 /* CRC error */
70 #define EN_RX_OVERFLOW 0x01 /* receiver FIFO overflow */
71 
72 #define EN_TMD_COLLMASK   0xf0 /* collision count */
73 #define EN_TMD_COLLSHIFT     4
74 #define EN_TMD_PARIGNORE  0x08 /* ignore parity */
75 #define EN_TMD_TURBO1	0x04
76 #define EN_TMD_LB_DISABLE 0x02 /* loop back disabled */
77 #define EN_TMD_DISCONTENT 0x01 /* disable contention (rx carrier) */
78 
79 #define EN_RMD_TEST         0x80 /* must be zero */
80 #define EN_RMD_ADDRSIZE     0x10 /* reduces NODE match to 5 chars */
81 #define EN_RMD_SHORTENABLE  0x08 /* "rx packets >= 10 bytes" - <? */
82 #define EN_RMD_RESETENABLE  0x04 /* dunno, treat as MBZ */
83 #define EN_RMD_WHATRECV     0x03 /* controls what packets are received */
84 #define EN_RMD_RECV_PROMISC 0x03 /* all packets */
85 #define EN_RMD_RECV_MULTI   0x02 /* accept broad/multicasts */
86 #define EN_RMD_RECV_NORMAL  0x01 /* accept broad/limited multicasts */
87 #define EN_RMD_RECV_NONE    0x00 /* accept no packets */
88 
89 #define EN_RST_RESET 0x80 /* reset interface */
90 
91 #define ENRX_EOP 0x80000000 /* end-of-packet flag */
92 #define ENRX_BOP 0x40000000 /* beginning-of-packet flag */
93 #define ENTX_EOP 0x80000000 /* end-of-packet flag */
94 
95