PERFORCE change 120326 for review

Hans Petter Selasky hselasky at FreeBSD.org
Thu May 24 17:54:59 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=120326

Change 120326 by hselasky at hselasky_mini_itx on 2007/05/24 17:54:45

	Improve starting of isochronous transfers when the
	isochronous pipe is empty, hence some USB devices
	does not like when there is excess data per timeslot.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/ehci.c#30 edit
.. //depot/projects/usb/src/sys/dev/usb/ohci.c#24 edit
.. //depot/projects/usb/src/sys/dev/usb/uhci.c#25 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/ehci.c#30 (text+ko) ====

@@ -2534,9 +2534,14 @@
 	buf_offset = (nframes - xfer->pipe->isoc_next) & 
 	  (EHCI_VIRTUAL_FRAMELIST_COUNT-1);
 
-	if (buf_offset < xfer->nframes) {
-		/* not in use yet, schedule it a few frames ahead */
-		/* data underflow */
+	if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) ||
+	    (buf_offset < xfer->nframes))
+	{
+		/* If there is data underflow or the pipe queue is
+		 * empty we schedule the transfer a few frames ahead
+		 * of the current frame position. Else two
+		 * isochronous transfers might overlap.
+		 */
 		xfer->pipe->isoc_next = (nframes + 3) & 
 		  (EHCI_VIRTUAL_FRAMELIST_COUNT-1);
 		DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next));
@@ -2790,9 +2795,14 @@
 	buf_offset = (nframes - xfer->pipe->isoc_next) & 
 	  (EHCI_VIRTUAL_FRAMELIST_COUNT-1);
 
-	if (buf_offset < xfer->nframes) {
-		/* not in use yet, schedule it a few frames ahead */
-		/* data underflow */
+	if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) ||
+	    (buf_offset < xfer->nframes))
+	{
+		/* If there is data underflow or the pipe queue is
+		 * empty we schedule the transfer a few frames ahead
+		 * of the current frame position. Else two
+		 * isochronous transfers might overlap.
+		 */
 		xfer->pipe->isoc_next = (nframes + 3) & 
 		  (EHCI_VIRTUAL_FRAMELIST_COUNT-1);
 		DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next));

==== //depot/projects/usb/src/sys/dev/usb/ohci.c#24 (text+ko) ====

@@ -1946,16 +1946,15 @@
 	nframes = le32toh(hw_ptr->hcca.hcca_frame_number);
 	usbd_page_dma_enter(&(sc->sc_hw_page));
 
-	/* check if the frame index is within
-	 * the window where the frames will be
-	 * inserted and if the delay until start
-	 * is too long
-	 */
-	if ((((nframes - xfer->pipe->isoc_next) & 0xFFFF) < xfer->nframes) ||
+	if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) ||
+	    (((nframes - xfer->pipe->isoc_next) & 0xFFFF) < xfer->nframes) ||
 	    (((xfer->pipe->isoc_next - nframes) & 0xFFFF) >= 128))
 	{
-		/* not in use yet, schedule it a few frames ahead */
-		/* data underflow */
+		/* If there is data underflow or the pipe queue is
+		 * empty we schedule the transfer a few frames ahead
+		 * of the current frame position. Else two
+		 * isochronous transfers might overlap.
+		 */
 		xfer->pipe->isoc_next = (nframes + 3) & 0xFFFF;
 		DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next));
 	}

==== //depot/projects/usb/src/sys/dev/usb/uhci.c#25 (text+ko) ====

@@ -2048,9 +2048,14 @@
 	buf_offset = (nframes - xfer->pipe->isoc_next) & 
 	  (UHCI_VFRAMELIST_COUNT-1);
 
-	if (buf_offset < xfer->nframes) {
-		/* not in use yet, schedule it a few frames ahead */
-		/* data underflow */
+	if ((LIST_FIRST(&(xfer->pipe->list_head)) == NULL) ||
+	    (buf_offset < xfer->nframes))
+	{
+		/* If there is data underflow or the pipe queue is
+		 * empty we schedule the transfer a few frames ahead
+		 * of the current frame position. Else two
+		 * isochronous transfers might overlap.
+		 */
 		xfer->pipe->isoc_next = (nframes + 3) & (UHCI_VFRAMELIST_COUNT-1);
 		DPRINTFN(2,("start next=%d\n", xfer->pipe->isoc_next));
 	}


More information about the p4-projects mailing list