Date: Mon, 17 Jul 2006 11:00:43 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 101746 for review Message-ID: <200607171100.k6HB0h5Y074038@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101746 Change 101746 by hselasky@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607171100.k6HB0h5Y074038>