diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-01-09 17:26:41 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-01-09 17:26:41 +0000 |
commit | 6e6a8073b33c9fdcb0dd99d052c53156b527e3c5 (patch) | |
tree | 58ee9ebbe91195a0c9afe6e626055b28a1c26aa8 | |
parent | 29c706c9e17447ef58198c36168457c37a00ff4e (diff) | |
download | nuttx-6e6a8073b33c9fdcb0dd99d052c53156b527e3c5.tar.gz nuttx-6e6a8073b33c9fdcb0dd99d052c53156b527e3c5.tar.bz2 nuttx-6e6a8073b33c9fdcb0dd99d052c53156b527e3c5.zip |
Add USB host documentation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3237 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/ChangeLog | 8 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 47 | ||||
-rw-r--r-- | nuttx/Documentation/NuttxPortingGuide.html | 208 |
3 files changed, 246 insertions, 17 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index e0133196c..d6a03b732 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1411,8 +1411,10 @@ files to this new directory. Created a skeleton for a new USB host header file * drivers/usbhost -- Add USB host "registry" where connect devices can be - matched with the correct USB class driver. Add a USB host class driver - for the (Bulk-Only) USB Mass Storage Class. Untested on initial check-iin + matched with the correct USB class driver. * arc/arc/src/lpc17xx/lpc17_usbhost.c -- Add a simple USB host driver for - the NXP lpc17xx. Untested on initial check-in. + the NXP lpc17xx. + * drivers/usbhost -- Add generic USB device enumeration logic. + * drivers/usbhost -- Add a USB host class driver for the (Bulk-Only) USB + Mass Storage Class. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index d34ce8bba..34bdedec5 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: December 20, 2010</p> + <p>Last Updated: January 9, 2011</p> </td> </tr> </table> @@ -387,7 +387,7 @@ <td><br></td> <td> <p> - <li>Network, USB (device), serial, CAN, driver architecture.</li> + <li>Network, USB (host), USB (device), serial, CAN, driver architectures.</li> </p> </tr> @@ -526,6 +526,34 @@ <tr> <td valign="top" width="22"><img height="20" width="20" src="favicon.ico"></td> <td bgcolor="#5eaee1"> + <b>USB Host Support</b> + </td> +</tr> +<tr> + <td><br></td> + <td> + <p> + <li>USB host architecture for USB host controller drivers and device-dependent USB class drivers.</li> + </p> +</tr> +<tr> + <td><br></td> + <td> + <p> + <li>USB host controller drivers available for the NXP LPC17xx.</li> + </p> +</tr> +<tr> + <td><br></td> + <td> + <p> + <li>Device-dependent USB class drivers available for USB mass storage.</li> + </p> +</tr> + +<tr> + <td valign="top" width="22"><img height="20" width="20" src="favicon.ico"></td> + <td bgcolor="#5eaee1"> <b>USB Device Support</b> </td> </tr> @@ -540,7 +568,7 @@ <td><br></td> <td> <p> - <li>USB device controller drivers available for the NXP LPC214x, LPC313x, STMicro STM32 and TI DM320.</li> + <li>USB device controller drivers available for the NXP LPC17xx, LPC214x, LPC313x, STMicro STM32 and TI DM320.</li> </p> </tr> <tr> @@ -1272,6 +1300,8 @@ <ul> <p> <b>STATUS:</b> + The following summarizes the features that has been developed and verified on individual LPC17xx-based boards. + These features should, however, be common and available for all LPC17xx-based boards. </p> <p> <b>Nucleus2G LPC1768</b>. @@ -1296,7 +1326,8 @@ <b>Olimex LPC1766-STK</b>. Support for that Olimex-LPC1766-STK board was added to NuttX 5.13. The NuttX-5.14 release extended that support with an <i>Ethernet driver</i>. - And the NuttX-5.15 release further extended the support with a functional <i>USB driver</i> and <i>SPI-based micro-SD</i>. + The NuttX-5.15 release further extended the support with a functional <i>USB device driver</i> and <i>SPI-based micro-SD</i>. + And the NuttX-5.16 release added a functional <i>USB host driver</i>. Verified configurations are now available for the NuttX OS test, for the NuttShell with networking and microSD support(NSH, see the <a href="ttp://www.nuttx.org/NuttShell.html">NSH User Guide</a>), for the NuttX network test, for the <a href="http://acme.com/software/thttpd">THTTPD</a> webserver, @@ -2017,10 +2048,12 @@ nuttx-5.16 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> files to this new directory. Created a skeleton for a new USB host header file * drivers/usbhost -- Add USB host "registry" where connect devices can be - matched with the correct USB class driver. Add a USB host class driver - for the (Bulk-Only) USB Mass Storage Class. Untested on initial check-iin + matched with the correct USB class driver. * arc/arc/src/lpc17xx/lpc17_usbhost.c -- Add a simple USB host driver for - the NXP lpc17xx. Untested on initial check-in. + the NXP lpc17xx. + * drivers/usbhost -- Add generic USB device enumeration logic. + * drivers/usbhost -- Add a USB host class driver for the (Bulk-Only) USB + Mass Storage Class. pascal-2.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index e04000f78..03012038d 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@ <h1><big><font color="#3c34ec"> <i>NuttX RTOS Porting Guide</i> </font></big></h1> - <p>Last Updated: December 29, 2010</p> + <p>Last Updated: January 9, 2011</p> </td> </tr> </table> @@ -120,6 +120,8 @@ <a href="#fbdrivers">6.3.5 Frame Buffer Drivers</a><br> <a href="#mtddrivers">6.3.6 Memory Technology Device Drivers</a><br> <a href="#sdiodrivers">6.3.7 SDIO Device Drivers</a><br> + <a href="#usbhostdrivers">6.3.8 USB Host-Side Drivers</a><br> + <a href="#usbdevdrivers">6.3.9 USB Device-Side Drivers</a><br> </ul> </ul> <a href="#apndxconfigs">Appendix A: NuttX Configuration Settings</a><br> @@ -779,7 +781,10 @@ drivers/ | `-- <i>(net driver source files)</i> |-- usbdev/ | |-- Make.defs -| `-- <i>(usbdev driver source files)</i> +| `-- <i>(USB device driver source files)</i> +|-- usbhost/ +| |-- Make.defs +| `-- <i>(USB host driver source files)</i> `-- <i>(common driver source files)</i> </pre></ul> @@ -1944,7 +1949,7 @@ extern void up_ledoff(int led); <ul> <li> <b><code>include/nuttx/fb.h</code></b>. - All structures and APIs needed to work with serial drivers are provided in this header file. + All structures and APIs needed to work with frame buffer drivers are provided in this header file. </li> <li> <b><code>struct fb_vtable_s</code></b>. @@ -1994,7 +1999,7 @@ extern void up_ledoff(int led); <ul> <li> <b><code>include/nuttx/mtd.h</code></b>. - All structures and APIs needed to work with serial drivers are provided in this header file. + All structures and APIs needed to work with MTD drivers are provided in this header file. </li> <li> <b><code>struct mtd_dev_s</code></b>. @@ -2057,11 +2062,11 @@ extern void up_ledoff(int led); <ul> <li> <b><code>include/nuttx/sdio.h</code></b>. - All structures and APIs needed to work with serial drivers are provided in this header file. + All structures and APIs needed to work with SDIO drivers are provided in this header file. </li> <li> <b><code>struct sdio_dev_s</code></b>. - Each MTD device driver must implement an instance of <code>struct sdio_dev_s</code>. + Each SDIOI device driver must implement an instance of <code>struct sdio_dev_s</code>. That structure defines a call table with the following methods: <p> Initialization/setup: @@ -2075,7 +2080,7 @@ extern void up_ledoff(int led); </ul> <p> Command/Status/Data Transfer: - </p? + </p> <ul> <p><code>void (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg);</code><br> <code>int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, size_t nbytes);</code><br> @@ -2124,6 +2129,195 @@ extern void up_ledoff(int led); </li> </ul> +<h3><a name="usbhostdrivers">6.3.8 USB Host-Side Drivers</a></h3> + +<ul> + <li> + <b><code>include/nuttx/usb/usbhost.h</code></b>. + All structures and APIs needed to work with USB host-side drivers are provided in this header file. + </li> + <li> + <p> + <b><code>struct usbhost_driver_s</code></b>. + Each USB host controller driver must implement an instance of <code>struct usbhost_driver_s</code>. + This structure is defined in <code>include/nuttx/usb/usbhost.h</code>. + </p> + <p> + <b>Examples</b>: + <code>arch/arm/src/lpc17xx/lpc17_usbhost.c</code>. + </p> + </li> + <li> + <p> + <b><code>struct usbhost_class_s</code></b>. + Each USB host class driver must implement an instance of <code>struct usbhost_class_s</code>. + This structure is also defined in <code>include/nuttx/usb/usbhost.h</code>. + </p> + <p> + <b>Examples</b>: + <code>drivers/usbhost/usbhost_storage.c</code> + </p> + </li> + <li> + <p> + <b>USB Host Class Driver Registry</b>. + The NuttX USB host infrastructure includes a <i>registry</i>. + During its initialization, each USB host class driver must call the interface, <code>usbhost_registerclass()</code> + in order add its interface to the register. + Later, when a USB device is connected, the USB host controller will look up the USB host class driver that is needed to support the connected device in this registry. + </p> + <p> + <b>Examples</b>: + <code>drivers/usbhost/usbhost_registry.c</code>, <code>drivers/usbhost/usbhost_registerclass.c</code>, and <code>drivers/usbhost/usbhost_findclass.c</code>, + </p> + </li> + <li> + <p> + <b>Detection and Enumeration of Connected Devices</b>. + Each USB host device controller supports two methods that are used to detect and enumeration newly connected devices + (and also detect disconnected devices): + </p> + <p> + <ul> + <li> + <p> + <code>int (*wait)(FAR struct usbhost_driver_s *drvr, bool connected);</code> + </p> + <p> + Wait for a device to be connected or disconnected. + </p> + </li> + <li> + <p> + <code>int (*enumerate)(FAR struct usbhost_driver_s *drvr);</code> + </p> + <p> + Enumerate the connected device. + As part of this enumeration process, the driver will + (1) get the device's configuration descriptor, + (2) extract the class ID info from the configuration descriptor, + (3) call usbhost_findclass() to find the class that supports this device, + (4) call the create() method on the struct usbhost_registry_s interface to get a class instance, and + finally (5) call the connect() method of the struct usbhost_class_s interface. + After that, the class is in charge of the sequence of operations. + </p> + </ul> + </p> + </li> + <li> + <p> + <b>Binding USB Host-Side Drivers</b>. + USB host-side controller drivers are not normally directly accessed by user code, + but are usually bound to another, higher level USB host class driver. + The class driver exports the standard NuttX device interface so that the connected USB device can be accessed just as with other, similar, on-board devices. + For example, the USB host mass storage class driver (<code>drivers/usbhost/usbhost_storage.c</code>) will register a standard, NuttX block driver interface (like <code>/dev/sda</code>) + that can be used to mount a file system just as with any other other block driver instance. + In general, the binding sequence is: + </p> + <p> + <ul> + <li> + <p> + Each USB host class driver includes an intialization entry point that is called from the + application at initialization time. + This driver calls <code>usbhost_registerclass()</code> during this initialization in order to makes itself available in the event the the device that it supports is connected. + </p> + <p> + <b>Examples</b>: + The function <code>usbhost_storageinit()</code> in the file <code>drivers/usbhost/usbhost_storage.c</code> + </p> + </li> + <li> + <p> + Each application must include a <i>waiter</i> thread thread that (1) calls the USB host controller driver's <code>wait()</code> to detect the connection of a device, and then + (2) call the USB host controller driver's <code>enumerate</code> method to bind the registered USB host class driver to the USB host controller driver. + </p> + <p> + <b>Examples</b>: + The function <code>nsh_waiter()</code> in the file <code>configs/nucleus2g/src/up_nsh.c</code> and + the function <code>nsh_waiter()</code> in the file <code>configs/olimex-lpc1766stk/src/up_nsh.c</code>. + </p> + </li> + <li> + <p> + As part of its operation during the binding operation, the USB host class driver will register an instances of a standard NuttX driver under the <code>/dev</code> directory. + To repeat the above example, the USB host mass storage class driver (<code>drivers/usbhost/usbhost_storage.c</code>) will register a standard, NuttX block driver interface (like <code>/dev/sda</code>) + that can be used to mount a file system just as with any other other block driver instance. + </p> + <p> + <b>Examples</b>: + See the call to <code>register_blockdriver()</code> in the function <code>usbhost_initvolume()</code> in the file <code>drivers/usbhost/usbhost_storage.c</code>. + </p> + </li> + </ul> + </p> + </li> +</ul> + +<h3><a name="usbdevdrivers">6.3.9 USB Device-Side Drivers</a></h3> + +<ul> + <li> + <b><code>include/nuttx/usb/usbdev.h</code></b>. + All structures and APIs needed to work with USB device-side drivers are provided in this header file. + </li> + <li> + <p> + <b><code>struct usbdev_s</code></b>. + Each USB device controller driver must implement an instance of <code>struct usbdev_s</code>. + This structure is defined in <code>include/nuttx/usb/usbdev.h</code>. + </p> + <p> + <b>Examples</b>: + <code>arch/arm/src/dm320/dm320_usbdev.c</code>, <code>arch/arm/src/lpc17xx/lpc17_usbdev.c</code>, + <code>arch/arm/src/lpc214x/lpc214x_usbdev.c</code>, <code>arch/arm/src/lpc313x/lpc313x_usbdev.c</code>, and + <code>arch/arm/src/stm32/stm32_usbdev.c</code>. + </p> + </li> + <li> + <p> + <b><code>struct usbdevclass_driver_s</code></b>. + Each USB device class driver must implement an instance of <code>struct usbdevclass_driver_s</code>. + This structure is also defined in <code>include/nuttx/usb/usbdev.h</code>. + </p> + <p> + <b>Examples</b>: + <code>drivers/usbdev/usbdev_serial.c</code> and <code>drivers/usbdev/usbdev_storage.c</code> + </p> + </li> + <li> + <p> + <b>Binding USB Device-Side Drivers</b>. + USB device-side controller drivers are not normally directly accessed by user code, + but are usually bound to another, higher level USB device class driver. + The class driver is then configured to export the USB device functionality. + In general, the binding sequence is: + </p> + <p> + <ul> + <li> + <p> + Each USB device class driver includes an intialization entry point that is called from the + application at initialization time. + </p> + <p> + <b>Examples</b>: + The function <code>usbdev_serialinitialize()</code> in the file <code>drivers/usbdev/usbdev_serial.c</code> and + the function <code></code> in the file <code>drivers/usbdev/usbdev_storage.c</code> + </p> + </li> + <li> + <p> + These initialization functions called the driver API, <code>usbdev_register()</code>. + This driver function will <i>bind</i> the USB class driver to the USB device controller driver, + completing the initialization. + </p> + </li> + </ul> + </p> + </li> +</ul> + <table width ="100%"> <tr bgcolor="#e4e4e4"> <td> |