1/*	$NetBSD: am79900reg.h,v 1.8 2005/12/11 12:21:25 christos Exp $	*/
2
3/*-
4 * SPDX-License-Identifier: BSD-2-Clause-NetBSD 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 *	@(#)if_lereg.h	8.1 (Berkeley) 6/10/93
66 */
67
68/* $FreeBSD: releng/12.0/sys/dev/le/am79900reg.h 326255 2017-11-27 14:52:40Z pfg $ */
69
70#ifndef _DEV_LE_AM79900REG_H_
71#define	_DEV_LE_AM79900REG_H_
72
73/*
74 * Receive message descriptor
75 */
76struct lermd {
77	uint32_t	rmd0;
78	uint32_t	rmd1;
79	uint32_t	rmd2;
80	int32_t		rmd3;
81};
82
83/*
84 * Transmit message descriptor
85 */
86struct letmd {
87	uint32_t	tmd0;
88	uint32_t	tmd1;
89	uint32_t	tmd2;
90	int32_t		tmd3;
91};
92
93/*
94 * Initialization block
95 */
96struct leinit {
97	uint32_t	init_mode;	/* +0x0000 */
98	uint32_t	init_padr[2];	/* +0x0002 */
99	uint16_t	init_ladrf[4];	/* +0x0008 */
100	uint32_t	init_rdra;	/* +0x0010 */
101	uint32_t	init_tdra;	/* +0x0014 */
102	int32_t	 	pad;		/* Pad to 8 ints. */
103};
104
105/* Receive message descriptor 1 (rmd1_bits) */
106#define	LE_R1_OWN	(1U << 31)	/* LANCE owns the packet */
107#define	LE_R1_ERR	(1U << 30)	/* error summary */
108#define	LE_R1_FRAM	(1U << 29)	/* framing error */
109#define	LE_R1_OFLO	(1U << 28)	/* overflow error */
110#define	LE_R1_CRC	(1U << 27)	/* CRC error */
111#define	LE_R1_BUFF	(1U << 26)	/* buffer error */
112#define	LE_R1_STP	(1U << 25)	/* start of packet */
113#define	LE_R1_ENP	(1U << 24)	/* end of packet */
114#define	LE_R1_ONES	(0xfU << 12)	/* must be ones */
115#define	LE_R1_BCNT_MASK	(0xfff)		/* byte count mask */
116
117#define	LE_R1_BITS \
118    "\20\40OWN\37ERR\36FRAM\35OFLO\34CRC\33BUFF\32STP\31ENP"
119
120/* Transmit message descriptor 1 (tmd1_bits) */
121#define	LE_T1_OWN	(1U << 31)	/* LANCE owns the packet */
122#define	LE_T1_ERR	(1U << 30)	/* error summary */
123#define	LE_T1_ADD_FCS	(1U << 29)	/* add FCS (PCnet-PCI) */
124#define	LE_T1_NO_FCS	(1U << 29)	/* no FCS (ILACC) */
125#define	LE_T1_MORE	(1U << 28)	/* multiple collisions */
126#define	LE_T1_LTINT	(1U << 28)	/* transmit interrupt (if LTINTEN) */
127#define	LE_T1_ONE	(1U << 27)	/* single collision */
128#define	LE_T1_DEF	(1U << 26)	/* deferred transmit */
129#define	LE_T1_STP	(1U << 25)	/* start of packet */
130#define	LE_T1_ENP	(1U << 24)	/* end of packet */
131#define	LE_T1_ONES	(0xfU << 12)	/* must be ones */
132#define	LE_T1_BCNT_MASK	(0xfff)		/* byte count mask */
133
134#define	LE_T1_BITS \
135    "\20\40OWN\37ERR\36RES\35MORE\34ONE\33DEF\32STP\31ENP"
136
137/* Transmit message descriptor 3 (tmd3) */
138#define	LE_T2_BUFF	(1U << 31)	/* buffer error */
139#define	LE_T2_UFLO	(1U << 30)	/* underflow error */
140#define	LE_T2_EXDEF	(1U << 29)	/* excessive defferral */
141#define	LE_T2_LCOL	(1U << 28)	/* late collision */
142#define	LE_T2_LCAR	(1U << 27)	/* loss of carrier */
143#define	LE_T2_RTRY	(1U << 26)	/* retry error */
144#if 0
145#define	LE_T3_TDR_MASK	0x03ff		/* time domain reflectometry counter */
146#endif
147
148#define	LE_T3_BITS \
149    "\12\40BUFF\37UFLO\35LCOL\34LCAR\33RTRY"
150
151#endif /* !_DEV_LE_AM7990REG_H_ */
152