Home | History | Annotate | Line # | Download | only in ic
lancevar.h revision 1.1
      1  1.1  drochner /*	$NetBSD: lancevar.h,v 1.1 1998/07/21 17:26:46 drochner Exp $	*/
      2  1.1  drochner 
      3  1.1  drochner /*-
      4  1.1  drochner  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  1.1  drochner  * All rights reserved.
      6  1.1  drochner  *
      7  1.1  drochner  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  drochner  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.1  drochner  * NASA Ames Research Center.
     10  1.1  drochner  *
     11  1.1  drochner  * Redistribution and use in source and binary forms, with or without
     12  1.1  drochner  * modification, are permitted provided that the following conditions
     13  1.1  drochner  * are met:
     14  1.1  drochner  * 1. Redistributions of source code must retain the above copyright
     15  1.1  drochner  *    notice, this list of conditions and the following disclaimer.
     16  1.1  drochner  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1  drochner  *    notice, this list of conditions and the following disclaimer in the
     18  1.1  drochner  *    documentation and/or other materials provided with the distribution.
     19  1.1  drochner  * 3. All advertising materials mentioning features or use of this software
     20  1.1  drochner  *    must display the following acknowledgement:
     21  1.1  drochner  *	This product includes software developed by the NetBSD
     22  1.1  drochner  *	Foundation, Inc. and its contributors.
     23  1.1  drochner  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.1  drochner  *    contributors may be used to endorse or promote products derived
     25  1.1  drochner  *    from this software without specific prior written permission.
     26  1.1  drochner  *
     27  1.1  drochner  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.1  drochner  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.1  drochner  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.1  drochner  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.1  drochner  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.1  drochner  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.1  drochner  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.1  drochner  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.1  drochner  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.1  drochner  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.1  drochner  * POSSIBILITY OF SUCH DAMAGE.
     38  1.1  drochner  */
     39  1.1  drochner 
     40  1.1  drochner /*
     41  1.1  drochner  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
     42  1.1  drochner  *
     43  1.1  drochner  * Redistribution and use in source and binary forms, with or without
     44  1.1  drochner  * modification, are permitted provided that the following conditions
     45  1.1  drochner  * are met:
     46  1.1  drochner  * 1. Redistributions of source code must retain the above copyright
     47  1.1  drochner  *    notice, this list of conditions and the following disclaimer.
     48  1.1  drochner  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1  drochner  *    notice, this list of conditions and the following disclaimer in the
     50  1.1  drochner  *    documentation and/or other materials provided with the distribution.
     51  1.1  drochner  * 3. All advertising materials mentioning features or use of this software
     52  1.1  drochner  *    must display the following acknowledgement:
     53  1.1  drochner  *	This product includes software developed by Charles M. Hannum.
     54  1.1  drochner  * 4. The name of the author may not be used to endorse or promote products
     55  1.1  drochner  *    derived from this software without specific prior written permission.
     56  1.1  drochner  *
     57  1.1  drochner  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     58  1.1  drochner  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     59  1.1  drochner  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     60  1.1  drochner  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     61  1.1  drochner  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     62  1.1  drochner  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     63  1.1  drochner  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     64  1.1  drochner  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     65  1.1  drochner  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     66  1.1  drochner  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     67  1.1  drochner  */
     68  1.1  drochner 
     69  1.1  drochner #include "rnd.h"
     70  1.1  drochner 
     71  1.1  drochner #if NRND > 0
     72  1.1  drochner #include <sys/rnd.h>
     73  1.1  drochner #endif
     74  1.1  drochner 
     75  1.1  drochner struct lance_softc {
     76  1.1  drochner 	struct	device sc_dev;		/* base device glue */
     77  1.1  drochner 	struct	ethercom sc_ethercom;	/* Ethernet common part */
     78  1.1  drochner 	struct	ifmedia sc_media;	/* our supported media */
     79  1.1  drochner 
     80  1.1  drochner 	/*
     81  1.1  drochner 	 * Memory functions:
     82  1.1  drochner 	 *
     83  1.1  drochner 	 *	copy to/from descriptor
     84  1.1  drochner 	 *	copy to/from buffer
     85  1.1  drochner 	 *	zero bytes in buffer
     86  1.1  drochner 	 */
     87  1.1  drochner 	void	(*sc_copytodesc)
     88  1.1  drochner 		    __P((struct lance_softc *, void *, int, int));
     89  1.1  drochner 	void	(*sc_copyfromdesc)
     90  1.1  drochner 		    __P((struct lance_softc *, void *, int, int));
     91  1.1  drochner 	void	(*sc_copytobuf)
     92  1.1  drochner 		    __P((struct lance_softc *, void *, int, int));
     93  1.1  drochner 	void	(*sc_copyfrombuf)
     94  1.1  drochner 		    __P((struct lance_softc *, void *, int, int));
     95  1.1  drochner 	void	(*sc_zerobuf)
     96  1.1  drochner 		    __P((struct lance_softc *, int, int));
     97  1.1  drochner 
     98  1.1  drochner 	/*
     99  1.1  drochner 	 * Machine-dependent functions:
    100  1.1  drochner 	 *
    101  1.1  drochner 	 *	read/write CSR
    102  1.1  drochner 	 *	hardware reset hook - may be NULL
    103  1.1  drochner 	 *	hardware init hook - may be NULL
    104  1.1  drochner 	 *	no carrier hook - may be NULL
    105  1.1  drochner 	 *	media change hook - may be NULL
    106  1.1  drochner 	 */
    107  1.1  drochner 	u_int16_t (*sc_rdcsr)
    108  1.1  drochner 		    __P((struct lance_softc *, u_int16_t));
    109  1.1  drochner 	void	(*sc_wrcsr)
    110  1.1  drochner 		    __P((struct lance_softc *, u_int16_t, u_int16_t));
    111  1.1  drochner 	void	(*sc_hwreset) __P((struct lance_softc *));
    112  1.1  drochner 	void	(*sc_hwinit) __P((struct lance_softc *));
    113  1.1  drochner 	void	(*sc_nocarrier) __P((struct lance_softc *));
    114  1.1  drochner 	int	(*sc_mediachange) __P((struct lance_softc *));
    115  1.1  drochner 	void	(*sc_mediastatus) __P((struct lance_softc *,
    116  1.1  drochner 		    struct ifmediareq *));
    117  1.1  drochner 
    118  1.1  drochner 	/*
    119  1.1  drochner 	 * Media-supported by this interface.  If this is NULL,
    120  1.1  drochner 	 * the only supported media is assumed to be "manual".
    121  1.1  drochner 	 */
    122  1.1  drochner 	int	*sc_supmedia;
    123  1.1  drochner 	int	sc_nsupmedia;
    124  1.1  drochner 	int	sc_defaultmedia;
    125  1.1  drochner 
    126  1.1  drochner 	/* PCnet bit to use software selection of a port */
    127  1.1  drochner 	int	sc_initmodemedia;
    128  1.1  drochner 
    129  1.1  drochner 	int	sc_havecarrier;	/* carrier status */
    130  1.1  drochner 
    131  1.1  drochner 	void	*sc_sh;		/* shutdownhook cookie */
    132  1.1  drochner 
    133  1.1  drochner 	u_int16_t sc_conf3;	/* CSR3 value */
    134  1.1  drochner 	u_int16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
    135  1.1  drochner 
    136  1.1  drochner 	void	*sc_mem;	/* base address of RAM -- CPU's view */
    137  1.1  drochner 	u_long	sc_addr;	/* base address of RAM -- LANCE's view */
    138  1.1  drochner 
    139  1.1  drochner 	u_long	sc_memsize;	/* size of RAM */
    140  1.1  drochner 
    141  1.1  drochner 	int	sc_nrbuf;	/* number of receive buffers */
    142  1.1  drochner 	int	sc_ntbuf;	/* number of transmit buffers */
    143  1.1  drochner 	int	sc_last_rd;
    144  1.1  drochner 	int	sc_first_td, sc_last_td, sc_no_td;
    145  1.1  drochner 
    146  1.1  drochner 	int	sc_initaddr;
    147  1.1  drochner 	int	sc_rmdaddr;
    148  1.1  drochner 	int	sc_tmdaddr;
    149  1.1  drochner 	int	*sc_rbufaddr;
    150  1.1  drochner 	int	*sc_tbufaddr;
    151  1.1  drochner 
    152  1.1  drochner #ifdef LEDEBUG
    153  1.1  drochner 	int	sc_debug;
    154  1.1  drochner #endif
    155  1.1  drochner 	u_int8_t sc_enaddr[6];
    156  1.1  drochner 	u_int8_t sc_pad[2];
    157  1.1  drochner #if NRND > 0
    158  1.1  drochner 	rndsource_element_t	rnd_source;
    159  1.1  drochner #endif
    160  1.1  drochner 
    161  1.1  drochner 	void (*sc_meminit) __P((struct lance_softc *));
    162  1.1  drochner 	void (*sc_start) __P((struct ifnet *));
    163  1.1  drochner };
    164  1.1  drochner 
    165  1.1  drochner void lance_config __P((struct lance_softc *));
    166  1.1  drochner void lance_reset __P((struct lance_softc *));
    167  1.1  drochner void lance_init __P((struct lance_softc *));
    168  1.1  drochner int lance_put __P((struct lance_softc *, int, struct mbuf *));
    169  1.1  drochner void lance_read __P((struct lance_softc *, int, int));
    170  1.1  drochner void lance_setladrf __P((struct ethercom *, u_int16_t *));
    171  1.1  drochner 
    172  1.1  drochner /*
    173  1.1  drochner  * The following functions are only useful on certain cpu/bus
    174  1.1  drochner  * combinations.  They should be written in assembly language for
    175  1.1  drochner  * maximum efficiency, but machine-independent versions are provided
    176  1.1  drochner  * for drivers that have not yet been optimized.
    177  1.1  drochner  */
    178  1.1  drochner void lance_copytobuf_contig __P((struct lance_softc *, void *, int, int));
    179  1.1  drochner void lance_copyfrombuf_contig __P((struct lance_softc *, void *, int, int));
    180  1.1  drochner void lance_zerobuf_contig __P((struct lance_softc *, int, int));
    181  1.1  drochner 
    182  1.1  drochner #if 0	/* Example only - see lance.c */
    183  1.1  drochner void lance_copytobuf_gap2 __P((struct lance_softc *, void *, int, int));
    184  1.1  drochner void lance_copyfrombuf_gap2 __P((struct lance_softc *, void *, int, int));
    185  1.1  drochner void lance_zerobuf_gap2 __P((struct lance_softc *, int, int));
    186  1.1  drochner 
    187  1.1  drochner void lance_copytobuf_gap16 __P((struct lance_softc *, void *, int, int));
    188  1.1  drochner void lance_copyfrombuf_gap16 __P((struct lance_softc *, void *, int, int));
    189  1.1  drochner void lance_zerobuf_gap16 __P((struct lance_softc *, int, int));
    190  1.1  drochner #endif /* Example only */
    191