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