]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/alpha/tc/am7990var.h
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / sys / alpha / tc / am7990var.h
1 /* $FreeBSD$ */
2 /*      $NetBSD: am7990var.h,v 1.18 1998/01/12 09:23:16 thorpej Exp $   */
3
4 /*-
5  * Copyright (c) 1997 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10  * NASA Ames Research Center.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *      This product includes software developed by the NetBSD
23  *      Foundation, Inc. and its contributors.
24  * 4. Neither the name of The NetBSD Foundation nor the names of its
25  *    contributors may be used to endorse or promote products derived
26  *    from this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40
41 /*
42  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
43  *
44  * Redistribution and use in source and binary forms, with or without
45  * modification, are permitted provided that the following conditions
46  * are met:
47  * 1. Redistributions of source code must retain the above copyright
48  *    notice, this list of conditions and the following disclaimer.
49  * 2. Redistributions in binary form must reproduce the above copyright
50  *    notice, this list of conditions and the following disclaimer in the
51  *    documentation and/or other materials provided with the distribution.
52  * 3. All advertising materials mentioning features or use of this software
53  *    must display the following acknowledgement:
54  *      This product includes software developed by Charles M. Hannum.
55  * 4. The name of the author may not be used to endorse or promote products
56  *    derived from this software without specific prior written permission.
57  *
58  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
59  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
60  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
61  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
62  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
63  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
64  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
65  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
67  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68  */
69
70 #ifdef DDB
71 #define integrate
72 #define hide
73 #else
74 #define integrate       static __inline
75 #define hide            static
76 #endif
77
78 /*
79  * Ethernet software status per device.
80  *
81  * Each interface is referenced by a network interface structure,
82  * ethercom.ec_if, which the routing code uses to locate the interface. 
83  * This structure contains the output queue for the interface, its address, ...
84  *
85  * NOTE: this structure MUST be the first element in machine-dependent
86  * le_softc structures!  This is designed SPECIFICALLY to make it possible
87  * to simply cast a "void *" to "struct le_softc *" or to
88  * "struct am7990_softc *".  Among other things, this saves a lot of hair
89  * in the interrupt handlers.
90  */
91 struct am7990_softc {
92         device_t sc_dev;                /* base device glue */
93         struct  arpcom sc_ethercom;     /* Ethernet common part */
94         struct  ifmedia sc_media;       /* our supported media */
95
96         /*
97          * Memory functions:
98          *
99          *      copy to/from descriptor
100          *      copy to/from buffer
101          *      zero bytes in buffer
102          */
103         void    (*sc_copytodesc)
104                     __P((struct am7990_softc *, void *, int, int));
105         void    (*sc_copyfromdesc)
106                     __P((struct am7990_softc *, void *, int, int));
107         void    (*sc_copytobuf)
108                     __P((struct am7990_softc *, void *, int, int));
109         void    (*sc_copyfrombuf)
110                     __P((struct am7990_softc *, void *, int, int));
111         void    (*sc_zerobuf)
112                     __P((struct am7990_softc *, int, int));
113
114         /*
115          * Machine-dependent functions:
116          *
117          *      read/write CSR
118          *      hardware reset hook - may be NULL
119          *      hardware init hook - may be NULL
120          *      no carrier hook - may be NULL
121          *      media change hook - may be NULL
122          */
123         u_int16_t (*sc_rdcsr)
124                     __P((struct am7990_softc *, u_int16_t));
125         void    (*sc_wrcsr)
126                     __P((struct am7990_softc *, u_int16_t, u_int16_t));
127         void    (*sc_hwreset) __P((struct am7990_softc *));
128         void    (*sc_hwinit) __P((struct am7990_softc *));
129         void    (*sc_nocarrier) __P((struct am7990_softc *));
130         int     (*sc_mediachange) __P((struct am7990_softc *));
131         void    (*sc_mediastatus) __P((struct am7990_softc *,
132                     struct ifmediareq *));
133
134         /*
135          * Media-supported by this interface.  If this is NULL,
136          * the only supported media is assumed to be "manual".
137          */
138         int     *sc_supmedia;
139         int     sc_nsupmedia;
140         int     sc_defaultmedia;
141
142         /* PCnet bit to use software selection of a port */
143         int     sc_initmodemedia;
144
145         int     sc_havecarrier; /* carrier status */
146
147         void    *sc_sh;         /* shutdownhook cookie */
148
149         u_int16_t sc_conf3;     /* CSR3 value */
150         u_int16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
151
152         void    *sc_mem;        /* base address of RAM -- CPU's view */
153         u_long  sc_addr;        /* base address of RAM -- LANCE's view */
154
155         u_long  sc_memsize;     /* size of RAM */
156
157         int     sc_nrbuf;       /* number of receive buffers */
158         int     sc_ntbuf;       /* number of transmit buffers */
159         int     sc_last_rd;
160         int     sc_first_td, sc_last_td, sc_no_td;
161
162         int     sc_initaddr;
163         int     sc_rmdaddr;
164         int     sc_tmdaddr;
165         int     *sc_rbufaddr;
166         int     *sc_tbufaddr;
167
168 #ifdef LEDEBUG
169         int     sc_debug;
170 #endif
171         u_int8_t sc_enaddr[6];
172         u_int8_t sc_pad[2];
173                     int unit;
174 #if NRND > 0
175         rndsource_element_t     rnd_source;
176 #endif
177 };
178
179 void am7990_config __P((struct am7990_softc *));
180 void am7990_init __P((struct am7990_softc *));
181 int am7990_ioctl __P((struct ifnet *, u_long, caddr_t));
182 void am7990_meminit __P((struct am7990_softc *));
183 void am7990_reset __P((struct am7990_softc *));
184 void am7990_setladrf __P((struct arpcom *, u_int16_t *));
185 void am7990_start __P((struct ifnet *));
186 void am7990_stop __P((struct am7990_softc *));
187 void am7990_watchdog __P((struct ifnet *));
188 void am7990_intr __P((void *));
189
190 /*
191  * The following functions are only useful on certain cpu/bus
192  * combinations.  They should be written in assembly language for
193  * maximum efficiency, but machine-independent versions are provided
194  * for drivers that have not yet been optimized.
195  */
196 void am7990_copytobuf_contig __P((struct am7990_softc *, void *, int, int));
197 void am7990_copyfrombuf_contig __P((struct am7990_softc *, void *, int, int));
198 void am7990_zerobuf_contig __P((struct am7990_softc *, int, int));
199
200 #if 0   /* Example only - see am7990.c */
201 void am7990_copytobuf_gap2 __P((struct am7990_softc *, void *, int, int));
202 void am7990_copyfrombuf_gap2 __P((struct am7990_softc *, void *, int, int));
203 void am7990_zerobuf_gap2 __P((struct am7990_softc *, int, int));
204
205 void am7990_copytobuf_gap16 __P((struct am7990_softc *, void *, int, int));
206 void am7990_copyfrombuf_gap16 __P((struct am7990_softc *, void *, int, int));
207 void am7990_zerobuf_gap16 __P((struct am7990_softc *, int, int));
208 #endif /* Example only */