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