Home | History | Annotate | Line # | Download | only in boot
      1  1.1  tsutsui /*	$NetBSD: lance.h,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */
      2  1.1  tsutsui 
      3  1.1  tsutsui /*-
      4  1.1  tsutsui  * Copyright (c) 1982, 1992, 1993
      5  1.1  tsutsui  *	The Regents of the University of California.  All rights reserved.
      6  1.1  tsutsui  *
      7  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
      8  1.1  tsutsui  * modification, are permitted provided that the following conditions
      9  1.1  tsutsui  * are met:
     10  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     11  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     12  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     15  1.1  tsutsui  * 3. Neither the name of the University nor the names of its contributors
     16  1.1  tsutsui  *    may be used to endorse or promote products derived from this software
     17  1.1  tsutsui  *    without specific prior written permission.
     18  1.1  tsutsui  *
     19  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  1.1  tsutsui  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  1.1  tsutsui  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  1.1  tsutsui  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  1.1  tsutsui  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  1.1  tsutsui  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  1.1  tsutsui  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  1.1  tsutsui  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  1.1  tsutsui  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  1.1  tsutsui  * SUCH DAMAGE.
     30  1.1  tsutsui  *
     31  1.1  tsutsui  * @(#)if_lereg.h	8.2 (Berkeley) 10/30/93
     32  1.1  tsutsui  */
     33  1.1  tsutsui 
     34  1.1  tsutsui #define	LEMTU		1518
     35  1.1  tsutsui #define	LEMINSIZE	60	/* should be 64 if mode DTCR is set */
     36  1.1  tsutsui #define	LERBUF		8
     37  1.1  tsutsui #define	LERBUFLOG2	3
     38  1.1  tsutsui #define	LE_RLEN		(LERBUFLOG2 << 13)
     39  1.1  tsutsui #define	LE_NEXTRMD(x)	(((x) + 1) & (LERBUF - 1))
     40  1.1  tsutsui #define	LETBUF		1
     41  1.1  tsutsui #define	LETBUFLOG2	0
     42  1.1  tsutsui #define	LE_TLEN		(LETBUFLOG2 << 13)
     43  1.1  tsutsui #define	LE_NEXTTMD(x)	(((x) + 1) & (LETBUF - 1))
     44  1.1  tsutsui 
     45  1.1  tsutsui /* Local Area Network Controller for Ethernet (LANCE) registers */
     46  1.1  tsutsui struct lereg {
     47  1.1  tsutsui 	volatile uint16_t	ler_rdp;	/* register data port */
     48  1.1  tsutsui 	volatile uint16_t	ler_rap;	/* register address port */
     49  1.1  tsutsui };
     50  1.1  tsutsui 
     51  1.1  tsutsui /*
     52  1.1  tsutsui  * lance memory
     53  1.1  tsutsui  */
     54  1.1  tsutsui 
     55  1.1  tsutsui /* receive message descriptors. bits/hadr are byte order dependent. */
     56  1.1  tsutsui struct	lermd_v {
     57  1.1  tsutsui 	volatile uint16_t rmd0;		/* low address of packet */
     58  1.1  tsutsui #if BYTE_ORDER == BIG_ENDIAN
     59  1.1  tsutsui 	volatile uint8_t  rmd1_bits;	/* descriptor bits */
     60  1.1  tsutsui 	volatile uint8_t  rmd1_hadr;	/* high address of packet */
     61  1.1  tsutsui #else
     62  1.1  tsutsui 	volatile uint8_t  rmd1_hadr;	/* high address of packet */
     63  1.1  tsutsui 	volatile uint8_t  rmd1_bits;	/* descriptor bits */
     64  1.1  tsutsui #endif
     65  1.1  tsutsui 	volatile int16_t  rmd2;		/* buffer byte count */
     66  1.1  tsutsui 	volatile uint16_t rmd3;		/* message byte count */
     67  1.1  tsutsui };
     68  1.1  tsutsui 
     69  1.1  tsutsui /* transmit message descriptors */
     70  1.1  tsutsui struct	letmd_v {
     71  1.1  tsutsui 	volatile uint16_t tmd0;		/* low address of packet */
     72  1.1  tsutsui #if BYTE_ORDER == BIG_ENDIAN
     73  1.1  tsutsui 	volatile uint8_t  tmd1_bits;	/* descriptor bits */
     74  1.1  tsutsui 	volatile uint8_t  tmd1_hadr;	/* high address of packet */
     75  1.1  tsutsui #else
     76  1.1  tsutsui 	volatile uint8_t  tmd1_hadr;	/* high address of packet */
     77  1.1  tsutsui 	volatile uint8_t  tmd1_bits;	/* descriptor bits */
     78  1.1  tsutsui #endif
     79  1.1  tsutsui 	volatile int16_t  tmd2;		/* buffer byte count */
     80  1.1  tsutsui 	volatile uint16_t tmd3;		/* transmit error bits */
     81  1.1  tsutsui };
     82  1.1  tsutsui 
     83  1.1  tsutsui struct lemem {
     84  1.1  tsutsui 	/* initialization block */
     85  1.1  tsutsui 	volatile uint16_t	lem_mode;	/* mode */
     86  1.1  tsutsui 	volatile uint16_t	lem_padr[3];	/* physical address */
     87  1.1  tsutsui 	volatile uint16_t	lem_ladrf[4];	/* logical address filter */
     88  1.1  tsutsui 	volatile uint16_t	lem_rdra;	/* receive descriptor addr */
     89  1.1  tsutsui 	volatile uint16_t	lem_rlen;	/* rda high and ring size */
     90  1.1  tsutsui 	volatile uint16_t	lem_tdra;	/* transmit descriptor addr */
     91  1.1  tsutsui 	volatile uint16_t	lem_tlen;	/* tda high and ring size */
     92  1.1  tsutsui 	uint16_t		lem_pad0[4];
     93  1.1  tsutsui 	struct lermd_v		lem_rmd[LERBUF];
     94  1.1  tsutsui 	struct letmd_v		lem_tmd[LETBUF];
     95  1.1  tsutsui 	volatile uint8_t	lem_rbuf[LERBUF][LEMTU];
     96  1.1  tsutsui 	volatile uint8_t	lem_tbuf[LETBUF][LEMTU];
     97  1.1  tsutsui };
     98  1.1  tsutsui 
     99  1.1  tsutsui struct le_softc {
    100  1.1  tsutsui 	struct lereg *sc_reg;
    101  1.1  tsutsui 	struct lemem *sc_mem;
    102  1.1  tsutsui 	uint8_t sc_enaddr[6];
    103  1.1  tsutsui 	int sc_curtmd;
    104  1.1  tsutsui 	int sc_currmd;
    105  1.1  tsutsui };
    106