diff options
author | Nathan Binkert <nate@cvs.openbsd.org> | 2001-10-31 04:24:46 +0000 |
---|---|---|
committer | Nathan Binkert <nate@cvs.openbsd.org> | 2001-10-31 04:24:46 +0000 |
commit | a97c4f313efc21ce5c69aaa04f8af5c9c3a91ed8 (patch) | |
tree | d24bebf58c9f97fac510e47a708039d6912097eb /sys/dev/usb/ugen.c | |
parent | 8837b760cfac7d4d98b9040234c7abf8dc1c24fa (diff) |
Synchronize usb code with NetBSD.
Diffstat (limited to 'sys/dev/usb/ugen.c')
-rw-r--r-- | sys/dev/usb/ugen.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index e871785986c..0d5b04d8195 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ugen.c,v 1.16 2001/09/20 17:02:31 mpech Exp $ */ -/* $NetBSD: ugen.c,v 1.45 2000/12/13 04:05:14 augustss Exp $ */ +/* $OpenBSD: ugen.c,v 1.17 2001/10/31 04:24:44 nate Exp $ */ +/* $NetBSD: ugen.c,v 1.49 2001/10/24 22:31:04 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -174,6 +174,10 @@ USB_MATCH(ugen) { USB_MATCH_START(ugen, uaa); +#if 0 + if (uaa->matchlvl) + return (uaa->matchlvl); +#endif if (uaa->usegeneric) return (UMATCH_GENERIC); else @@ -517,7 +521,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) return (EWOULDBLOCK); } sce->state |= UGEN_ASLP; - DPRINTFN(5, ("ugenread: sleep on %p\n", sc)); + DPRINTFN(5, ("ugenread: sleep on %p\n", sce)); error = tsleep(sce, PZERO | PCATCH, "ugenri", 0); DPRINTFN(5, ("ugenread: woke, error=%d\n", error)); if (sc->sc_dying) @@ -581,7 +585,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) return (EWOULDBLOCK); } sce->state |= UGEN_ASLP; - DPRINTFN(5, ("ugenread: sleep on %p\n", sc)); + DPRINTFN(5, ("ugenread: sleep on %p\n", sce)); error = tsleep(sce, PZERO | PCATCH, "ugenri", 0); DPRINTFN(5, ("ugenread: woke, error=%d\n", error)); if (sc->sc_dying) @@ -823,6 +827,7 @@ ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr, struct isoreq *req = addr; struct ugen_endpoint *sce = req->sce; u_int32_t count, n; + int i, isize; /* Return if we are aborting. */ if (status == USBD_CANCELLED) @@ -841,15 +846,25 @@ ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr, count)); } - /* copy data to buffer */ - while (count > 0) { - n = min(count, sce->limit - sce->fill); - memcpy(sce->fill, req->dmabuf, n); + isize = UGETW(sce->edesc->wMaxPacketSize); + for (i = 0; i < UGEN_NISORFRMS; i++) { + u_int32_t actlen = req->sizes[i]; + char const *buf = (char const *)req->dmabuf + isize * i; + + /* copy data to buffer */ + while (actlen > 0) { + n = min(actlen, sce->limit - sce->fill); + memcpy(sce->fill, buf, n); + + buf += n; + actlen -= n; + sce->fill += n; + if(sce->fill == sce->limit) + sce->fill = sce->ibuf; + } - count -= n; - sce->fill += n; - if(sce->fill == sce->limit) - sce->fill = sce->ibuf; + /* setup size for next transfer */ + req->sizes[i] = isize; } usbd_setup_isoc_xfer(xfer, sce->pipeh, req, req->sizes, UGEN_NISORFRMS, |