xref: /freebsd/sys/dev/le/am79900reg.h (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1 /*	$NetBSD: am79900reg.h,v 1.8 2005/12/11 12:21:25 christos Exp $	*/
2 
3 /*-
4  * SPDX-License-Identifier: BSD-2-Clause AND BSD-3-Clause
5  *
6  * Copyright (c) 1998 The NetBSD Foundation, Inc.
7  * All rights reserved.
8  *
9  * This code is derived from software contributed to The NetBSD Foundation
10  * by Charles M. Hannum.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*-
35  * Copyright (c) 1992, 1993
36  *	The Regents of the University of California.  All rights reserved.
37  *
38  * This code is derived from software contributed to Berkeley by
39  * Ralph Campbell and Rick Macklem.
40  *
41  * Redistribution and use in source and binary forms, with or without
42  * modification, are permitted provided that the following conditions
43  * are met:
44  * 1. Redistributions of source code must retain the above copyright
45  *    notice, this list of conditions and the following disclaimer.
46  * 2. Redistributions in binary form must reproduce the above copyright
47  *    notice, this list of conditions and the following disclaimer in the
48  *    documentation and/or other materials provided with the distribution.
49  * 3. Neither the name of the University nor the names of its contributors
50  *    may be used to endorse or promote products derived from this software
51  *    without specific prior written permission.
52  *
53  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63  * SUCH DAMAGE.
64  */
65 
66 
67 #ifndef _DEV_LE_AM79900REG_H_
68 #define	_DEV_LE_AM79900REG_H_
69 
70 /*
71  * Receive message descriptor
72  */
73 struct lermd {
74 	uint32_t	rmd0;
75 	uint32_t	rmd1;
76 	uint32_t	rmd2;
77 	int32_t		rmd3;
78 };
79 
80 /*
81  * Transmit message descriptor
82  */
83 struct letmd {
84 	uint32_t	tmd0;
85 	uint32_t	tmd1;
86 	uint32_t	tmd2;
87 	int32_t		tmd3;
88 };
89 
90 /*
91  * Initialization block
92  */
93 struct leinit {
94 	uint32_t	init_mode;	/* +0x0000 */
95 	uint32_t	init_padr[2];	/* +0x0002 */
96 	uint16_t	init_ladrf[4];	/* +0x0008 */
97 	uint32_t	init_rdra;	/* +0x0010 */
98 	uint32_t	init_tdra;	/* +0x0014 */
99 	int32_t	 	pad;		/* Pad to 8 ints. */
100 };
101 
102 /* Receive message descriptor 1 (rmd1_bits) */
103 #define	LE_R1_OWN	(1U << 31)	/* LANCE owns the packet */
104 #define	LE_R1_ERR	(1U << 30)	/* error summary */
105 #define	LE_R1_FRAM	(1U << 29)	/* framing error */
106 #define	LE_R1_OFLO	(1U << 28)	/* overflow error */
107 #define	LE_R1_CRC	(1U << 27)	/* CRC error */
108 #define	LE_R1_BUFF	(1U << 26)	/* buffer error */
109 #define	LE_R1_STP	(1U << 25)	/* start of packet */
110 #define	LE_R1_ENP	(1U << 24)	/* end of packet */
111 #define	LE_R1_ONES	(0xfU << 12)	/* must be ones */
112 #define	LE_R1_BCNT_MASK	(0xfff)		/* byte count mask */
113 
114 #define	LE_R1_BITS \
115     "\20\40OWN\37ERR\36FRAM\35OFLO\34CRC\33BUFF\32STP\31ENP"
116 
117 /* Transmit message descriptor 1 (tmd1_bits) */
118 #define	LE_T1_OWN	(1U << 31)	/* LANCE owns the packet */
119 #define	LE_T1_ERR	(1U << 30)	/* error summary */
120 #define	LE_T1_ADD_FCS	(1U << 29)	/* add FCS (PCnet-PCI) */
121 #define	LE_T1_NO_FCS	(1U << 29)	/* no FCS (ILACC) */
122 #define	LE_T1_MORE	(1U << 28)	/* multiple collisions */
123 #define	LE_T1_LTINT	(1U << 28)	/* transmit interrupt (if LTINTEN) */
124 #define	LE_T1_ONE	(1U << 27)	/* single collision */
125 #define	LE_T1_DEF	(1U << 26)	/* deferred transmit */
126 #define	LE_T1_STP	(1U << 25)	/* start of packet */
127 #define	LE_T1_ENP	(1U << 24)	/* end of packet */
128 #define	LE_T1_ONES	(0xfU << 12)	/* must be ones */
129 #define	LE_T1_BCNT_MASK	(0xfff)		/* byte count mask */
130 
131 #define	LE_T1_BITS \
132     "\20\40OWN\37ERR\36RES\35MORE\34ONE\33DEF\32STP\31ENP"
133 
134 /* Transmit message descriptor 3 (tmd3) */
135 #define	LE_T2_BUFF	(1U << 31)	/* buffer error */
136 #define	LE_T2_UFLO	(1U << 30)	/* underflow error */
137 #define	LE_T2_EXDEF	(1U << 29)	/* excessive defferral */
138 #define	LE_T2_LCOL	(1U << 28)	/* late collision */
139 #define	LE_T2_LCAR	(1U << 27)	/* loss of carrier */
140 #define	LE_T2_RTRY	(1U << 26)	/* retry error */
141 #if 0
142 #define	LE_T3_TDR_MASK	0x03ff		/* time domain reflectometry counter */
143 #endif
144 
145 #define	LE_T3_BITS \
146     "\12\40BUFF\37UFLO\35LCOL\34LCAR\33RTRY"
147 
148 #endif /* !_DEV_LE_AM7990REG_H_ */
149