Subject: Re: uhci & ugen & isochronous transfer
To: None <tech-kern@netbsd.org>
From: YAMAMOTO Takashi <yamt@netbsd.org>
List: tech-kern
Date: 09/16/2001 23:04:58
I made a patch to make ugen use updated frlengths.
is this ok to commit?
---
YAMAMOTO Takashi<yamt@netbsd.org>
Index: ugen.c
===================================================================
RCS file: /cvs/cvsroot/syssrc/sys/dev/usb/ugen.c,v
retrieving revision 1.45
diff -u -r1.45 ugen.c
--- ugen.c 2000/12/13 04:05:14 1.45
+++ ugen.c 2001/09/16 13:55:16
@@ -822,6 +822,7 @@
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)
@@ -840,15 +841,25 @@
count));
}
- /* copy data to buffer */
- while (count > 0) {
- n = min(count, sce->limit - sce->fill);
- memcpy(sce->fill, req->dmabuf, n);
-
- count -= n;
- sce->fill += n;
- if(sce->fill == sce->limit)
- sce->fill = sce->ibuf;
+ 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;
+ }
+
+ /* setup size for next transfer */
+ req->sizes[i] = isize;
}
usbd_setup_isoc_xfer(xfer, sce->pipeh, req, req->sizes, UGEN_NISORFRMS,