ANSIfication and general cleaning.
This commit is contained in:
parent
7f4849dc04
commit
b642a6e612
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: if_ea.c,v 1.4 2000/08/07 22:21:44 bjh21 Exp $ */
|
/* $NetBSD: if_ea.c,v 1.5 2000/08/08 21:16:59 bjh21 Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Mark Brinicombe
|
* Copyright (c) 1995 Mark Brinicombe
|
||||||
@ -56,6 +56,9 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
__RCSID("$NetBSD: if_ea.c,v 1.5 2000/08/08 21:16:59 bjh21 Exp $");
|
||||||
|
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -133,31 +136,31 @@ struct ea_softc {
|
|||||||
* prototypes
|
* prototypes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int eaintr __P((void *));
|
int eaintr(void *);
|
||||||
static int ea_init __P((struct ea_softc *));
|
static int ea_init(struct ea_softc *);
|
||||||
static int ea_ioctl __P((struct ifnet *, u_long, caddr_t));
|
static int ea_ioctl(struct ifnet *, u_long, caddr_t);
|
||||||
static void ea_start __P((struct ifnet *));
|
static void ea_start(struct ifnet *);
|
||||||
static void ea_watchdog __P((struct ifnet *));
|
static void ea_watchdog(struct ifnet *);
|
||||||
static void ea_reinit __P((struct ea_softc *));
|
static void ea_reinit(struct ea_softc *);
|
||||||
static void ea_chipreset __P((struct ea_softc *));
|
static void ea_chipreset(struct ea_softc *);
|
||||||
static void ea_ramtest __P((struct ea_softc *));
|
static void ea_ramtest(struct ea_softc *);
|
||||||
static int ea_stoptx __P((struct ea_softc *));
|
static int ea_stoptx(struct ea_softc *);
|
||||||
static int ea_stoprx __P((struct ea_softc *));
|
static int ea_stoprx(struct ea_softc *);
|
||||||
static void ea_stop __P((struct ea_softc *));
|
static void ea_stop(struct ea_softc *);
|
||||||
static void ea_writebuf __P((struct ea_softc *, u_char *, int, int));
|
static void ea_writebuf(struct ea_softc *, u_char *, int, int);
|
||||||
static void ea_readbuf __P((struct ea_softc *, u_char *, int, int));
|
static void ea_readbuf(struct ea_softc *, u_char *, int, int);
|
||||||
static void earead __P((struct ea_softc *, caddr_t, int));
|
static void earead(struct ea_softc *, caddr_t, int);
|
||||||
static struct mbuf *eaget __P((caddr_t, int, struct ifnet *));
|
static struct mbuf *eaget(caddr_t, int, struct ifnet *);
|
||||||
static void ea_hardreset __P((struct ea_softc *));
|
static void ea_hardreset(struct ea_softc *);
|
||||||
static void eagetpackets __P((struct ea_softc *));
|
static void eagetpackets(struct ea_softc *);
|
||||||
static void eatxpacket __P((struct ea_softc *));
|
static void eatxpacket(struct ea_softc *);
|
||||||
|
|
||||||
int eaprobe __P((struct device *, struct cfdata *, void *));
|
int eaprobe(struct device *, struct cfdata *, void *);
|
||||||
void eaattach __P((struct device *, struct device *, void *));
|
void eaattach(struct device *, struct device *, void *);
|
||||||
|
|
||||||
void ea_dump_buffer __P((struct ea_softc *, int));
|
void ea_dump_buffer(struct ea_softc *, int);
|
||||||
void ea_claimirq __P((struct ea_softc *));
|
void ea_claimirq(struct ea_softc *);
|
||||||
void ea_releaseirq __P((struct ea_softc *));
|
void ea_releaseirq(struct ea_softc *);
|
||||||
|
|
||||||
/* driver structure for autoconf */
|
/* driver structure for autoconf */
|
||||||
|
|
||||||
@ -172,8 +175,7 @@ struct cfattach ea_ca = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
eadump(iobase)
|
eadump(u_int iobase)
|
||||||
u_int iobase;
|
|
||||||
{
|
{
|
||||||
dprintf(("%08x: %04x %04x %04x %04x %04x %04x %04x %04x\n", iobase,
|
dprintf(("%08x: %04x %04x %04x %04x %04x %04x %04x %04x\n", iobase,
|
||||||
ReadShort(iobase + 0x00), ReadShort(iobase + 0x40),
|
ReadShort(iobase + 0x00), ReadShort(iobase + 0x40),
|
||||||
@ -188,9 +190,7 @@ eadump(iobase)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
ea_dump_buffer(sc, offset)
|
ea_dump_buffer(struct ea_softc *sc, int offset)
|
||||||
struct ea_softc *sc;
|
|
||||||
int offset;
|
|
||||||
{
|
{
|
||||||
#ifdef EA_PACKET_DEBUG
|
#ifdef EA_PACKET_DEBUG
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
@ -232,18 +232,13 @@ ea_dump_buffer(sc, offset)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int eaprobe(struct device *parent, struct cfdata *cf, void *aux)
|
|
||||||
*
|
|
||||||
* Probe for the ether3 podule.
|
* Probe for the ether3 podule.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
eaprobe(parent, cf, aux)
|
eaprobe(struct device *parent, struct cfdata *cf, void *aux)
|
||||||
struct device *parent;
|
|
||||||
struct cfdata *cf;
|
|
||||||
void *aux;
|
|
||||||
{
|
{
|
||||||
struct podulebus_attach_args *pa = (void *)aux;
|
struct podulebus_attach_args *pa = aux;
|
||||||
u_int iobase;
|
u_int iobase;
|
||||||
|
|
||||||
/* Look for a network slot interface */
|
/* Look for a network slot interface */
|
||||||
@ -267,19 +262,14 @@ eaprobe(parent, cf, aux)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void eaattach(struct device *parent, struct device *dev, void *aux)
|
|
||||||
*
|
|
||||||
* Attach podule.
|
* Attach podule.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
eaattach(parent, self, aux)
|
eaattach(struct device *parent, struct device *self, void *aux)
|
||||||
struct device *parent;
|
|
||||||
struct device *self;
|
|
||||||
void *aux;
|
|
||||||
{
|
{
|
||||||
struct ea_softc *sc = (void *)self;
|
struct ea_softc *sc = (void *)self;
|
||||||
struct podulebus_attach_args *pa = (void *)aux;
|
struct podulebus_attach_args *pa = aux;
|
||||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||||
u_int8_t myaddr[ETHER_ADDR_LEN];
|
u_int8_t myaddr[ETHER_ADDR_LEN];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -359,12 +349,11 @@ eaattach(parent, self, aux)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
ea_ramtest(sc)
|
ea_ramtest(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
register u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
register int loop;
|
int loop;
|
||||||
register u_int sum = 0;
|
u_int sum = 0;
|
||||||
char pbuf[9];
|
char pbuf[9];
|
||||||
|
|
||||||
/* dprintf(("ea_ramtest()\n"));*/
|
/* dprintf(("ea_ramtest()\n"));*/
|
||||||
@ -468,8 +457,7 @@ ea_ramtest(sc)
|
|||||||
/* Claim an irq for the board */
|
/* Claim an irq for the board */
|
||||||
|
|
||||||
void
|
void
|
||||||
ea_claimirq(sc)
|
ea_claimirq(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Have we claimed one already ? */
|
/* Have we claimed one already ? */
|
||||||
@ -485,8 +473,7 @@ ea_claimirq(sc)
|
|||||||
/* Release an irq */
|
/* Release an irq */
|
||||||
|
|
||||||
void
|
void
|
||||||
ea_releaseirq(sc)
|
ea_releaseirq(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Have we claimed one ? */
|
/* Have we claimed one ? */
|
||||||
@ -503,8 +490,7 @@ ea_releaseirq(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_reinit(sc)
|
ea_reinit(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
@ -526,8 +512,7 @@ ea_reinit(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ea_stoptx(sc)
|
ea_stoptx(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
int timeout;
|
int timeout;
|
||||||
@ -563,8 +548,7 @@ ea_stoptx(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ea_stoprx(sc)
|
ea_stoprx(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
int timeout;
|
int timeout;
|
||||||
@ -601,8 +585,7 @@ ea_stoprx(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_stop(sc)
|
ea_stop(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
|
|
||||||
@ -635,8 +618,7 @@ ea_stop(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_chipreset(sc)
|
ea_chipreset(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
|
|
||||||
@ -659,8 +641,7 @@ ea_chipreset(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_hardreset(sc)
|
ea_hardreset(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||||
@ -706,11 +687,7 @@ ea_hardreset(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_writebuf(sc, buf, addr, len)
|
ea_writebuf(struct ea_softc *sc, u_char *buf, int addr, int len)
|
||||||
struct ea_softc *sc;
|
|
||||||
u_char *buf;
|
|
||||||
int addr;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
int loop;
|
int loop;
|
||||||
@ -759,11 +736,7 @@ ea_writebuf(sc, buf, addr, len)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_readbuf(sc, buf, addr, len)
|
ea_readbuf(struct ea_softc *sc, u_char *buf, int addr, int len)
|
||||||
struct ea_softc *sc;
|
|
||||||
u_char *buf;
|
|
||||||
int addr;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
int loop;
|
int loop;
|
||||||
@ -831,8 +804,7 @@ ea_readbuf(sc, buf, addr, len)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ea_init(sc)
|
ea_init(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
@ -926,8 +898,7 @@ ea_init(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_start(ifp)
|
ea_start(struct ifnet *ifp)
|
||||||
struct ifnet *ifp;
|
|
||||||
{
|
{
|
||||||
struct ea_softc *sc = ifp->if_softc;
|
struct ea_softc *sc = ifp->if_softc;
|
||||||
int s;
|
int s;
|
||||||
@ -960,8 +931,7 @@ ea_start(ifp)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
eatxpacket(sc)
|
eatxpacket(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
struct mbuf *m, *m0;
|
struct mbuf *m, *m0;
|
||||||
@ -1079,8 +1049,7 @@ eatxpacket(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
eaintr(arg)
|
eaintr(void *arg)
|
||||||
void *arg;
|
|
||||||
{
|
{
|
||||||
register struct ea_softc *sc = arg;
|
register struct ea_softc *sc = arg;
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
@ -1190,8 +1159,7 @@ eaintr(arg)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
eagetpackets(sc)
|
eagetpackets(struct ea_softc *sc)
|
||||||
struct ea_softc *sc;
|
|
||||||
{
|
{
|
||||||
u_int iobase = sc->sc_iobase;
|
u_int iobase = sc->sc_iobase;
|
||||||
int addr;
|
int addr;
|
||||||
@ -1310,10 +1278,7 @@ eagetpackets(sc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
earead(sc, buf, len)
|
earead(struct ea_softc *sc, caddr_t buf, int len)
|
||||||
struct ea_softc *sc;
|
|
||||||
caddr_t buf;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
register struct ether_header *eh;
|
register struct ether_header *eh;
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
@ -1360,10 +1325,7 @@ earead(sc, buf, len)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct mbuf *
|
struct mbuf *
|
||||||
eaget(buf, totlen, ifp)
|
eaget(caddr_t buf, int totlen, struct ifnet *ifp)
|
||||||
caddr_t buf;
|
|
||||||
int totlen;
|
|
||||||
struct ifnet *ifp;
|
|
||||||
{
|
{
|
||||||
struct mbuf *top, **mp, *m;
|
struct mbuf *top, **mp, *m;
|
||||||
int len;
|
int len;
|
||||||
@ -1434,10 +1396,7 @@ eaget(buf, totlen, ifp)
|
|||||||
* Process an ioctl request. This code needs some work - it looks pretty ugly.
|
* Process an ioctl request. This code needs some work - it looks pretty ugly.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ea_ioctl(ifp, cmd, data)
|
ea_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||||
register struct ifnet *ifp;
|
|
||||||
u_long cmd;
|
|
||||||
caddr_t data;
|
|
||||||
{
|
{
|
||||||
struct ea_softc *sc = ifp->if_softc;
|
struct ea_softc *sc = ifp->if_softc;
|
||||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||||
@ -1536,8 +1495,7 @@ ea_ioctl(ifp, cmd, data)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ea_watchdog(ifp)
|
ea_watchdog(struct ifnet *ifp)
|
||||||
struct ifnet *ifp;
|
|
||||||
{
|
{
|
||||||
struct ea_softc *sc = ifp->if_softc;
|
struct ea_softc *sc = ifp->if_softc;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user