Home | History | Annotate | Line # | Download | only in dev
if_lereg.h revision 1.6
      1  1.1      cgd /*
      2  1.1      cgd  * Copyright (c) 1982, 1990 The Regents of the University of California.
      3  1.1      cgd  * All rights reserved.
      4  1.1      cgd  *
      5  1.1      cgd  * Redistribution and use in source and binary forms, with or without
      6  1.1      cgd  * modification, are permitted provided that the following conditions
      7  1.1      cgd  * are met:
      8  1.1      cgd  * 1. Redistributions of source code must retain the above copyright
      9  1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     10  1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     11  1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     12  1.1      cgd  *    documentation and/or other materials provided with the distribution.
     13  1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     14  1.1      cgd  *    must display the following acknowledgement:
     15  1.1      cgd  *	This product includes software developed by the University of
     16  1.1      cgd  *	California, Berkeley and its contributors.
     17  1.1      cgd  * 4. Neither the name of the University nor the names of its contributors
     18  1.1      cgd  *    may be used to endorse or promote products derived from this software
     19  1.1      cgd  *    without specific prior written permission.
     20  1.1      cgd  *
     21  1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  1.1      cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1      cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1      cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  1.1      cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1      cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1      cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1      cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1      cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1      cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1      cgd  * SUCH DAMAGE.
     32  1.1      cgd  *
     33  1.2      cgd  *	from: @(#)if_lereg.h	7.1 (Berkeley) 5/8/90
     34  1.6  mycroft  *	$Id: if_lereg.h,v 1.6 1994/07/06 01:36:25 mycroft Exp $
     35  1.1      cgd  */
     36  1.1      cgd 
     37  1.1      cgd #define	LEID		21
     38  1.1      cgd 
     39  1.6  mycroft #define	NTBUF	2
     40  1.6  mycroft #define	TLEN	1
     41  1.6  mycroft #define	NRBUF	8
     42  1.6  mycroft #define	RLEN	3
     43  1.6  mycroft #define	BUFSIZE	1518
     44  1.1      cgd 
     45  1.1      cgd #define vu_char		volatile u_char
     46  1.6  mycroft #define vu_short	volatile u_short
     47  1.1      cgd 
     48  1.1      cgd /*
     49  1.1      cgd  * LANCE registers.
     50  1.1      cgd  */
     51  1.1      cgd struct lereg0 {
     52  1.1      cgd 	u_char	ler0_pad0;
     53  1.1      cgd 	vu_char	ler0_id;	/* ID */
     54  1.1      cgd 	u_char	ler0_pad1;
     55  1.1      cgd 	vu_char	ler0_status;	/* interrupt enable/status */
     56  1.1      cgd };
     57  1.1      cgd 
     58  1.1      cgd /*
     59  1.1      cgd  * Control and status bits -- lereg0
     60  1.1      cgd  */
     61  1.1      cgd #define	LE_IE		0x80		/* interrupt enable */
     62  1.1      cgd #define	LE_IR		0x40		/* interrupt requested */
     63  1.1      cgd #define	LE_LOCK		0x08		/* lock status register */
     64  1.1      cgd #define	LE_ACK		0x04		/* ack of lock */
     65  1.1      cgd #define	LE_JAB		0x02		/* loss of tx clock (???) */
     66  1.1      cgd #define LE_IPL(x)	((((x) >> 4) & 0x3) + 3)
     67  1.1      cgd 
     68  1.6  mycroft struct lereg1 {
     69  1.6  mycroft 	vu_short	ler1_rdp;	/* data port */
     70  1.6  mycroft 	vu_short	ler1_rap;	/* register select port */
     71  1.6  mycroft };
     72  1.6  mycroft 
     73  1.1      cgd /*
     74  1.1      cgd  * Control and status bits -- lereg1
     75  1.1      cgd  */
     76  1.1      cgd #define	LE_SERR		0x8000
     77  1.1      cgd #define	LE_BABL		0x4000
     78  1.1      cgd #define	LE_CERR		0x2000
     79  1.1      cgd #define	LE_MISS		0x1000
     80  1.1      cgd #define	LE_MERR		0x0800
     81  1.1      cgd #define	LE_RINT		0x0400
     82  1.1      cgd #define	LE_TINT		0x0200
     83  1.1      cgd #define	LE_IDON		0x0100
     84  1.1      cgd #define	LE_INTR		0x0080
     85  1.1      cgd #define	LE_INEA		0x0040
     86  1.1      cgd #define	LE_RXON		0x0020
     87  1.1      cgd #define	LE_TXON		0x0010
     88  1.1      cgd #define	LE_TDMD		0x0008
     89  1.1      cgd #define	LE_STOP		0x0004
     90  1.1      cgd #define	LE_STRT		0x0002
     91  1.1      cgd #define	LE_INIT		0x0001
     92  1.1      cgd 
     93  1.6  mycroft #define	LE_BSWP		0x0004
     94  1.6  mycroft #define	LE_ACON		0x0002
     95  1.6  mycroft #define	LE_BCON		0x0001
     96  1.6  mycroft 
     97  1.6  mycroft /*
     98  1.6  mycroft  * Overlayed on 16K dual-port RAM.
     99  1.6  mycroft  * Current size is 15,284 bytes with 8 x 1518 receive buffers and
    100  1.6  mycroft  * 2 x 1518 transmit buffers.
    101  1.6  mycroft  */
    102  1.1      cgd 
    103  1.1      cgd /*
    104  1.6  mycroft  * LANCE initialization block
    105  1.1      cgd  */
    106  1.6  mycroft struct init_block {
    107  1.6  mycroft 	u_short mode;		/* mode register */
    108  1.6  mycroft 	u_char padr[6];		/* ethernet address */
    109  1.6  mycroft 	u_long ladrf[2];	/* logical address filter (multicast) */
    110  1.6  mycroft         u_short rdra;           /* low order pointer to receive ring */
    111  1.6  mycroft         u_short rlen;           /* high order pointer and no. rings */
    112  1.6  mycroft         u_short tdra;           /* low order pointer to transmit ring */
    113  1.6  mycroft         u_short tlen;           /* high order pointer and no rings */
    114  1.6  mycroft };
    115  1.6  mycroft 
    116  1.6  mycroft /*
    117  1.6  mycroft  * Mode bits -- init_block
    118  1.6  mycroft  */
    119  1.6  mycroft #define	LE_PROM		0x8000		/* promiscuous */
    120  1.6  mycroft #define	LE_INTL		0x0040		/* internal loopback */
    121  1.6  mycroft #define	LE_DRTY		0x0020		/* disable retry */
    122  1.6  mycroft #define	LE_COLL		0x0010		/* force collision */
    123  1.6  mycroft #define	LE_DTCR		0x0008		/* disable transmit crc */
    124  1.6  mycroft #define	LE_LOOP		0x0004		/* loopback */
    125  1.6  mycroft #define	LE_DTX		0x0002		/* disable transmitter */
    126  1.6  mycroft #define	LE_DRX		0x0001		/* disable receiver */
    127  1.6  mycroft #define	LE_NORMAL	0x0000
    128  1.6  mycroft 
    129  1.6  mycroft /*
    130  1.6  mycroft  * Message descriptor
    131  1.6  mycroft  */
    132  1.6  mycroft struct mds {
    133  1.6  mycroft 	u_short addr;
    134  1.6  mycroft 	u_short flags;
    135  1.6  mycroft 	u_short bcnt;
    136  1.6  mycroft 	u_short mcnt;
    137  1.6  mycroft };
    138  1.6  mycroft 
    139  1.6  mycroft /* Message descriptor flags */
    140  1.6  mycroft #define LE_OWN		0x8000		/* owner bit, 0=host, 1=LANCE */
    141  1.6  mycroft #define LE_ERR		0x4000		/* error */
    142  1.6  mycroft #define	LE_STP		0x0200		/* start of packet */
    143  1.6  mycroft #define	LE_ENP		0x0100		/* end of packet */
    144  1.6  mycroft 
    145  1.6  mycroft /* Receive ring status flags */
    146  1.6  mycroft #define LE_FRAM		0x2000		/* framing error error */
    147  1.6  mycroft #define LE_OFLO		0x1000		/* silo overflow */
    148  1.6  mycroft #define LE_CRC		0x0800		/* CRC error */
    149  1.6  mycroft #define LE_RBUFF	0x0400		/* buffer error */
    150  1.6  mycroft 
    151  1.6  mycroft /* Transmit ring status flags */
    152  1.6  mycroft #define LE_MORE		0x1000		/* more than 1 retry */
    153  1.6  mycroft #define LE_ONE		0x0800		/* one retry */
    154  1.6  mycroft #define LE_DEF		0x0400		/* deferred transmit */
    155  1.6  mycroft 
    156  1.6  mycroft /* Transmit errors */
    157  1.6  mycroft #define LE_TBUFF	0x8000		/* buffer error */
    158  1.6  mycroft #define LE_UFLO		0x4000		/* silo underflow */
    159  1.6  mycroft #define LE_LCOL		0x1000		/* late collision */
    160  1.6  mycroft #define LE_LCAR		0x0800		/* loss of carrier */
    161  1.6  mycroft #define LE_RTRY		0x0400		/* tried 16 times */
    162