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