From owner-p4-projects@FreeBSD.ORG Sat Jul 8 15:01:06 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1834316A4E5; Sat, 8 Jul 2006 15:01:06 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D078A16A4DA for ; Sat, 8 Jul 2006 15:01:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2638E43D55 for ; Sat, 8 Jul 2006 15:01:05 +0000 (GMT) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k68F15Zm077214 for ; Sat, 8 Jul 2006 15:01:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k68F14Gd077208 for perforce@freebsd.org; Sat, 8 Jul 2006 15:01:04 GMT (envelope-from hselasky@FreeBSD.org) Date: Sat, 8 Jul 2006 15:01:04 GMT Message-Id: <200607081501.k68F14Gd077208@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 101022 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jul 2006 15:01:06 -0000 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: "