* Copyright (c) 1982, 1990 The Regents of the University of California.
* %sccs.include.redist.c%
* @(#)nhpib.c 7.6 (Berkeley) %G%
* Internal/98624 HPIB driver
#include "hp/dev/device.h"
register struct hp_ctlr
*hc
;
register struct hpib_softc
*hs
= &hpib_softc
[hc
->hp_unit
];
register struct nhpibdevice
*hd
= (struct nhpibdevice
*)hc
->hp_addr
;
if (hc
->hp_addr
== internalhpib
) {
else if (hd
->hpib_cid
== HPIBB
) {
hs
->sc_ba
= hd
->hpib_csa
& CSA_BA
;
hc
->hp_ipl
= HPIB_IPL(hd
->hpib_ids
);
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
hd
->hpib_acr
= AUX_SSWRST
;
hd
->hpib_acr
= AUX_CSHDW
;
hd
->hpib_acr
= AUX_SSTD1
;
hd
->hpib_acr
= AUX_SVSTD1
;
hd
->hpib_acr
= AUX_CHDFA
;
hd
->hpib_acr
= AUX_CHDFE
;
hd
->hpib_acr
= AUX_CSWRST
;
register struct nhpibdevice
*hd
;
nhpibsend(unit
, slave
, sec
, addr
, origcnt
)
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
register int cnt
= origcnt
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
if (nhpibwait(hd
, MIS_BO
))
hd
->hpib_data
= C_TAG
+ hs
->sc_ba
;
if (nhpibwait(hd
, MIS_BO
))
hd
->hpib_data
= C_LAG
+ slave
;
if (nhpibwait(hd
, MIS_BO
))
hd
->hpib_data
= C_SCG
+ sec
;
if (nhpibwait(hd
, MIS_BO
))
if (nhpibwait(hd
, MIS_BO
))
if (nhpibwait(hd
, MIS_BO
))
* May be causing 345 disks to hang due to interference
(void) nhpibwait(hd
, MIS_BO
);
return(origcnt
- cnt
- 1);
nhpibrecv(unit
, slave
, sec
, addr
, origcnt
)
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
register int cnt
= origcnt
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
if (nhpibwait(hd
, MIS_BO
))
hd
->hpib_data
= C_LAG
+ hs
->sc_ba
;
if (nhpibwait(hd
, MIS_BO
))
hd
->hpib_data
= C_TAG
+ slave
;
if (nhpibwait(hd
, MIS_BO
))
hd
->hpib_data
= C_SCG
+ sec
;
if (nhpibwait(hd
, MIS_BO
))
if (nhpibwait(hd
, MIS_BI
))
hd
->hpib_data
= (slave
== 31) ? C_UNA
: C_UNT
;
(void) nhpibwait(hd
, MIS_BO
);
return(origcnt
- cnt
- 1);
nhpibgo(unit
, slave
, sec
, addr
, count
, rw
)
register int unit
, slave
;
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
hs
->sc_flags
|= HPIBF_IO
;
hs
->sc_flags
|= HPIBF_READ
;
else if (hs
->sc_flags
& HPIBF_READ
) {
printf("nhpibgo: HPIBF_READ still set\n");
hs
->sc_flags
&= ~HPIBF_READ
;
if (hs
->sc_flags
& HPIBF_READ
) {
dmago(hs
->sc_dq
.dq_ctlr
, addr
, count
, DMAGO_BYTE
|DMAGO_READ
);
nhpibrecv(unit
, slave
, sec
, 0, 0);
if (count
< hpibdmathresh
) {
nhpibsend(unit
, slave
, sec
, addr
, count
);
dmago(hs
->sc_dq
.dq_ctlr
, addr
, count
, DMAGO_BYTE
);
nhpibsend(unit
, slave
, sec
, 0, 0);
hd
->hpib_ie
= IDS_IE
| IDS_DMA(hs
->sc_dq
.dq_ctlr
);
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
hs
->sc_flags
|= HPIBF_DONE
;
if ((hs
->sc_flags
& HPIBF_READ
) == 0) {
(void) nhpibwait(hd
, MIS_BO
);
hd
->hpib_data
= *hs
->sc_addr
;
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
register struct devqueue
*dq
;
if (stat1
= unit
) return(1);
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
if ((hd
->hpib_ids
& IDS_IR
) == 0)
if (hs
->sc_flags
& HPIBF_IO
) {
if ((hs
->sc_flags
& HPIBF_DONE
) == 0)
dmastop(hs
->sc_dq
.dq_ctlr
);
hs
->sc_flags
&= ~(HPIBF_DONE
|HPIBF_IO
|HPIBF_READ
);
(dq
->dq_driver
->d_intr
)(dq
->dq_unit
);
} else if (hs
->sc_flags
& HPIBF_PPOLL
) {
stat0
= nhpibppoll(unit
);
if (stat0
& (0x80 >> dq
->dq_slave
)) {
hs
->sc_flags
&= ~HPIBF_PPOLL
;
(dq
->dq_driver
->d_intr
)(dq
->dq_unit
);
printf("hpib%d: PPOLL intr bad status %x\n",
register struct nhpibdevice
*hd
;
hd
= (struct nhpibdevice
*)hpib_softc
[unit
].sc_hc
->hp_addr
;
register struct nhpibdevice
*hd
;
register int timo
= hpibtimeout
;
while ((hd
->hpib_mis
& x
) == 0 && --timo
)
register struct hpib_softc
*hs
;
if ((hs
->sc_flags
& HPIBF_PPOLL
) == 0)
if (nhpibppoll(unit
) & (0x80 >> hs
->sc_sq
.dq_forw
->dq_slave
))
((struct nhpibdevice
*)hs
->sc_hc
->hp_addr
)->hpib_mim
= MIS_BO
;
timeout(nhpibppwatch
, (void *)unit
, 1);