xref: /openbsd/sys/dev/ic/am7990reg.h (revision 0ec3b04c)
1 /*	$OpenBSD: am7990reg.h,v 1.9 2013/09/24 20:10:57 miod Exp $	*/
2 /*	$NetBSD: am7990reg.h,v 1.13 2008/04/28 20:23:49 martin Exp $	*/
3 
4 /*-
5  * Copyright (c) 1998 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Charles M. Hannum.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*-
34  * Copyright (c) 1992, 1993
35  *	The Regents of the University of California.  All rights reserved.
36  *
37  * This code is derived from software contributed to Berkeley by
38  * Ralph Campbell and Rick Macklem.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions
42  * are met:
43  * 1. Redistributions of source code must retain the above copyright
44  *    notice, this list of conditions and the following disclaimer.
45  * 2. Redistributions in binary form must reproduce the above copyright
46  *    notice, this list of conditions and the following disclaimer in the
47  *    documentation and/or other materials provided with the distribution.
48  * 3. Neither the name of the University nor the names of its contributors
49  *    may be used to endorse or promote products derived from this software
50  *    without specific prior written permission.
51  *
52  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62  * SUCH DAMAGE.
63  *
64  *	@(#)if_lereg.h	8.1 (Berkeley) 6/10/93
65  */
66 
67 /*
68  * Receive message descriptor
69  */
70 struct lermd {
71 	u_int16_t rmd0;
72 #if BYTE_ORDER == BIG_ENDIAN
73 	u_int8_t  rmd1_bits;
74 	u_int8_t  rmd1_hadr;
75 #else
76 	u_int8_t  rmd1_hadr;
77 	u_int8_t  rmd1_bits;
78 #endif
79 	int16_t	  rmd2;
80 	u_int16_t rmd3;
81 } __packed;
82 
83 /*
84  * Transmit message descriptor
85  */
86 struct letmd {
87 	u_int16_t tmd0;
88 #if BYTE_ORDER == BIG_ENDIAN
89 	u_int8_t  tmd1_bits;
90 	u_int8_t  tmd1_hadr;
91 #else
92 	u_int8_t  tmd1_hadr;
93 	u_int8_t  tmd1_bits;
94 #endif
95 	int16_t	  tmd2;
96 	u_int16_t tmd3;
97 } __packed;
98 
99 /*
100  * Initialization block
101  */
102 struct leinit {
103 	u_int16_t init_mode;		/* +0x0000 */
104 	u_int16_t init_padr[3];		/* +0x0002 */
105 	u_int16_t init_ladrf[4];	/* +0x0008 */
106 	u_int16_t init_rdra;		/* +0x0010 */
107 	u_int16_t init_rlen;		/* +0x0012 */
108 	u_int16_t init_tdra;		/* +0x0014 */
109 	u_int16_t init_tlen;		/* +0x0016 */
110 	int16_t	  pad0[4];		/* Pad to 16 shorts */
111 } __packed;
112 
113 /* Receive message descriptor 1 (rmd1_bits) */
114 #define	LE_R1_OWN	0x80		/* LANCE owns the packet */
115 #define	LE_R1_ERR	0x40		/* error summary */
116 #define	LE_R1_FRAM	0x20		/* framing error */
117 #define	LE_R1_OFLO	0x10		/* overflow error */
118 #define	LE_R1_CRC	0x08		/* CRC error */
119 #define	LE_R1_BUFF	0x04		/* buffer error */
120 #define	LE_R1_STP	0x02		/* start of packet */
121 #define	LE_R1_ENP	0x01		/* end of packet */
122 
123 #define	LE_R1_BITS \
124     "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
125 
126 /* Transmit message descriptor 1 (tmd1_bits) */
127 #define	LE_T1_OWN	0x80		/* LANCE owns the packet */
128 #define	LE_T1_ERR	0x40		/* error summary */
129 #define	LE_T1_MORE	0x10		/* multiple collisions */
130 #define	LE_T1_ONE	0x08		/* single collision */
131 #define	LE_T1_DEF	0x04		/* deferred transmit */
132 #define	LE_T1_STP	0x02		/* start of packet */
133 #define	LE_T1_ENP	0x01		/* end of packet */
134 
135 #define	LE_T1_BITS \
136     "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
137 
138 /* Transmit message descriptor 3 (tmd3) */
139 #define	LE_T3_BUFF	0x8000		/* buffer error */
140 #define	LE_T3_UFLO	0x4000		/* underflow error */
141 #define	LE_T3_LCOL	0x1000		/* late collision */
142 #define	LE_T3_LCAR	0x0800		/* loss of carrier */
143 #define	LE_T3_RTRY	0x0400		/* retry error */
144 #define	LE_T3_TDR_MASK	0x03ff		/* time domain reflectometry counter */
145 
146 #define	LE_XMD2_ONES	0xf000
147 
148 #define	LE_T3_BITS \
149     "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
150 
151 /*
152  * PCnet-ISA defines which are not available on LANCE 7990
153  */
154 
155 /* (ISA) Bus Configuration Registers */
156 #define	LE_BCR_MSRDA	0x0000
157 #define	LE_BCR_MSWRA	0x0001
158 #define	LE_BCR_MC	0x0002
159 #define	LE_BCR_LED1	0x0005
160 #define	LE_BCR_LED2	0x0006
161 #define	LE_BCR_LED3	0x0007
162 
163 /* Bus configurations bits (MC) */
164 #define	LE_MC_EADISEL	0x0008		/* EADI selection */
165 #define	LE_MC_AWAKE	0x0004		/* auto-wake */
166 #define	LE_MC_ASEL	0x0002		/* auto selection */
167 #define	LE_MC_XMAUSEL	0x0001		/* external MAU selection */
168 
169 /* LED bis (LED[123]) */
170 #define	LE_LED_LEDOUT	0x8000
171 #define	LE_LED_PSE	0x0080
172 #define	LE_LED_XMTE	0x0010
173 #define	LE_LED_PVPE	0x0008
174 #define	LE_LED_PCVE	0x0004
175 #define	LE_LED_JABE	0x0002
176 #define	LE_LED_COLE	0x0001
177