if_le supports now the Ariadne card.
This commit is contained in:
parent
2268a2c7eb
commit
fd019e12b5
File diff suppressed because it is too large
Load Diff
@ -1,155 +0,0 @@
|
||||
/* $NetBSD: if_aereg.h,v 1.2 1995/08/18 15:53:32 chopps Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Bernd Ernesti and Klaus Burkert. 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 Bernd Ernesti, by Klaus
|
||||
* Burkert, by Michael van Elst, and 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_lereg.h 8.1 (Berkeley) 6/10/93
|
||||
*
|
||||
* This is based on the original LANCE files, as the PCnet-ISA used on
|
||||
* the Ariadne is a LANCE-descendant optimized for the PC-ISA bus.
|
||||
* This causes some modifications, all data that is to go into registers
|
||||
* or to structures (buffer-descriptors, init-block) has to be
|
||||
* byte-swapped. In addition ALL write accesses to the board have to be
|
||||
* WORD or LONG, BYTE-access is prohibited!!
|
||||
*/
|
||||
|
||||
#define ETHER_MAX_LEN 1518
|
||||
#define ETHER_MIN_LEN 64
|
||||
|
||||
#define AERBUF 16 /* 16 receive buffers */
|
||||
#define AERBUFLOG2 4
|
||||
#define AETBUF 4 /* 4 transmit buffers */
|
||||
#define AETBUFLOG2 2
|
||||
|
||||
#define AE_RLEN (AERBUFLOG2 << 13)
|
||||
#define AE_TLEN (AETBUFLOG2 << 13)
|
||||
|
||||
/*
|
||||
* PCnet-ISA registers.
|
||||
*/
|
||||
|
||||
struct aereg1 {
|
||||
u_int16_t aer1_rdp; /* data port */
|
||||
u_int16_t aer1_rap; /* register select port */
|
||||
u_int16_t aer1_reset; /* reading this resets the PCnet-ISA */
|
||||
u_int16_t aer1_idp; /* isa configuration port */
|
||||
};
|
||||
|
||||
struct aereg2 {
|
||||
/* init block */
|
||||
u_int16_t aer2_mode; /* +0x0000 */
|
||||
u_int16_t aer2_padr[3]; /* +0x0002 */
|
||||
u_int16_t aer2_ladrf[4]; /* +0x0008 */
|
||||
u_int16_t aer2_rdra; /* +0x0010 */
|
||||
u_int16_t aer2_rlen; /* +0x0012 */
|
||||
u_int16_t aer2_tdra; /* +0x0014 */
|
||||
u_int16_t aer2_tlen; /* +0x0016 */
|
||||
/* receive message descriptors */
|
||||
struct aermd { /* +0x0018 */
|
||||
u_int16_t rmd0;
|
||||
u_int16_t rmd1;
|
||||
int16_t rmd2;
|
||||
u_int16_t rmd3;
|
||||
} aer2_rmd[AERBUF];
|
||||
/* transmit message descriptors */
|
||||
struct aetmd { /* +0x0058 */
|
||||
u_int16_t tmd0;
|
||||
u_int16_t tmd1;
|
||||
int16_t tmd2;
|
||||
u_int16_t tmd3;
|
||||
} aer2_tmd[AETBUF];
|
||||
char aer2_rbuf[AERBUF][ETHER_MAX_LEN]; /* +0x0060 */
|
||||
char aer2_tbuf[AETBUF][ETHER_MAX_LEN]; /* +0x2FD0 */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Control and status bits -- aereg1
|
||||
*/
|
||||
#define AE_CSR0 0x0000 /* Control and status register */
|
||||
#define AE_CSR1 0x0100 /* low address of init block */
|
||||
#define AE_CSR2 0x0200 /* high address of init block */
|
||||
#define AE_CSR3 0x0300 /* Bus master and control */
|
||||
|
||||
/* Control and status register 0 (csr0) */
|
||||
#define AE_SERR 0x0080 /* error summary */
|
||||
#define AE_BABL 0x0040 /* transmitter timeout error */
|
||||
#define AE_CERR 0x0020 /* collision */
|
||||
#define AE_MISS 0x0010 /* missed a packet */
|
||||
#define AE_MERR 0x0008 /* memory error */
|
||||
#define AE_RINT 0x0004 /* receiver interrupt */
|
||||
#define AE_TINT 0x0002 /* transmitter interrupt */
|
||||
#define AE_IDON 0x0001 /* initalization done */
|
||||
#define AE_INTR 0x8000 /* interrupt condition */
|
||||
#define AE_INEA 0x4000 /* interrupt enable */
|
||||
#define AE_RXON 0x2000 /* receiver on */
|
||||
#define AE_TXON 0x1000 /* transmitter on */
|
||||
#define AE_TDMD 0x0800 /* transmit demand */
|
||||
#define AE_STOP 0x0400 /* disable all external activity */
|
||||
#define AE_STRT 0x0200 /* enable external activity */
|
||||
#define AE_INIT 0x0100 /* begin initalization */
|
||||
|
||||
#define AE_PROM 0x0080 /* promiscuous mode */
|
||||
#define AE_MODE 0x0000
|
||||
|
||||
/*
|
||||
* Control and status bits -- aereg2
|
||||
*/
|
||||
#define AE_OWN 0x0080 /* LANCE owns the packet */
|
||||
#define AE_ERR 0x0040 /* error summary */
|
||||
#define AE_STP 0x0002 /* start of packet */
|
||||
#define AE_ENP 0x0001 /* end of packet */
|
||||
|
||||
#define AE_MORE 0x0010 /* multiple collisions */
|
||||
#define AE_ONE 0x0008 /* single collision */
|
||||
#define AE_DEF 0x0004 /* defferred transmit */
|
||||
|
||||
#define AE_FRAM 0x0020 /* framing error */
|
||||
#define AE_OFLO 0x0010 /* overflow error */
|
||||
#define AE_CRC 0x0008 /* CRC error */
|
||||
#define AE_RBUFF 0x0004 /* buffer error */
|
||||
|
||||
/* Transmit message descriptor 3 (tmd3) */
|
||||
#define AE_TBUFF 0x0080 /* buffer error */
|
||||
#define AE_UFLO 0x0040 /* underflow error */
|
||||
#define AE_LCOL 0x0010 /* late collision */
|
||||
#define AE_LCAR 0x0008 /* loss of carrier */
|
||||
#define AE_RTRY 0x0004 /* retry error */
|
||||
#define AE_TDR_MASK 0xff03 /* time domain reflectometry counter */
|
||||
|
||||
#define SWAP(x) (((x & 0xff) << 8 ) | (( x >> 8) & 0xff))
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* $NetBSD: if_le.c,v 1.25 1997/03/17 17:51:41 is Exp $ */
|
||||
/* $NetBSD: if_le.c,v 1.26 1997/03/27 21:15:13 veego Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 Jason R. Thorpe and Bernd Ernesti. All rights reserved.
|
||||
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -18,6 +19,8 @@
|
||||
* 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 for the NetBSD Project
|
||||
* by Bernd Ernesti and Jason R. Thorpe.
|
||||
* 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
|
||||
@ -69,9 +72,6 @@
|
||||
#include <amiga/dev/zbusvar.h>
|
||||
#include <amiga/dev/if_levar.h>
|
||||
|
||||
/* offsets for: ID, REGS, MEM */
|
||||
int lestd[] = { 0, 0x4000, 0x8000 };
|
||||
|
||||
int le_zbus_match __P((struct device *, struct cfdata *, void *));
|
||||
void le_zbus_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
@ -79,9 +79,77 @@ struct cfattach le_zbus_ca = {
|
||||
sizeof(struct le_softc), le_zbus_match, le_zbus_attach
|
||||
};
|
||||
|
||||
hide void lepcnet_reset __P((struct am7990_softc *));
|
||||
hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t));
|
||||
hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t));
|
||||
|
||||
hide u_int16_t ariadne_swapreg __P((u_int16_t));
|
||||
hide void ariadne_wrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t));
|
||||
hide u_int16_t ariadne_rdcsr __P((struct am7990_softc *, u_int16_t));
|
||||
hide void ariadne_wribcr __P((struct am7990_softc *, u_int16_t, u_int16_t));
|
||||
integrate void ariadne_copytodesc_word __P((struct am7990_softc *, void *, int, int));
|
||||
integrate void ariadne_copyfromdesc_word __P((struct am7990_softc *, void *, int, int));
|
||||
integrate void ariadne_copytobuf_word __P((struct am7990_softc *, void *, int, int));
|
||||
integrate void ariadne_copyfrombuf_word __P((struct am7990_softc *, void *, int, int));
|
||||
integrate void ariadne_zerobuf_word __P((struct am7990_softc *, int, int));
|
||||
void ariadne_autoselect __P((struct am7990_softc *, int));
|
||||
int ariadne_mediachange __P((struct am7990_softc *));
|
||||
void ariadne_hwinit __P((struct am7990_softc *));
|
||||
|
||||
/*
|
||||
* Media types supported by the Ariadne.
|
||||
*/
|
||||
int lemedia_ariadne[] = {
|
||||
IFM_ETHER | IFM_10_T,
|
||||
IFM_ETHER | IFM_10_2,
|
||||
IFM_ETHER | IFM_AUTO,
|
||||
};
|
||||
#define NLEMEDIA_ARIADNE (sizeof(lemedia_ariadne) / sizeof(lemedia_ariadne[0]))
|
||||
|
||||
|
||||
hide u_int16_t
|
||||
ariadne_swapreg(val)
|
||||
u_int16_t val;
|
||||
{
|
||||
|
||||
return (((val & 0xff) << 8 ) | (( val >> 8) & 0xff));
|
||||
}
|
||||
|
||||
hide void
|
||||
ariadne_wrcsr(sc, port, val)
|
||||
struct am7990_softc *sc;
|
||||
u_int16_t port, val;
|
||||
{
|
||||
struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
|
||||
ler1->ler1_rap = ariadne_swapreg(port);
|
||||
ler1->ler1_rdp = ariadne_swapreg(val);
|
||||
}
|
||||
|
||||
hide u_int16_t
|
||||
ariadne_rdcsr(sc, port)
|
||||
struct am7990_softc *sc;
|
||||
u_int16_t port;
|
||||
{
|
||||
struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
u_int16_t val;
|
||||
|
||||
ler1->ler1_rap = ariadne_swapreg(port);
|
||||
val = ariadne_swapreg(ler1->ler1_rdp);
|
||||
return (val);
|
||||
}
|
||||
|
||||
hide void
|
||||
ariadne_wribcr(sc, port, val)
|
||||
struct am7990_softc *sc;
|
||||
u_int16_t port, val;
|
||||
{
|
||||
struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
|
||||
ler1->ler1_rap = ariadne_swapreg(port);
|
||||
ler1->ler1_idp = ariadne_swapreg(val);
|
||||
}
|
||||
|
||||
hide void
|
||||
lewrcsr(sc, port, val)
|
||||
struct am7990_softc *sc;
|
||||
@ -106,6 +174,91 @@ lerdcsr(sc, port)
|
||||
return (val);
|
||||
}
|
||||
|
||||
hide void
|
||||
lepcnet_reset(sc)
|
||||
struct am7990_softc *sc;
|
||||
{
|
||||
struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
volatile int dummy;
|
||||
|
||||
dummy = ler1->ler1_reset; /* Reset PCNet-ISA */
|
||||
}
|
||||
|
||||
void
|
||||
ariadne_autoselect(sc, on)
|
||||
struct am7990_softc *sc;
|
||||
int on;
|
||||
{
|
||||
|
||||
/*
|
||||
* on = 0: autoselect disabled
|
||||
* on = 1: autoselect enabled
|
||||
*/
|
||||
if (on == 0)
|
||||
ariadne_wribcr(sc, LE_BCR_MC, 0x0000);
|
||||
else
|
||||
ariadne_wribcr(sc, LE_BCR_MC, LE_MC_ASEL);
|
||||
}
|
||||
|
||||
int
|
||||
ariadne_mediachange(sc)
|
||||
struct am7990_softc *sc;
|
||||
{
|
||||
struct ifmedia *ifm = &sc->sc_media;
|
||||
|
||||
if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
* Switch to the selected media. If autoselect is
|
||||
* set, switch it on otherwise disable it. We'll
|
||||
* switch to the other media when we detect loss of
|
||||
* carrier.
|
||||
*/
|
||||
switch (IFM_SUBTYPE(ifm->ifm_media)) {
|
||||
case IFM_10_T:
|
||||
sc->sc_initmodemedia = 1;
|
||||
am7990_init(sc);
|
||||
break;
|
||||
|
||||
case IFM_10_2:
|
||||
sc->sc_initmodemedia = 0;
|
||||
am7990_init(sc);
|
||||
break;
|
||||
|
||||
case IFM_AUTO:
|
||||
sc->sc_initmodemedia = 2;
|
||||
ariadne_hwinit(sc);
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ariadne_hwinit(sc)
|
||||
struct am7990_softc *sc;
|
||||
{
|
||||
|
||||
/*
|
||||
* Re-program LEDs to match meaning used on the Ariadne board.
|
||||
*/
|
||||
ariadne_wribcr(sc, LE_BCR_LED1, 0x0090);
|
||||
ariadne_wribcr(sc, LE_BCR_LED2, 0x0081);
|
||||
ariadne_wribcr(sc, LE_BCR_LED3, 0x0084);
|
||||
|
||||
/*
|
||||
* Enabel/Disable auto selection
|
||||
*/
|
||||
if (sc->sc_initmodemedia == 2)
|
||||
ariadne_autoselect(sc, 1);
|
||||
else
|
||||
ariadne_autoselect(sc, 0);
|
||||
}
|
||||
|
||||
int
|
||||
le_zbus_match(parent, cfp, aux)
|
||||
struct device *parent;
|
||||
@ -122,6 +275,10 @@ le_zbus_match(parent, cfp, aux)
|
||||
if (zap->manid == 1053 && zap->prodid == 1)
|
||||
return (1);
|
||||
|
||||
/* Ariadne ethernet card */
|
||||
if (zap->manid == 2167 && zap->prodid == 201)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -135,43 +292,79 @@ le_zbus_attach(parent, self, aux)
|
||||
struct zbus_args *zap = aux;
|
||||
u_long ser;
|
||||
|
||||
lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va);
|
||||
sc->sc_mem = (void *)(lestd[2] + (int)zap->va);
|
||||
|
||||
sc->sc_copytodesc = am7990_copytobuf_contig;
|
||||
sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
|
||||
sc->sc_copytobuf = am7990_copytobuf_contig;
|
||||
sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
|
||||
sc->sc_zerobuf = am7990_zerobuf_contig;
|
||||
|
||||
sc->sc_rdcsr = lerdcsr;
|
||||
sc->sc_wrcsr = lewrcsr;
|
||||
sc->sc_hwinit = NULL;
|
||||
|
||||
/* This has no effect on PCnet-ISA LANCE chips */
|
||||
sc->sc_conf3 = LE_C3_BSWP;
|
||||
sc->sc_addr = 0x8000;
|
||||
|
||||
/*
|
||||
* Manufacturer decides the 3 first bytes, i.e. ethernet vendor ID.
|
||||
*/
|
||||
switch (zap->manid) {
|
||||
case 514:
|
||||
case 514:
|
||||
/* Commodore */
|
||||
sc->sc_memsize = 32768;
|
||||
sc->sc_enaddr[0] = 0x00;
|
||||
sc->sc_enaddr[1] = 0x80;
|
||||
sc->sc_enaddr[2] = 0x10;
|
||||
lesc->sc_r1 = (struct lereg1 *)(0x4000 + (int)zap->va);
|
||||
sc->sc_mem = (void *)(0x8000 + (int)zap->va);
|
||||
sc->sc_addr = 0x8000;
|
||||
sc->sc_copytodesc = am7990_copytobuf_contig;
|
||||
sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
|
||||
sc->sc_copytobuf = am7990_copytobuf_contig;
|
||||
sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
|
||||
sc->sc_zerobuf = am7990_zerobuf_contig;
|
||||
sc->sc_rdcsr = lerdcsr;
|
||||
sc->sc_wrcsr = lewrcsr;
|
||||
sc->sc_hwreset = NULL;
|
||||
sc->sc_hwinit = NULL;
|
||||
break;
|
||||
|
||||
case 1053:
|
||||
case 1053:
|
||||
/* Ameristar */
|
||||
sc->sc_memsize = 32768;
|
||||
sc->sc_enaddr[0] = 0x00;
|
||||
sc->sc_enaddr[1] = 0x00;
|
||||
sc->sc_enaddr[2] = 0x9f;
|
||||
lesc->sc_r1 = (struct lereg1 *)(0x4000 + (int)zap->va);
|
||||
sc->sc_mem = (void *)(0x8000 + (int)zap->va);
|
||||
sc->sc_addr = 0x8000;
|
||||
sc->sc_copytodesc = am7990_copytobuf_contig;
|
||||
sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
|
||||
sc->sc_copytobuf = am7990_copytobuf_contig;
|
||||
sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
|
||||
sc->sc_zerobuf = am7990_zerobuf_contig;
|
||||
sc->sc_rdcsr = lerdcsr;
|
||||
sc->sc_wrcsr = lewrcsr;
|
||||
sc->sc_hwreset = NULL;
|
||||
sc->sc_hwinit = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 2167:
|
||||
/* Village Tronic */
|
||||
sc->sc_memsize = 32768;
|
||||
sc->sc_enaddr[0] = 0x00;
|
||||
sc->sc_enaddr[1] = 0x60;
|
||||
sc->sc_enaddr[2] = 0x30;
|
||||
lesc->sc_r1 = (struct lereg1 *)(0x0370 + (int)zap->va);
|
||||
sc->sc_mem = (void *)(0x8000 + (int)zap->va);
|
||||
sc->sc_addr = 0x8000;
|
||||
sc->sc_copytodesc = ariadne_copytodesc_word;
|
||||
sc->sc_copyfromdesc = ariadne_copyfromdesc_word;
|
||||
sc->sc_copytobuf = ariadne_copytobuf_word;
|
||||
sc->sc_copyfrombuf = ariadne_copyfrombuf_word;
|
||||
sc->sc_zerobuf = ariadne_zerobuf_word;
|
||||
sc->sc_rdcsr = ariadne_rdcsr;
|
||||
sc->sc_wrcsr = ariadne_wrcsr;
|
||||
sc->sc_hwreset = lepcnet_reset;
|
||||
sc->sc_hwinit = ariadne_hwinit;
|
||||
sc->sc_mediachange = ariadne_mediachange;
|
||||
sc->sc_supmedia = lemedia_ariadne;
|
||||
sc->sc_nsupmedia = NLEMEDIA_ARIADNE;
|
||||
sc->sc_defaultmedia = IFM_ETHER | IFM_AUTO;
|
||||
sc->sc_initmodemedia = 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
panic("le_zbus_attach: bad manid");
|
||||
}
|
||||
|
||||
@ -190,3 +383,114 @@ le_zbus_attach(parent, self, aux)
|
||||
lesc->sc_isr.isr_ipl = 2;
|
||||
add_isr(&lesc->sc_isr);
|
||||
}
|
||||
|
||||
|
||||
integrate void
|
||||
ariadne_copytodesc_word(sc, from, boff, len)
|
||||
struct am7990_softc *sc;
|
||||
void *from;
|
||||
int boff, len;
|
||||
{
|
||||
u_short *b1 = from;
|
||||
volatile u_short *b2 = sc->sc_mem + boff;
|
||||
|
||||
for (len >>= 1; len > 0; len--)
|
||||
*b2++ = ariadne_swapreg(*b1++);
|
||||
}
|
||||
|
||||
integrate void
|
||||
ariadne_copyfromdesc_word(sc, to, boff, len)
|
||||
struct am7990_softc *sc;
|
||||
void *to;
|
||||
int boff, len;
|
||||
{
|
||||
volatile u_short *b1 = sc->sc_mem + boff;
|
||||
u_short *b2 = to;
|
||||
|
||||
for (len >>= 1; len > 0; len--)
|
||||
*b2++ = ariadne_swapreg(*b1++);
|
||||
}
|
||||
|
||||
#define isodd(n) ((n) & 1)
|
||||
|
||||
integrate void
|
||||
ariadne_copytobuf_word(sc, from, boff, len)
|
||||
struct am7990_softc *sc;
|
||||
void *from;
|
||||
int boff, len;
|
||||
{
|
||||
u_char *a1 = from;
|
||||
volatile u_char *a2 = sc->sc_mem + boff;
|
||||
u_short *b1;
|
||||
volatile u_short *b2;
|
||||
int i;
|
||||
|
||||
if (len > 0 && isodd(boff)) {
|
||||
b1 = (u_short *)(a1 + 1);
|
||||
b2 = (u_short *)(a2 + 1);
|
||||
b2[-1] = (b2[-1] & 0xff00) | (b1[-1] & 0x00ff);
|
||||
--len;
|
||||
} else {
|
||||
b1 = (u_short *)a1;
|
||||
b2 = (u_short *)a2;
|
||||
}
|
||||
|
||||
for (i = len >> 1; i > 0; i--)
|
||||
*b2++ = *b1++;
|
||||
|
||||
if (isodd(len))
|
||||
*b2 = (*b2 & 0x00ff) | (*b1 & 0xff00);
|
||||
}
|
||||
|
||||
integrate void
|
||||
ariadne_copyfrombuf_word(sc, to, boff, len)
|
||||
struct am7990_softc *sc;
|
||||
void *to;
|
||||
int boff, len;
|
||||
{
|
||||
volatile u_char *a1 = sc->sc_mem + boff;
|
||||
u_char *a2 = to;
|
||||
volatile u_short *b1;
|
||||
u_short *b2;
|
||||
int i;
|
||||
|
||||
if (len > 0 && isodd(boff)) {
|
||||
b1 = (u_short *)(a1 + 1);
|
||||
b2 = (u_short *)(a2 + 1);
|
||||
b2[-1] = (b2[-1] & 0xff00) | (b1[-1] & 0x00ff);
|
||||
--len;
|
||||
} else {
|
||||
b1 = (u_short *)a1;
|
||||
b2 = (u_short *)a2;
|
||||
}
|
||||
|
||||
for (i = len >> 1; i > 0; i--)
|
||||
*b2++ = *b1++;
|
||||
|
||||
if (isodd(len))
|
||||
*b2 = (*b2 & 0x00ff) | (*b1 & 0xff00);
|
||||
}
|
||||
|
||||
integrate void
|
||||
ariadne_zerobuf_word(sc, boff, len)
|
||||
struct am7990_softc *sc;
|
||||
int boff, len;
|
||||
{
|
||||
volatile u_char *a1 = sc->sc_mem + boff;
|
||||
volatile u_short *b1;
|
||||
int i;
|
||||
|
||||
if (len > 0 && isodd(boff)) {
|
||||
b1 = (u_short *)(a1 + 1);
|
||||
b1[-1] &= 0xff00;
|
||||
--len;
|
||||
} else {
|
||||
b1 = (u_short *)a1;
|
||||
}
|
||||
|
||||
for (i = len >> 1; i > 0; i--)
|
||||
*b1++ = 0;
|
||||
|
||||
if (isodd(len))
|
||||
*b1 &= 0x00ff;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_levar.h,v 1.4 1997/03/15 18:09:27 is Exp $ */
|
||||
/* $NetBSD: if_levar.h,v 1.5 1997/03/27 21:15:14 veego Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990 The Regents of the University of California.
|
||||
@ -34,11 +34,16 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* LANCE registers.
|
||||
* LANCE and PCnet-ISA registers.
|
||||
*/
|
||||
struct lereg1 {
|
||||
u_short ler1_rdp; /* data port */
|
||||
u_short ler1_rap; /* register select port */
|
||||
u_int16_t ler1_rdp; /* data port */
|
||||
u_int16_t ler1_rap; /* register select port */
|
||||
/*
|
||||
* The next two registers are only available on PCnet-ISA cards.
|
||||
*/
|
||||
u_int16_t ler1_reset; /* reading this resets the PCnet-ISA */
|
||||
u_int16_t ler1_idp; /* isa configuration port */
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user