PERFORCE change 98775 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Jun 8 10:45:15 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=98775
Change 98775 by hselasky at hselasky_mini_itx on 2006/06/08 07:08:02
Added more information about the new USB API to the README file.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/README#2 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/README#2 (text+ko) ====
@@ -99,9 +99,122 @@
USB device driver examples:
/sys/dev/usb/ugen.c
+/sys/dev/usb/ulpt.c
+/sys/dev/usb/uhid.c
http://www.turbocat.net/~hselasky/isdn4bsd/sources/src/sys/i4b/layer1/ihfc2/i4b_regdata.h
http://www.turbocat.net/~hselasky/isdn4bsd/sources/src/sys/i4b/layer1/ihfc2/i4b_wibusb.h
---hselasky
+
+QUICK REFERENCE
+===============
+
+
+/*------------------------------------------------------------------------*
+ * usbd_status
+ * usbd_transfer_setup(udev, iface_index, pxfer, setup_start,
+ * n_setup, priv_sc, priv_mtx, priv_func)
+ *------------------------------------------------------------------------*/
+
+- "udev" is a pointer to "struct usbd_device"
+
+- "iface_index" is the interface index number
+
+- "pxfer" is a pointer to an array of USB transfer pointers that are
+ initialized to NULL, and then pointed to the allocated DMA-able USB
+ transfers
+
+- "setup_start" is a pointer to an array of USB config structures
+
+- "n_setup" is a number telling the USB system how many USB transfers
+ should be setup
+
+- "priv_sc" is the private softc pointer, which will be used to
+ initialize "xfer->priv_sc"
+
+- "priv_mtx" is the private mutex protecting the transfer structure and
+ the softc. This pointer is used to initialize "xfer->priv_mtx".
+
+- "priv_func" is a pointer to a function that is called back when the USB
+ system is finished using the "priv_mtx" mutex.
+
+/*------------------------------------------------------------------------*
+ * void
+ * usbd_transfer_unsetup(pxfer, n_setup)
+ *------------------------------------------------------------------------*/
+
+- "pxfer" is a pointer to an array of USB transfer pointers, that may
+ be NULL, that should be freed by the USB system.
+
+- "n_setup" is a number telling the USB system how many USB transfers
+ should be unsetup
+
+/*------------------------------------------------------------------------*
+ * void
+ * usbd_transfer_start(xfer)
+ *------------------------------------------------------------------------*/
+
+- "xfer" is pointer to a USB transfer that should be started
+
+NOTE: this function must be called with "priv_mtx" locked
+
+/*------------------------------------------------------------------------*
+ * void
+ * usbd_transfer_stop(xfer)
+ *------------------------------------------------------------------------*/
+
+- "xfer" is a pointer to a USB transfer that should be stopped
+
+NOTE: this function must be called with "priv_mtx" locked
+
+NOTE: if the transfer was in progress, the callback will called with
+ "xfer->error=USBD_CANCELLED", before this function returns
+
+/*------------------------------------------------------------------------*
+ * struct usbd_config {
+ * type, endpoint, direction, interval, timeout, frames, index
+ * flags, bufsize, callback
+ * };
+ *------------------------------------------------------------------------*/
+
+- The "type" field selects the USB pipe type. Valid values are:
+ UE_INTERRUPT, UE_CONTROL, UE_BULK, UE_ISOCHRONOUS. This field is
+ mandatory.
+
+- The "endpoint" field selects the USB endpoint number. A value of
+ 0xFF or "-1" will select the first matching endpoint. This field is
+ mandatory.
+
+- The "direction" field selects the USB endpoint direction. A value of 0xFF
+ or "-1" will select the first matching endpoint. Else valid values
+ are: "UE_DIR_IN" and "UE_DIR_OUT". This field is mandatory.
+
+- The "interval" field selects the interrupt interval, for "type" = UE_INTERRUPT.
+ The "interval" is given in milliseconds. "0" selects the default
+ interrupt interval.
+
+- The "timeout" field, if non-zero, will set the transfer timeout, in
+ milliseconds.
+
+- The "frames" field sets the number of isochronous frames, for
+ "type" = UE_ISOCHRONOUS.
+
+- The "index" field allows one to give a number, in case more
+ endpoints match the description, that selects which matching
+ "index" should be used.
+
+- The "flags" field allows one to set flags for the transfer. Valid flags are:
+ USBD_SYNCHRONOUS
+ USBD_FORCE_SHORT_XFER
+ USBD_SHORT_XFER_OK
+ USBD_CUSTOM_CLEARSTALL
+ USBD_USE_POLLING
+ USBD_SELF_DESTRUCT
+
+- The "bufsize" field sets the total pipe buffer size in bytes. This
+ field is mandatory.
+
+- The "callback" field sets the USB callback. This field is mandatory.
+
+--HPS
More information about the p4-projects
mailing list