From 6e6a8073b33c9fdcb0dd99d052c53156b527e3c5 Mon Sep 17 00:00:00 2001
From: patacongo 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.
+
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.
+
-- cgit v1.2.3 |