From eb27ffbed56c03cd2409375299e58dd43011a886 Mon Sep 17 00:00:00 2001
From: patacongo Last Updated: December 20, 2010 Last Updated: January 9, 2011
-
+
+
+
-
STATUS:
+ 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.
Nucleus2G LPC1768.
@@ -1296,7 +1326,8 @@
Olimex LPC1766-STK.
Support for that Olimex-LPC1766-STK board was added to NuttX 5.13.
The NuttX-5.14 release extended that support with an Ethernet driver.
- And the NuttX-5.15 release further extended the support with a functional USB driver and SPI-based micro-SD.
+ The NuttX-5.15 release further extended the support with a functional USB device driver and SPI-based micro-SD.
+ And the NuttX-5.16 release added a functional USB host driver.
Verified configurations are now available for the NuttX OS test,
for the NuttShell with networking and microSD support(NSH, see the NSH User Guide),
for the NuttX network test, for the THTTPD 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/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index e04000f786..03012038db 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -12,7 +12,7 @@
Last Updated: December 29, 2010 Last Updated: January 9, 2011
Initialization/setup:
@@ -2075,7 +2080,7 @@ extern void up_ledoff(int led);
Command/Status/Data Transfer:
-
+
+ Examples:
+
+
+ Examples:
+
+ USB Host Class Driver Registry.
+ The NuttX USB host infrastructure includes a registry.
+ During its initialization, each USB host class driver must call the interface,
+ Examples:
+
+ Detection and Enumeration of Connected Devices.
+ Each USB host device controller supports two methods that are used to detect and enumeration newly connected devices
+ (and also detect disconnected devices):
+
+
+
+ Wait for a device to be connected or disconnected.
+
+
+ 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.
+
@@ -387,7 +387,7 @@
NuttX RTOS
-
+
+
+
+ USB Host Support
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -540,7 +568,7 @@
@@ -1272,6 +1300,8 @@
@@ -120,6 +120,8 @@
6.3.5 Frame Buffer Drivers
NuttX RTOS Porting Guide
-
6.3.6 Memory Technology Device Drivers
6.3.7 SDIO Device Drivers
+ 6.3.8 USB Host-Side Drivers
+ 6.3.9 USB Device-Side Drivers
Appendix A: NuttX Configuration Settings
@@ -779,7 +781,10 @@ drivers/
| `-- (net driver source files)
|-- usbdev/
| |-- Make.defs
-| `-- (usbdev driver source files)
+| `-- (USB device driver source files)
+|-- usbhost/
+| |-- Make.defs
+| `-- (USB host driver source files)
`-- (common driver source files)
@@ -1944,7 +1949,7 @@ extern void up_ledoff(int led);
include/nuttx/fb.h
.
- 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.
struct fb_vtable_s
.
@@ -1994,7 +1999,7 @@ extern void up_ledoff(int led);
+include/nuttx/mtd.h
.
- 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.
struct mtd_dev_s
.
@@ -2057,11 +2062,11 @@ extern void up_ledoff(int led);
include/nuttx/sdio.h
.
- 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.
struct sdio_dev_s
.
- Each MTD device driver must implement an instance of struct sdio_dev_s
.
+ Each SDIOI device driver must implement an instance of struct sdio_dev_s
.
That structure defines a call table with the following methods:
void (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg);
int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, size_t nbytes);
@@ -2124,6 +2129,195 @@ extern void up_ledoff(int led);
6.3.8 USB Host-Side Drivers
+
+
+
include/nuttx/usb/usbhost.h
.
+ All structures and APIs needed to work with USB host-side drivers are provided in this header file.
+ struct usbhost_driver_s
.
+ Each USB host controller driver must implement an instance of struct usbhost_driver_s
.
+ This structure is defined in include/nuttx/usb/usbhost.h
.
+ arch/arm/src/lpc17xx/lpc17_usbhost.c
.
+ struct usbhost_class_s
.
+ Each USB host class driver must implement an instance of struct usbhost_class_s
.
+ This structure is also defined in include/nuttx/usb/usbhost.h
.
+ drivers/usbhost/usbhost_storage.c
+ usbhost_registerclass()
+ 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.
+ drivers/usbhost/usbhost_registry.c
, drivers/usbhost/usbhost_registerclass.c
, and drivers/usbhost/usbhost_findclass.c
,
+
+
+ int (*wait)(FAR struct usbhost_driver_s *drvr, bool connected);
+ int (*enumerate)(FAR struct usbhost_driver_s *drvr);
+
+ Binding USB Host-Side Drivers.
+ 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 (drivers/usbhost/usbhost_storage.c
) will register a standard, NuttX block driver interface (like /dev/sda
)
+ that can be used to mount a file system just as with any other other block driver instance.
+ In general, the binding sequence is:
+
+
+ Each USB host class driver includes an intialization entry point that is called from the
+ application at initialization time.
+ This driver calls usbhost_registerclass()
during this initialization in order to makes itself available in the event the the device that it supports is connected.
+
+ Examples:
+ The function usbhost_storageinit()
in the file drivers/usbhost/usbhost_storage.c
+
+ Each application must include a waiter thread thread that (1) calls the USB host controller driver's wait()
to detect the connection of a device, and then
+ (2) call the USB host controller driver's enumerate
method to bind the registered USB host class driver to the USB host controller driver.
+
+ Examples:
+ The function nsh_waiter()
in the file configs/nucleus2g/src/up_nsh.c
and
+ the function nsh_waiter()
in the file configs/olimex-lpc1766stk/src/up_nsh.c
.
+
+ 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 /dev
directory.
+ To repeat the above example, the USB host mass storage class driver (drivers/usbhost/usbhost_storage.c
) will register a standard, NuttX block driver interface (like /dev/sda
)
+ that can be used to mount a file system just as with any other other block driver instance.
+
+ Examples:
+ See the call to register_blockdriver()
in the function usbhost_initvolume()
in the file drivers/usbhost/usbhost_storage.c
.
+
include/nuttx/usb/usbdev.h
.
+ All structures and APIs needed to work with USB device-side drivers are provided in this header file.
+
+ struct usbdev_s
.
+ Each USB device controller driver must implement an instance of struct usbdev_s
.
+ This structure is defined in include/nuttx/usb/usbdev.h
.
+
+ Examples:
+ arch/arm/src/dm320/dm320_usbdev.c
, arch/arm/src/lpc17xx/lpc17_usbdev.c
,
+ arch/arm/src/lpc214x/lpc214x_usbdev.c
, arch/arm/src/lpc313x/lpc313x_usbdev.c
, and
+ arch/arm/src/stm32/stm32_usbdev.c
.
+
+ struct usbdevclass_driver_s
.
+ Each USB device class driver must implement an instance of struct usbdevclass_driver_s
.
+ This structure is also defined in include/nuttx/usb/usbdev.h
.
+
+ Examples:
+ drivers/usbdev/usbdev_serial.c
and drivers/usbdev/usbdev_storage.c
+
+ Binding USB Device-Side Drivers. + 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: +
++
+ Each USB device class driver includes an intialization entry point that is called from the + application at initialization time. +
+
+ Examples:
+ The function usbdev_serialinitialize()
in the file drivers/usbdev/usbdev_serial.c
and
+ the function in the file
drivers/usbdev/usbdev_storage.c
+
+ These initialization functions called the driver API, usbdev_register()
.
+ This driver function will bind the USB class driver to the USB device controller driver,
+ completing the initialization.
+