diff options
author | julian <julian@FreeBSD.org> | 2004-12-14 03:59:24 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2004-12-14 03:59:24 +0000 |
commit | 8c6056312770d87384430a2b5bbc133601af41cd (patch) | |
tree | c08ad28ac7a3c62cdc6cccaf24af19a20df3ee5e /sys/dev/usb | |
parent | 6846f0b8571e8d7053a01a81826e77d1af18d26e (diff) | |
download | FreeBSD-src-8c6056312770d87384430a2b5bbc133601af41cd.zip FreeBSD-src-8c6056312770d87384430a2b5bbc133601af41cd.tar.gz |
Slightly reorganise part of the ohci_softintr() function
to better keep track of the total amoutn transferred during a
transfer. Seems similar to some code in the NetBSD version.
I notice they have incorporated matches from him so I don't know which
direction it went.
Submitted by: damien.bergamini@free.fr
Obtained from: patches to make the ueagle driver work
MFC after: 1 week
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/ohci.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 47bdd55..575bafb 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1362,7 +1362,8 @@ ohci_softintr(void *v) usbd_xfer_handle xfer; struct ohci_pipe *opipe; int len, cc, s; - + int i, j, iframes; + DPRINTFN(10,("ohci_softintr: enter\n")); sc->sc_bus.intr_context++; @@ -1504,21 +1505,31 @@ ohci_softintr(void *v) if (opipe->aborting) continue; - cc = OHCI_ITD_GET_CC(le32toh(sitd->itd.itd_flags)); - if (cc == OHCI_CC_NO_ERROR) { - /* XXX compute length for input */ - if (sitd->flags & OHCI_CALL_DONE) { - opipe->u.iso.inuse -= xfer->nframes; - /* XXX update frlengths with actual length */ - /* XXX xfer->actlen = actlen; */ - xfer->status = USBD_NORMAL_COMPLETION; - s = splusb(); - usb_transfer_complete(xfer); - splx(s); + if (sitd->flags & OHCI_CALL_DONE) { + ohci_soft_itd_t *next; + + opipe->u.iso.inuse -= xfer->nframes; + xfer->status = USBD_NORMAL_COMPLETION; + for (i = 0, sitd = xfer->hcpriv;;sitd = next) { + next = sitd->nextitd; + if (OHCI_ITD_GET_CC(sitd->itd.itd_flags) != OHCI_CC_NO_ERROR) + xfer->status = USBD_IOERROR; + + if (xfer->status == USBD_NORMAL_COMPLETION) { + iframes = OHCI_ITD_GET_FC(sitd->itd.itd_flags); + for (j = 0; j < iframes; i++, j++) { + len = le16toh(sitd->itd.itd_offset[j]); + len = + (OHCI_ITD_PSW_GET_CC(len) == + OHCI_CC_NOT_ACCESSED) ? 0 : + OHCI_ITD_PSW_LENGTH(len); + xfer->frlengths[i] = len; + } + } + if (sitd->flags & OHCI_CALL_DONE) + break; } - } else { - /* XXX Do more */ - xfer->status = USBD_IOERROR; + s = splusb(); usb_transfer_complete(xfer); splx(s); |