am7990var.h revision 1.10 1 /* $NetBSD: am7990var.h,v 1.10 1997/03/09 21:12:42 leo 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 * no carrier hook - may be NULL
81 */
82 u_int16_t (*sc_rdcsr)
83 __P((struct am7990_softc *, u_int16_t));
84 void (*sc_wrcsr)
85 __P((struct am7990_softc *, u_int16_t, u_int16_t));
86 void (*sc_hwinit) __P((struct am7990_softc *));
87 void (*sc_nocarrier) __P((struct am7990_softc *));
88
89 void *sc_sh; /* shutdownhook cookie */
90
91 u_int16_t sc_conf3; /* CSR3 value */
92 u_int16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
93
94 void *sc_mem; /* base address of RAM -- CPU's view */
95 u_long sc_addr; /* base address of RAM -- LANCE's view */
96
97 u_long sc_memsize; /* size of RAM */
98
99 int sc_nrbuf; /* number of receive buffers */
100 int sc_ntbuf; /* number of transmit buffers */
101 int sc_last_rd;
102 int sc_first_td, sc_last_td, sc_no_td;
103
104 int sc_initaddr;
105 int sc_rmdaddr;
106 int sc_tmdaddr;
107 int *sc_rbufaddr;
108 int *sc_tbufaddr;
109
110 #ifdef LEDEBUG
111 int sc_debug;
112 #endif
113 };
114
115 /* Export this to machine-dependent drivers. */
116 extern struct cfdriver le_cd;
117
118 void am7990_config __P((struct am7990_softc *));
119 void am7990_init __P((struct am7990_softc *));
120 int am7990_ioctl __P((struct ifnet *, u_long, caddr_t));
121 void am7990_meminit __P((struct am7990_softc *));
122 void am7990_reset __P((struct am7990_softc *));
123 void am7990_setladrf __P((struct arpcom *, u_int16_t *));
124 void am7990_start __P((struct ifnet *));
125 void am7990_stop __P((struct am7990_softc *));
126 void am7990_watchdog __P((struct ifnet *));
127 int am7990_intr __P((void *));
128
129 /*
130 * The following functions are only useful on certain cpu/bus
131 * combinations. They should be written in assembly language for
132 * maximum efficiency, but machine-independent versions are provided
133 * for drivers that have not yet been optimized.
134 */
135 void am7990_copytobuf_contig __P((struct am7990_softc *, void *, int, int));
136 void am7990_copyfrombuf_contig __P((struct am7990_softc *, void *, int, int));
137 void am7990_zerobuf_contig __P((struct am7990_softc *, int, int));
138
139 #if 0 /* Example only - see am7990.c */
140 void am7990_copytobuf_gap2 __P((struct am7990_softc *, void *, int, int));
141 void am7990_copyfrombuf_gap2 __P((struct am7990_softc *, void *, int, int));
142 void am7990_zerobuf_gap2 __P((struct am7990_softc *, int, int));
143
144 void am7990_copytobuf_gap16 __P((struct am7990_softc *, void *, int, int));
145 void am7990_copyfrombuf_gap16 __P((struct am7990_softc *, void *, int, int));
146 void am7990_zerobuf_gap16 __P((struct am7990_softc *, int, int));
147 #endif /* Example only */
148