am7990var.h revision 1.7 1 /* $NetBSD: am7990var.h,v 1.7 1996/05/07 01:38:37 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Charles M. Hannum.
17 * 4. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifdef DDB
33 #define integrate
34 #define hide
35 #else
36 #define integrate static __inline
37 #define hide static
38 #endif
39
40 /*
41 * Ethernet software status per device.
42 *
43 * Each interface is referenced by a network interface structure,
44 * arpcom.ac_if, which the routing code uses to locate the interface.
45 * This structure contains the output queue for the interface, its address, ...
46 *
47 * NOTE: this structure MUST be the first element in machine-dependent
48 * le_softc structures! This is designed SPECIFICALLY to make it possible
49 * to simply cast a "void *" to "struct le_softc *" or to
50 * "struct am7990_softc *". Among other things, this saves a lot of hair
51 * in the interrupt handlers.
52 */
53 struct am7990_softc {
54 struct device sc_dev; /* base device glue */
55 struct arpcom sc_arpcom; /* Ethernet common part */
56
57 /*
58 * Memory functions:
59 *
60 * copy to/from descriptor
61 * copy to/from buffer
62 * zero bytes in buffer
63 */
64 void (*sc_copytodesc)
65 __P((struct am7990_softc *, void *, int, int));
66 void (*sc_copyfromdesc)
67 __P((struct am7990_softc *, void *, int, int));
68 void (*sc_copytobuf)
69 __P((struct am7990_softc *, void *, int, int));
70 void (*sc_copyfrombuf)
71 __P((struct am7990_softc *, void *, int, int));
72 void (*sc_zerobuf)
73 __P((struct am7990_softc *, int, int));
74
75 /*
76 * Machine-dependent functions:
77 *
78 * read/write CSR
79 * hardware init hook - may be NULL
80 */
81 u_int16_t (*sc_rdcsr)
82 __P((struct am7990_softc *, u_int16_t));
83 void (*sc_wrcsr)
84 __P((struct am7990_softc *, u_int16_t, u_int16_t));
85 void (*sc_hwinit) __P((struct am7990_softc *));
86
87 void *sc_sh; /* shutdownhook cookie */
88
89 u_int16_t sc_conf3; /* CSR3 value */
90
91 void *sc_mem; /* base address of RAM -- CPU's view */
92 u_long sc_addr; /* base address of RAM -- LANCE's view */
93
94 u_long sc_memsize; /* size of RAM */
95
96 int sc_nrbuf; /* number of receive buffers */
97 int sc_ntbuf; /* number of transmit buffers */
98 int sc_last_rd;
99 int sc_first_td, sc_last_td, sc_no_td;
100
101 int sc_initaddr;
102 int sc_rmdaddr;
103 int sc_tmdaddr;
104 int sc_rbufaddr;
105 int sc_tbufaddr;
106
107 #ifdef LEDEBUG
108 int sc_debug;
109 #endif
110 };
111
112 /* Export this to machine-dependent drivers. */
113 extern struct cfdriver le_cd;
114
115 void am7990_config __P((struct am7990_softc *));
116 void am7990_init __P((struct am7990_softc *));
117 int am7990_ioctl __P((struct ifnet *, u_long, caddr_t));
118 void am7990_meminit __P((struct am7990_softc *));
119 void am7990_reset __P((struct am7990_softc *));
120 void am7990_setladrf __P((struct arpcom *, u_int16_t *));
121 void am7990_start __P((struct ifnet *));
122 void am7990_stop __P((struct am7990_softc *));
123 void am7990_watchdog __P((struct ifnet *));
124 int am7990_intr __P((void *));
125
126 /*
127 * The following functions are only useful on certain cpu/bus
128 * combinations. They should be written in assembly language for
129 * maximum efficiency, but machine-independent versions are provided
130 * for drivers that have not yet been optimized.
131 */
132 void am7990_copytobuf_contig __P((struct am7990_softc *, void *, int, int));
133 void am7990_copyfrombuf_contig __P((struct am7990_softc *, void *, int, int));
134 void am7990_zerobuf_contig __P((struct am7990_softc *, int, int));
135
136 #if 0 /* Example only - see am7990.c */
137 void am7990_copytobuf_gap2 __P((struct am7990_softc *, void *, int, int));
138 void am7990_copyfrombuf_gap2 __P((struct am7990_softc *, void *, int, int));
139 void am7990_zerobuf_gap2 __P((struct am7990_softc *, int, int));
140
141 void am7990_copytobuf_gap16 __P((struct am7990_softc *, void *, int, int));
142 void am7990_copyfrombuf_gap16 __P((struct am7990_softc *, void *, int, int));
143 void am7990_zerobuf_gap16 __P((struct am7990_softc *, int, int));
144 #endif /* Example only */
145