Date: Sat, 8 Jul 2006 15:01:04 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 101022 for review Message-ID: <200607081501.k68F14Gd077208@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101022 Change 101022 by hselasky@hselasky_mini_itx on 2006/07/08 15:00:47 Added new flag "USBD_USE_DMA". Updated the documentation. Fixed some typos. USBD_USE_DMA: This flag will cause the USB host controller driver to not allocate a second data buffer, "xfer->buffer". Instead of transferring data using "xfer->buffer", data must be transferred by a call to "usbd_copy_in(&(xfer->buf_data), offset, src, len)" or "usbd_copy_out(&(xfer->buf_data), offset, dst, len)". This saves an extra data copy. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/README#5 edit .. //depot/projects/usb/src/sys/dev/usb/ugen.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#7 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/README#5 (text+ko) ==== @@ -37,7 +37,7 @@ One must setup the USB transfer, struct usbd_xfer, from the callback handler, which is required for non-blocking operation, in the end. -This behaviour is also very practical when writing USB device drivers, because +This behavior is also very practical when writing USB device drivers, because it is easy to make a loop, starting the next transfer from the previous. Simply reorder the labels! The callback's lock is locked by the caller. This solves synchronization problems related to stopping USB transfers. @@ -218,24 +218,56 @@ - The "flags" field allows one to set flags for the transfer. Valid flags are: USBD_SYNCHRONOUS + This flag can only be used with the default callback, + "usbd_default_callback()", and will cause the + "usbd_transfer_start()" function to sleep, exiting all + mutexes, until the transfer is finished. This flag is + depreciated. + USBD_FORCE_SHORT_XFER + This flag forces the last USB packet sent to be short. A short + packet has a length of less than "xfer->max_packet_size", which + derives from "wMaxPacketSize". + USBD_SHORT_XFER_OK + This flag allows the transfer length, "xfer->actlen" to be + less than "xfer->length", upon completion of a transfer. + USBD_CUSTOM_CLEARSTALL + USBD_USE_POLLING + This flag can be used with any callback and will cause the + "usbd_transfer_start()" function to wait, using "DELAY()", + without exiting any mutexes, until the transfer is finished or + has timed out. + USBD_SELF_DESTRUCT + This flag allows one to free a transfer from its + callback function. + + USBD_USE_DMA + This flag will cause the USB host controller driver to not + allocate a second data buffer, "xfer->buffer". Instead of + transferring data using "xfer->buffer", data must be + transferred by a call to "usbd_copy_in(&(xfer->buf_data), + offset, src, len)" or "usbd_copy_out(&(xfer->buf_data), + offset, dst, len)". This saves an extra data copy. + +- The "bufsize" field sets the total buffer size in bytes. If + this field is zero, "wMaxPacketSize" will be used, multiplied by the + "frames" field if the transfer type is isochronous. This is useful for + setting up interrupt pipes. 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. + NOTE: For control transfers "bufsize" includes + the length of the request structure. - The "callback" field sets the USB callback. This field is mandatory. MUTEX NOTE: =========== -When you create a mutex, using "mtx_init()", don't forget to call "mtx_destroy()" at detach, -else you can get freed memory accessed panics. +When you create a mutex, using "mtx_init()", don't forget to call +"mtx_destroy()" at detach, else you can get "freed memory accessed" +panics. --HPS - ==== //depot/projects/usb/src/sys/dev/usb/ugen.c#5 (text+ko) ==== @@ -1918,7 +1918,8 @@ if(usbd_do_request_flags (sc->sc_udev, &ur->ucr_request, data, - ur->ucr_flags, &ur->ucr_actlen, USBD_DEFAULT_TIMEOUT)) + (ur->ucr_flags & USBD_SHORT_XFER_OK), &ur->ucr_actlen, + USBD_DEFAULT_TIMEOUT)) { error = EIO; break; ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#7 (text+ko) ==== @@ -271,7 +271,8 @@ USBD_SHORT_XFER_OK| USBD_CUSTOM_CLEARSTALL| USBD_USE_POLLING| - USBD_SELF_DESTRUCT))) + USBD_SELF_DESTRUCT| + USBD_USE_DMA))) { error = USBD_BAD_FLAG; PRINTF(("invalid flag(s) specified: "
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607081501.k68F14Gd077208>