Home | History | Annotate | Line # | Download | only in ic
lancevar.h revision 1.10.70.1
      1  1.10.70.1       mjf /*	$NetBSD: lancevar.h,v 1.10.70.1 2008/06/02 13:23:24 mjf Exp $	*/
      2        1.1  drochner 
      3        1.1  drochner /*-
      4        1.2   mycroft  * Copyright (c) 1997, 1998 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.2   mycroft  * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
      9        1.2   mycroft  * Simulation Facility, 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  *
     20        1.1  drochner  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21        1.1  drochner  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22        1.1  drochner  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23        1.1  drochner  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24        1.1  drochner  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25        1.1  drochner  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26        1.1  drochner  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27        1.1  drochner  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28        1.1  drochner  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29        1.1  drochner  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30        1.1  drochner  * POSSIBILITY OF SUCH DAMAGE.
     31        1.1  drochner  */
     32        1.1  drochner 
     33        1.1  drochner #include "rnd.h"
     34        1.1  drochner 
     35        1.1  drochner #if NRND > 0
     36        1.1  drochner #include <sys/rnd.h>
     37        1.1  drochner #endif
     38        1.1  drochner 
     39        1.1  drochner struct lance_softc {
     40  1.10.70.1       mjf 	device_t sc_dev;		/* base device glue */
     41        1.1  drochner 	struct	ethercom sc_ethercom;	/* Ethernet common part */
     42        1.1  drochner 	struct	ifmedia sc_media;	/* our supported media */
     43        1.1  drochner 
     44        1.1  drochner 	/*
     45        1.1  drochner 	 * Memory functions:
     46        1.1  drochner 	 *
     47        1.1  drochner 	 *	copy to/from descriptor
     48        1.1  drochner 	 *	copy to/from buffer
     49        1.1  drochner 	 *	zero bytes in buffer
     50        1.1  drochner 	 */
     51        1.1  drochner 	void	(*sc_copytodesc)
     52        1.8     perry 		   (struct lance_softc *, void *, int, int);
     53        1.1  drochner 	void	(*sc_copyfromdesc)
     54        1.8     perry 		   (struct lance_softc *, void *, int, int);
     55        1.1  drochner 	void	(*sc_copytobuf)
     56        1.8     perry 		   (struct lance_softc *, void *, int, int);
     57        1.1  drochner 	void	(*sc_copyfrombuf)
     58        1.8     perry 		   (struct lance_softc *, void *, int, int);
     59        1.1  drochner 	void	(*sc_zerobuf)
     60        1.8     perry 		   (struct lance_softc *, int, int);
     61        1.1  drochner 
     62        1.1  drochner 	/*
     63        1.1  drochner 	 * Machine-dependent functions:
     64        1.1  drochner 	 *
     65        1.1  drochner 	 *	read/write CSR
     66        1.1  drochner 	 *	hardware reset hook - may be NULL
     67        1.1  drochner 	 *	hardware init hook - may be NULL
     68        1.1  drochner 	 *	no carrier hook - may be NULL
     69        1.1  drochner 	 *	media change hook - may be NULL
     70        1.1  drochner 	 */
     71  1.10.70.1       mjf 	uint16_t (*sc_rdcsr)
     72  1.10.70.1       mjf 		   (struct lance_softc *, uint16_t);
     73        1.1  drochner 	void	(*sc_wrcsr)
     74  1.10.70.1       mjf 		   (struct lance_softc *, uint16_t, uint16_t);
     75        1.8     perry 	void	(*sc_hwreset)(struct lance_softc *);
     76        1.8     perry 	void	(*sc_hwinit)(struct lance_softc *);
     77        1.8     perry 	void	(*sc_nocarrier)(struct lance_softc *);
     78        1.8     perry 	int	(*sc_mediachange)(struct lance_softc *);
     79        1.8     perry 	void	(*sc_mediastatus)(struct lance_softc *, struct ifmediareq *);
     80        1.1  drochner 
     81        1.1  drochner 	/*
     82        1.1  drochner 	 * Media-supported by this interface.  If this is NULL,
     83        1.1  drochner 	 * the only supported media is assumed to be "manual".
     84        1.1  drochner 	 */
     85        1.5  jdolecek 	const int	*sc_supmedia;
     86        1.1  drochner 	int	sc_nsupmedia;
     87        1.1  drochner 	int	sc_defaultmedia;
     88        1.1  drochner 
     89        1.1  drochner 	/* PCnet bit to use software selection of a port */
     90        1.1  drochner 	int	sc_initmodemedia;
     91        1.1  drochner 
     92        1.1  drochner 	int	sc_havecarrier;	/* carrier status */
     93        1.1  drochner 
     94        1.1  drochner 	void	*sc_sh;		/* shutdownhook cookie */
     95        1.1  drochner 
     96  1.10.70.1       mjf 	uint16_t sc_conf3;	/* CSR3 value */
     97  1.10.70.1       mjf 	uint16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
     98        1.1  drochner 
     99        1.1  drochner 	void	*sc_mem;	/* base address of RAM -- CPU's view */
    100        1.1  drochner 	u_long	sc_addr;	/* base address of RAM -- LANCE's view */
    101        1.1  drochner 
    102        1.1  drochner 	u_long	sc_memsize;	/* size of RAM */
    103        1.1  drochner 
    104        1.1  drochner 	int	sc_nrbuf;	/* number of receive buffers */
    105        1.1  drochner 	int	sc_ntbuf;	/* number of transmit buffers */
    106        1.1  drochner 	int	sc_last_rd;
    107        1.1  drochner 	int	sc_first_td, sc_last_td, sc_no_td;
    108        1.1  drochner 
    109        1.1  drochner 	int	sc_initaddr;
    110        1.1  drochner 	int	sc_rmdaddr;
    111        1.1  drochner 	int	sc_tmdaddr;
    112        1.1  drochner 	int	*sc_rbufaddr;
    113        1.1  drochner 	int	*sc_tbufaddr;
    114        1.1  drochner 
    115        1.1  drochner #ifdef LEDEBUG
    116        1.1  drochner 	int	sc_debug;
    117        1.1  drochner #endif
    118  1.10.70.1       mjf 	uint8_t sc_enaddr[ETHER_ADDR_LEN];
    119  1.10.70.1       mjf 	uint8_t sc_pad[2];
    120        1.1  drochner #if NRND > 0
    121        1.1  drochner 	rndsource_element_t	rnd_source;
    122        1.1  drochner #endif
    123        1.1  drochner 
    124        1.8     perry 	void (*sc_meminit)(struct lance_softc *);
    125        1.8     perry 	void (*sc_start)(struct ifnet *);
    126        1.1  drochner };
    127        1.1  drochner 
    128        1.8     perry void lance_config(struct lance_softc *);
    129        1.8     perry void lance_reset(struct lance_softc *);
    130        1.8     perry int lance_init(struct ifnet *);
    131        1.8     perry int lance_put(struct lance_softc *, int, struct mbuf *);
    132        1.9     perry void lance_read(struct lance_softc *, int, int);
    133  1.10.70.1       mjf void lance_setladrf(struct ethercom *, uint16_t *);
    134        1.1  drochner 
    135        1.1  drochner /*
    136        1.7       wiz  * The following functions are only useful on certain CPU/bus
    137        1.1  drochner  * combinations.  They should be written in assembly language for
    138        1.1  drochner  * maximum efficiency, but machine-independent versions are provided
    139        1.1  drochner  * for drivers that have not yet been optimized.
    140        1.1  drochner  */
    141        1.8     perry void lance_copytobuf_contig(struct lance_softc *, void *, int, int);
    142        1.8     perry void lance_copyfrombuf_contig(struct lance_softc *, void *, int, int);
    143        1.8     perry void lance_zerobuf_contig(struct lance_softc *, int, int);
    144        1.1  drochner 
    145        1.1  drochner #if 0	/* Example only - see lance.c */
    146        1.8     perry void lance_copytobuf_gap2(struct lance_softc *, void *, int, int);
    147        1.8     perry void lance_copyfrombuf_gap2(struct lance_softc *, void *, int, int);
    148        1.8     perry void lance_zerobuf_gap2(struct lance_softc *, int, int);
    149        1.8     perry 
    150        1.8     perry void lance_copytobuf_gap16(struct lance_softc *, void *, int, int);
    151        1.8     perry void lance_copyfrombuf_gap16(struct lance_softc *, void *, int, int);
    152        1.8     perry void lance_zerobuf_gap16(struct lance_softc *, int, int);
    153        1.1  drochner #endif /* Example only */
    154