PERFORCE change 101746 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Mon Jul 17 11:00:45 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=101746
Change 101746 by hselasky at hselasky_mini_itx on 2006/07/17 11:00:18
Allow the clear-stall routines to work with the
USBD_USE_DMA flag, which means that the USB transfer
does not have a virtual buffer, xfer->buffer, only the
DMA buffer.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#8 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#8 (text+ko) ====
@@ -1262,19 +1262,35 @@
usbd_clear_stall_tr_setup(struct usbd_xfer *xfer1,
struct usbd_xfer *xfer2)
{
- usb_device_request_t *req = xfer1->buffer;
+ usb_device_request_t req;
mtx_assert(xfer1->priv_mtx, MA_OWNED);
mtx_assert(xfer2->priv_mtx, MA_OWNED);
/* setup a clear-stall packet */
- req->bmRequestType = UT_WRITE_ENDPOINT;
- req->bRequest = UR_CLEAR_FEATURE;
- USETW(req->wValue, UF_ENDPOINT_HALT);
- req->wIndex[0] = xfer2->pipe->edesc->bEndpointAddress;
- req->wIndex[1] = 0;
- USETW(req->wLength, 0);
+ req.bmRequestType = UT_WRITE_ENDPOINT;
+ req.bRequest = UR_CLEAR_FEATURE;
+ USETW(req.wValue, UF_ENDPOINT_HALT);
+ req.wIndex[0] = xfer2->pipe->edesc->bEndpointAddress;
+ req.wIndex[1] = 0;
+ USETW(req.wLength, 0);
+
+ /* double check the length */
+
+ if (xfer1->length != sizeof(req)) {
+ printf("%s:%d: invalid transfer length, %d bytes!\n",
+ __FUNCTION__, __LINE__, xfer1->length);
+ return;
+ }
+
+ /* copy in the transfer */
+
+ if (xfer1->flags & USBD_USE_DMA) {
+ usbd_copy_in(&(xfer1->buf_data), 0, &req, sizeof(req));
+ } else {
+ bcopy(&req, xfer1->buffer, sizeof(req));
+ }
usbd_start_hardware(xfer1);
return;
More information about the p4-projects
mailing list