diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 05:29:32 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 05:29:32 +0000 |
commit | 86b4fdd623d3c50d7bfd9427c2c9208454cd0da7 (patch) | |
tree | 5d95abcaf58d01703a30c7ab600537d3b8f67989 /sys/arch/hp300/dev/nhpib.c | |
parent | e2cd6c399798843e13e76f49dc8ee048b51f99f1 (diff) |
update from netbsd (verbatim)
Diffstat (limited to 'sys/arch/hp300/dev/nhpib.c')
-rw-r--r-- | sys/arch/hp300/dev/nhpib.c | 96 |
1 files changed, 77 insertions, 19 deletions
diff --git a/sys/arch/hp300/dev/nhpib.c b/sys/arch/hp300/dev/nhpib.c index 7d2342535a2..f7864d20ecb 100644 --- a/sys/arch/hp300/dev/nhpib.c +++ b/sys/arch/hp300/dev/nhpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: nhpib.c,v 1.6 1995/01/07 10:30:14 mycroft Exp $ */ +/* $NetBSD: nhpib.c,v 1.8 1995/12/02 18:22:06 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -74,6 +74,30 @@ static u_char sec_par[] = { 0370,0171,0172,0373,0174,0375,0376,0177 }; +void nhpibreset __P((int)); +int nhpibsend __P((int, int, int, void *, int)); +int nhpibrecv __P((int, int, int, void *, int)); +int nhpibppoll __P((int)); +void nhpibppwatch __P((void *)); +void nhpibgo __P((int, int, int, void *, int, int, int)); +void nhpibdone __P((int)); +int nhpibintr __P((int)); + +/* + * Our controller ops structure. + */ +struct hpib_controller nhpib_controller = { + nhpibreset, + nhpibsend, + nhpibrecv, + nhpibppoll, + nhpibppwatch, + nhpibgo, + nhpibdone, + nhpibintr +}; + +int nhpibtype(hc) register struct hp_ctlr *hc; { @@ -82,19 +106,44 @@ nhpibtype(hc) if (hc->hp_addr == internalhpib) { hs->sc_type = HPIBA; - hs->sc_ba = HPIBA_BA; hc->hp_ipl = HPIBA_IPL; - } - else if (hd->hpib_cid == HPIBB) { + return (1); + } else if (hd->hpib_cid == HPIBB) { hs->sc_type = HPIBB; - hs->sc_ba = hd->hpib_csa & CSA_BA; hc->hp_ipl = HPIB_IPL(hd->hpib_ids); + return (1); } - else - return(0); - return(1); + + return(0); +} + +void +nhpibattach(hc) + register struct hp_ctlr *hc; +{ + struct hpib_softc *hs = &hpib_softc[hc->hp_unit]; + register struct nhpibdevice *hd = (struct nhpibdevice *)hc->hp_addr; + + switch (hs->sc_type) { + case HPIBA: + hs->sc_ba = HPIBA_BA; + hs->sc_descrip = "Internal HP-IB"; + break; + + case HPIBB: + hs->sc_ba = hd->hpib_csa & CSA_BA; + hs->sc_descrip = "98624 HP-IB"; + break; + + default: + panic("nhpibattach: unknown type 0x%x", hs->sc_type); + /* NOTREACHED */ + } + + hs->sc_controller = &nhpib_controller; } +void nhpibreset(unit) int unit; { @@ -132,13 +181,15 @@ nhpibifc(hd) hd->hpib_acr = AUX_SSRE; } -nhpibsend(unit, slave, sec, addr, origcnt) +int +nhpibsend(unit, slave, sec, ptr, origcnt) int unit, slave, sec, origcnt; - register char *addr; + void *ptr; { register struct hpib_softc *hs = &hpib_softc[unit]; register struct nhpibdevice *hd; register int cnt = origcnt; + char *addr = ptr; hd = (struct nhpibdevice *)hs->sc_hc->hp_addr; hd->hpib_acr = AUX_TCA; @@ -188,13 +239,15 @@ senderror: return(origcnt - cnt - 1); } -nhpibrecv(unit, slave, sec, addr, origcnt) +int +nhpibrecv(unit, slave, sec, ptr, origcnt) int unit, slave, sec, origcnt; - register char *addr; + void *ptr; { register struct hpib_softc *hs = &hpib_softc[unit]; register struct nhpibdevice *hd; register int cnt = origcnt; + char *addr = ptr; hd = (struct nhpibdevice *)hs->sc_hc->hp_addr; /* @@ -239,13 +292,14 @@ recvbyteserror: return(origcnt - cnt - 1); } -nhpibgo(unit, slave, sec, addr, count, rw, timo) - register int unit, slave; - int sec, count, rw; - char *addr; +void +nhpibgo(unit, slave, sec, ptr, count, rw, timo) + int unit, slave, sec, count, rw, timo; + void *ptr; { register struct hpib_softc *hs = &hpib_softc[unit]; register struct nhpibdevice *hd; + char *addr = ptr; hd = (struct nhpibdevice *)hs->sc_hc->hp_addr; hs->sc_flags |= HPIBF_IO; @@ -313,6 +367,7 @@ nhpibreadtimo(arg) (void) splx(s); } +void nhpibdone(unit) register int unit; { @@ -344,6 +399,7 @@ nhpibdone(unit) } } +int nhpibintr(unit) register int unit; { @@ -382,13 +438,14 @@ nhpibintr(unit) } #ifdef DEBUG else - printf("hpib%d: PPOLL intr bad status %x\n", - unit, stat0); + printf("%s: PPOLL intr bad status %x\n", + hs->sc_hc->hp_xname, stat0); #endif } return(1); } +int nhpibppoll(unit) int unit; { @@ -407,6 +464,7 @@ nhpibppoll(unit) int nhpibreporttimo = 0; #endif +int nhpibwait(hd, x) register struct nhpibdevice *hd; int x; @@ -446,4 +504,4 @@ again: else timeout(nhpibppwatch, (void *)unit, 1); } -#endif +#endif /* NHPIB > 0 */ |