* Copyright (c) 1982, 1990 The Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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 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
* @(#)nhpib.c 7.4 (Berkeley) 5/7/91
* 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 (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
= &hpib_softc
[unit
];
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
, unit
, 1);