Use the MI LANCE code.

This commit is contained in:
mycroft 1995-12-10 08:46:05 +00:00
parent f183fc14f7
commit 9ca6a401eb
3 changed files with 220 additions and 1096 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,127 +1,46 @@
/* $NetBSD: if_lereg.h,v 1.10 1995/01/24 05:50:52 gwr Exp $ */
/* $NetBSD: if_lereg.h,v 1.11 1995/12/10 08:46:07 mycroft Exp $ */
/*
* LANCE Ethernet driver header file
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
*
* Copyright (c) 1995 Gordon W. Ross
* Copyright (c) 1994 Charles Hannum.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Copyright (C) 1993, Paul Richards. This software may be used, modified,
* copied, distributed, and sold, in both source and binary form provided
* that the above copyright and these terms are retained. Under no
* circumstances is the author responsible for the proper functioning
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
*/
/* Declarations specific to this driver */
#define NTBUF 2
#define TLEN 1
#define NRBUF 8
#define RLEN 3
#define BUFSIZE 1536
#define MEMSIZE 0x4000
/* Local Area Network Controller for Ethernet (LANCE) registers */
struct le_regs {
u_short lereg_data; /* data port */
u_short lereg_addr; /* address port */
/*
* LANCE registers.
*/
struct lereg1 {
volatile u_int16_t ler1_rdp; /* data port */
volatile u_int16_t ler1_rap; /* register select port */
};
/*
* Control and status bits
*/
#define LE_SERR 0x8000
#define LE_BABL 0x4000
#define LE_CERR 0x2000
#define LE_MISS 0x1000
#define LE_MERR 0x0800
#define LE_RINT 0x0400
#define LE_TINT 0x0200
#define LE_IDON 0x0100
#define LE_INTR 0x0080
#define LE_INEA 0x0040
#define LE_RXON 0x0020
#define LE_TXON 0x0010
#define LE_TDMD 0x0008
#define LE_STOP 0x0004
#define LE_STRT 0x0002
#define LE_INIT 0x0001
#define LE_BSWP 0x0004
#define LE_ACON 0x0002
#define LE_BCON 0x0001
/*
* LANCE initialization block
*/
struct init_block {
u_short mode; /* mode register */
u_char padr[6]; /* ethernet address */
u_long ladrf[2]; /* logical address filter (multicast) */
u_short rdra; /* low order pointer to receive ring */
u_short rlen; /* high order pointer and no. rings */
u_short tdra; /* low order pointer to transmit ring */
u_short tlen; /* high order pointer and no rings */
};
/*
* Mode bits -- init_block
*/
#define LE_PROM 0x8000 /* promiscuous */
#define LE_INTL 0x0040 /* internal loopback */
#define LE_DRTY 0x0020 /* disable retry */
#define LE_COLL 0x0010 /* force collision */
#define LE_DTCR 0x0008 /* disable transmit crc */
#define LE_LOOP 0x0004 /* loopback */
#define LE_DTX 0x0002 /* disable transmitter */
#define LE_DRX 0x0001 /* disable receiver */
#define LE_NORMAL 0x0000
/*
* Message descriptor
*/
struct mds {
u_short addr;
u_short flags;
u_short bcnt;
u_short mcnt;
};
/* Message descriptor flags */
#define LE_OWN 0x8000 /* owner bit, 0=host, 1=LANCE */
#define LE_ERR 0x4000 /* error */
#define LE_STP 0x0200 /* start of packet */
#define LE_ENP 0x0100 /* end of packet */
/* Receive ring status flags */
#define LE_FRAM 0x2000 /* framing error error */
#define LE_OFLO 0x1000 /* silo overflow */
#define LE_CRC 0x0800 /* CRC error */
#define LE_RBUFF 0x0400 /* buffer error */
/* Transmit ring status flags */
#define LE_MORE 0x1000 /* more than 1 retry */
#define LE_ONE 0x0800 /* one retry */
#define LE_DEF 0x0400 /* deferred transmit */
/* Transmit errors */
#define LE_TBUFF 0x8000 /* buffer error */
#define LE_UFLO 0x4000 /* silo underflow */
#define LE_LCOL 0x1000 /* late collision */
#define LE_LCAR 0x0800 /* loss of carrier */
#define LE_RTRY 0x0400 /* tried 16 times */
/* DEPCA-specific definitions */
#define DEPCA_CSR 0x0
#define DEPCA_CSR_SHE 0x80 /* Shared memory enabled */
#define DEPCA_CSR_SWAP32 0x40 /* Byte swapped */
#define DEPCA_CSR_DUM 0x08 /* rev E compatibility */
#define DEPCA_CSR_IM 0x04 /* Interrupt masked */
#define DEPCA_CSR_IEN 0x02 /* Interrupt enabled */
#define DEPCA_CSR_NORMAL \
(DEPCA_CSR_SHE | DEPCA_CSR_DUM | DEPCA_CSR_IEN)
#define DEPCA_ADP 0xc

View File

@ -0,0 +1,82 @@
/* $NetBSD: if_levar.h,v 1.1 1995/12/10 08:46:08 mycroft Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell and Rick Macklem.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_le.c 8.2 (Berkeley) 11/16/93
*/
/*
* Ethernet software status per interface.
*
* Each interface is referenced by a network interface structure,
* arpcom.ac_if, which the routing code uses to locate the interface.
* This structure contains the output queue for the interface, its address, ...
*/
struct le_softc {
struct device sc_dev; /* base structure */
struct arpcom sc_arpcom; /* Ethernet common part */
void (*sc_copytodesc)(); /* Copy to descriptor */
void (*sc_copyfromdesc)(); /* Copy from descriptor */
void (*sc_copytobuf)(); /* Copy to buffer */
void (*sc_copyfrombuf)(); /* Copy from buffer */
void (*sc_zerobuf)(); /* and Zero bytes in buffer */
u_int16_t sc_conf3; /* CSR3 value */
void *sc_mem; /* base address of RAM -- CPU's view */
u_long sc_addr; /* base address of RAM -- LANCE's view */
u_long sc_memsize; /* size of RAM */
int sc_nrbuf; /* number of receive buffers */
int sc_ntbuf; /* number of transmit buffers */
int sc_last_rd;
int sc_first_td, sc_last_td, sc_no_td;
int sc_initaddr;
int sc_rmdaddr;
int sc_tmdaddr;
int sc_rbufaddr;
int sc_tbufaddr;
#ifdef LEDEBUG
int sc_debug;
#endif
struct lereg1 *sc_r1; /* LANCE registers */
};