summaryrefslogtreecommitdiffstats
path: root/sys/dev/ieee488/upd7210.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-02-11 06:57:02 +0000
committerphk <phk@FreeBSD.org>2005-02-11 06:57:02 +0000
commit316284e3b964ec56428a107ab2aa608610df3d8d (patch)
tree508df96af5232c1ef2c064daff14a6ecd372de6c /sys/dev/ieee488/upd7210.c
parent1989b5df64f024a070c2b7786cb61ac52fb17e96 (diff)
downloadFreeBSD-src-316284e3b964ec56428a107ab2aa608610df3d8d.zip
FreeBSD-src-316284e3b964ec56428a107ab2aa608610df3d8d.tar.gz
Improve EOS handling.
Diffstat (limited to 'sys/dev/ieee488/upd7210.c')
-rw-r--r--sys/dev/ieee488/upd7210.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/sys/dev/ieee488/upd7210.c b/sys/dev/ieee488/upd7210.c
index 81e21d9..ce2c91b 100644
--- a/sys/dev/ieee488/upd7210.c
+++ b/sys/dev/ieee488/upd7210.c
@@ -357,16 +357,18 @@ gpib_ib_irq(struct upd7210 *u)
}
return (1);
}
- if ((u->rreg[ISR1] & IXR1_DO) && ib->dolen > 0) {
+ if ((u->rreg[ISR1] & IXR1_DO) && ib->dobuf != NULL) {
+ if (ib->dolen == 0) {
+ wakeup(ib);
+ ib->dobuf = NULL;
+ write_reg(u, IMR1, 0);
+ return (1);
+ }
if (ib->dolen == 1 && ib->doeoi)
write_reg(u, AUXMR, AUXMR_SEOI);
write_reg(u, CDOR, *ib->dobuf);
ib->dobuf++;
ib->dolen--;
- if (ib->dolen == 0) {
- wakeup(ib);
- write_reg(u, IMR1, 0);
- }
return (1);
}
if (u->rreg[ISR1] & IXR1_ENDRX) {
@@ -384,11 +386,15 @@ config_eos(struct upd7210 *u, struct handle *h)
int i;
i = 0;
- if (h->eos & 0x0400) {
+ if (h->eos & REOS) {
write_reg(u, EOSR, h->eos & 0xff);
i |= AUXA_REOS;
}
- if (h->eos & 0x1000)
+ if (h->eos & XEOS) {
+ write_reg(u, EOSR, h->eos & 0xff);
+ i |= AUXA_XEOS;
+ }
+ if (h->eos & BIN)
i |= AUXA_BIN;
write_reg(u, AUXRA, C_AUXA | i);
}
@@ -476,10 +482,12 @@ do_odata(struct upd7210 *u, u_char *data, int len, int eos)
ib = u->ibfoo;
+ if (len == 0)
+ return (0);
mtx_lock(&u->mutex);
ib->dobuf = data;
ib->dolen = len;
- ib->doeoi = 1;
+ ib->doeoi = 0;
if (!(u->rreg[ISR1] & IXR1_DO)) {
i1 = read_reg(u, ISR1);
@@ -737,6 +745,7 @@ ibwrt(struct upd7210 *u, struct ibfoo_iocarg *ap)
ib->rdh = NULL;
ib->wrh = h;
upd7210_goto_standby(u);
+ config_eos(u, h);
}
i = do_odata(u, bp, ap->cnt, 1);
ap->__ibcnt = i;
OpenPOWER on IntegriCloud