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