Date: Mon, 12 Jun 2006 07:48:00 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 99040 for review Message-ID: <200606120748.k5C7m0RN029656@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99040 Change 99040 by hselasky@hselasky_mini_itx on 2006/06/12 07:47:19 New feature: If bufsize == 0, use wMaxPacketSize instead when configuring USB transfers. This is useful for setting up interrupt transfers. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/README#3 edit .. //depot/projects/usb/src/sys/dev/usb/ehci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/ohci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/uhci.c#4 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#4 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/README#3 (text+ko) ==== @@ -211,8 +211,10 @@ USBD_USE_POLLING USBD_SELF_DESTRUCT -- The "bufsize" field sets the total pipe buffer size in bytes. This - field is mandatory. +- The "bufsize" field sets the total pipe buffer size in bytes. If + this field is zero, "wMaxPacketSize" will be used. This is useful for + setting up interrupt pipes. For control transfers "bufsize" includes the + length of the request structure. This field is mandatory. - The "callback" field sets the USB callback. This field is mandatory. ==== //depot/projects/usb/src/sys/dev/usb/ehci.c#4 (text+ko) ==== @@ -3417,7 +3417,6 @@ xfer->usb_mtx = &sc->sc_bus.mtx; xfer->usb_root = info; xfer->flags = setup->flags; - xfer->length = setup->bufsize; xfer->nframes = setup->frames; xfer->timeout = setup->timeout; xfer->callback = setup->callback; @@ -3453,6 +3452,12 @@ xfer->endpoint = xfer->pipe->edesc->bEndpointAddress; xfer->max_packet_size = UGETW(xfer->pipe->edesc->wMaxPacketSize); + xfer->length = setup->bufsize; + + if (xfer->length == 0) { + xfer->length = xfer->max_packet_size; + } + /* wMaxPacketSize is validated by "usbd_fill_iface_data()" */ /* @@ -3544,7 +3549,7 @@ xfer->physbuffer = (physbuffer + size); } - size += setup->bufsize; + size += xfer->length; /* memory is allocated at * highest alignment ==== //depot/projects/usb/src/sys/dev/usb/ohci.c#4 (text+ko) ==== @@ -2421,7 +2421,6 @@ xfer->usb_mtx = &sc->sc_bus.mtx; xfer->usb_root = info; xfer->flags = setup->flags; - xfer->length = setup->bufsize; xfer->nframes = setup->frames; xfer->timeout = setup->timeout; xfer->callback = setup->callback; @@ -2476,6 +2475,12 @@ xfer->endpoint = xfer->pipe->edesc->bEndpointAddress; xfer->max_packet_size = UGETW(xfer->pipe->edesc->wMaxPacketSize); + xfer->length = setup->bufsize; + + if (xfer->length == 0) { + xfer->length = xfer->max_packet_size; + } + /* wMaxPacketSize is validated by "usbd_fill_iface_data()" */ /* @@ -2492,7 +2497,7 @@ } else if(xfer->pipe->methods == &ohci_device_isoc_methods) { - nitd = (setup->bufsize / OHCI_PAGE_SIZE) + + nitd = (xfer->length / OHCI_PAGE_SIZE) + (max_frames / OHCI_ITD_NOFFSET) + 1 /* EXTRA */; ntd = 0; } @@ -2536,7 +2541,7 @@ xfer->physbuffer = (physbuffer + size); } - size += setup->bufsize; + size += xfer->length; size += ((-size) & (OHCI_ITD_ALIGN-1)); /* align data */ ==== //depot/projects/usb/src/sys/dev/usb/uhci.c#4 (text+ko) ==== @@ -2711,7 +2711,6 @@ xfer->usb_mtx = &sc->sc_bus.mtx; xfer->usb_root = info; xfer->flags = setup->flags; - xfer->length = setup->bufsize; xfer->nframes = setup->frames; xfer->timeout = setup->timeout; xfer->callback = setup->callback; @@ -2747,6 +2746,12 @@ xfer->endpoint = xfer->pipe->edesc->bEndpointAddress; xfer->max_packet_size = UGETW(xfer->pipe->edesc->wMaxPacketSize); + xfer->length = setup->bufsize; + + if (xfer->length == 0) { + xfer->length = xfer->max_packet_size; + } + /* wMaxPacketSize is validated by "usbd_fill_iface_data()" */ /* @@ -2806,7 +2811,7 @@ xfer->physbuffer = (physbuffer + size); } - size += setup->bufsize; + size += xfer->length; size += ((-size) & (UHCI_TD_ALIGN-1)); /* align data */ ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#4 (text+ko) ==== @@ -251,8 +251,7 @@ for(setup = setup_start, n = n_setup; n--; setup++) { - if((setup->bufsize == 0) || - (setup->bufsize == 0xffffffff)) + if(setup->bufsize == 0xffffffff) { error = USBD_BAD_BUFSIZE; PRINTF(("invalid bufsize\n"));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606120748.k5C7m0RN029656>