* Copyright (c) 1982, 1990 The Regents of the University of California.
* %sccs.include.redist.c%
* @(#)nhpib.c 7.1 (Berkeley) %G%
* Internal/98624 HPIB driver
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 ((int)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
, cnt
)
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
register int origcnt
= cnt
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
hd
->hpib_data
= C_TAG
+ hs
->sc_ba
;
hd
->hpib_data
= C_LAG
+ slave
;
hd
->hpib_data
= C_SCG
+ sec
;
if (nhpibowait(hd
) < 0) {
if (nhpibowait(hd
) < 0) {
nhpibrecv(unit
, slave
, sec
, addr
, cnt
)
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
register int origcnt
= cnt
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
hd
->hpib_data
= C_LAG
+ hs
->sc_ba
;
hd
->hpib_data
= C_TAG
+ slave
;
hd
->hpib_data
= C_SCG
+ sec
;
if (nhpibiwait(hd
) < 0) {
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);
dmago(hs
->sc_dq
.dq_ctlr
, addr
, 1, DMAGO_BYTE
);
nhpibsend(unit
, slave
, sec
, 0, 0);
hs
->sc_curcnt
= count
- 1;
dmago(hs
->sc_dq
.dq_ctlr
, addr
, count
- 1, 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
;
if (hs
->sc_flags
& HPIBF_READ
) {
hs
->sc_flags
|= HPIBF_DONE
;
dmago(hs
->sc_dq
.dq_ctlr
, hs
->sc_addr
, 1, DMAGO_BYTE
);
hs
->sc_flags
|= HPIBF_DONE
;
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
register struct devqueue
*dq
= hs
->sc_sq
.dq_forw
;
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
);
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
);
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct nhpibdevice
*hd
;
hd
= (struct nhpibdevice
*)hs
->sc_hc
->hp_addr
;
register struct nhpibdevice
*hd
;
register int timo
= hpibtimeout
;
while ((hd
->hpib_mis
& MIS_BO
) == 0 && --timo
)
register struct nhpibdevice
*hd
;
register int timo
= hpibtimeout
;
while ((hd
->hpib_mis
& MIS_BI
) == 0 && --timo
)
register struct hpib_softc
*hs
= &hpib_softc
[unit
];
register struct devqueue
*dq
= hs
->sc_sq
.dq_forw
;
register int slave
= 0x80 >> dq
->dq_slave
;
if ((hs
->sc_flags
& HPIBF_PPOLL
) == 0)
if (nhpibppoll(unit
) & slave
)
((struct nhpibdevice
*)hs
->sc_hc
->hp_addr
)->hpib_mim
= MIS_BO
;
timeout(nhpibppwatch
, unit
, 1);