1/*	$NetBSD$ */
2
3/*-
4 * Copyright (c) 1982, 1992, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 *    may be used to endorse or promote products derived from this software
17 *    without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)if_lereg.h	8.2 (Berkeley) 10/30/93
32 */
33
34#define	LEMTU		1518
35#define	LEMINSIZE	60	/* should be 64 if mode DTCR is set */
36#define	LERBUF		8
37#define	LERBUFLOG2	3
38#define	LE_RLEN		(LERBUFLOG2 << 13)
39#define	LE_NEXTRMD(x)	(((x) + 1) & (LERBUF - 1))
40#define	LETBUF		1
41#define	LETBUFLOG2	0
42#define	LE_TLEN		(LETBUFLOG2 << 13)
43#define	LE_NEXTTMD(x)	(((x) + 1) & (LETBUF - 1))
44
45/* Local Area Network Controller for Ethernet (LANCE) registers */
46struct lereg {
47	volatile uint16_t	ler_rdp;	/* register data port */
48	volatile uint16_t	ler_rap;	/* register address port */
49};
50
51/*
52 * lance memory
53 */
54
55/* receive message descriptors. bits/hadr are byte order dependent. */
56struct	lermd_v {
57	volatile uint16_t rmd0;		/* low address of packet */
58#if BYTE_ORDER == BIG_ENDIAN
59	volatile uint8_t  rmd1_bits;	/* descriptor bits */
60	volatile uint8_t  rmd1_hadr;	/* high address of packet */
61#else
62	volatile uint8_t  rmd1_hadr;	/* high address of packet */
63	volatile uint8_t  rmd1_bits;	/* descriptor bits */
64#endif
65	volatile int16_t  rmd2;		/* buffer byte count */
66	volatile uint16_t rmd3;		/* message byte count */
67};
68
69/* transmit message descriptors */
70struct	letmd_v {
71	volatile uint16_t tmd0;		/* low address of packet */
72#if BYTE_ORDER == BIG_ENDIAN
73	volatile uint8_t  tmd1_bits;	/* descriptor bits */
74	volatile uint8_t  tmd1_hadr;	/* high address of packet */
75#else
76	volatile uint8_t  tmd1_hadr;	/* high address of packet */
77	volatile uint8_t  tmd1_bits;	/* descriptor bits */
78#endif
79	volatile int16_t  tmd2;		/* buffer byte count */
80	volatile uint16_t tmd3;		/* transmit error bits */
81};
82
83struct lemem {
84	/* initialization block */
85	volatile uint16_t	lem_mode;	/* mode */
86	volatile uint16_t	lem_padr[3];	/* physical address */
87	volatile uint16_t	lem_ladrf[4];	/* logical address filter */
88	volatile uint16_t	lem_rdra;	/* receive descriptor addr */
89	volatile uint16_t	lem_rlen;	/* rda high and ring size */
90	volatile uint16_t	lem_tdra;	/* transmit descriptor addr */
91	volatile uint16_t	lem_tlen;	/* tda high and ring size */
92	uint16_t		lem_pad0[4];
93	struct lermd_v		lem_rmd[LERBUF];
94	struct letmd_v		lem_tmd[LETBUF];
95	volatile uint8_t	lem_rbuf[LERBUF][LEMTU];
96	volatile uint8_t	lem_tbuf[LETBUF][LEMTU];
97};
98
99struct le_softc {
100	struct lereg *sc_reg;
101	struct lemem *sc_mem;
102	uint8_t sc_enaddr[6];
103	int sc_curtmd;
104	int sc_currmd;
105};
106