You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.7 KiB
ReStructuredText
90 lines
3.7 KiB
ReStructuredText
=============
|
|
USB Host Core
|
|
=============
|
|
|
|
USB Host Core is a part of the USB Host Stack library. It handles the hub
|
|
changes and issue necessary requests during USB Enumeration process, selects
|
|
and installs right class driver to bring up connected devices.
|
|
For more detailed description about Bus Enumeration, user can refer to
|
|
Chapter 9 (USB Host Framework) in Universal Serial Bus Specification.
|
|
|
|
The core stack driver is designed to simplify the enumeration of USB device.
|
|
After initialization, function drivers can be registered to make corresponding
|
|
USB functionalities to be recognizable. After start, the background interrupts
|
|
services handles the changes. When USB device is connected, the core
|
|
driver will check registered function drivers and enable the right driver(s) to
|
|
make the device usable. In this way, multiple registered function drivers can
|
|
drive any of the USB device that contains the driver function, or a composite
|
|
device that contains multiple compatible functions. Even there is no right
|
|
driver found, the device is still accessible so that user can easily customize
|
|
the operations.
|
|
|
|
To avoid dynamically allocation and minimize resources usage in the stack, a
|
|
shared control requests processing buffer is required for the stack. The size
|
|
of the buffer should be large enough for USB request plus VID and PID (if
|
|
supported by configuration) and plus max possible configuration descriptor
|
|
total length. The stack core driver use the buffer to process requests and
|
|
descriptors for enumeration. When the control resources are not used by core,
|
|
it's also possible to be used by user, in that case, the resources will be
|
|
taken by user request and released after the request end callback is invoked.
|
|
|
|
Features
|
|
--------
|
|
|
|
* Initialization/de-initialization
|
|
* Devices and functions drivers management
|
|
* Suspend/wakeup connected devices
|
|
* Callbacks management on:
|
|
|
|
* SOF event
|
|
* Connected device state change
|
|
* USB Host request handler
|
|
|
|
Simplified Usage Flow
|
|
---------------------
|
|
|
|
- Initialization: invoke usbhc_init(), with core driver instance, HAL driver
|
|
instance and allocated control buffer. The initialization code is
|
|
automatically generated by START.
|
|
- Register function drivers by invoking usbhc_register_funcd(). Note that even
|
|
there is no function driver for the connected USB device, it still is able to
|
|
be accessed through the core driver, thus allows user to customize the device
|
|
usage.
|
|
- Register callbacks to get notified when events happen
|
|
- Start USB host stack: invoke usbhc_start()
|
|
- Now the stack is running to monitor connection of USB device, status changes
|
|
are reported by callbacks, where user can check the status and raise the
|
|
flags for application to process.
|
|
|
|
For more detailed descriptions please refer to the APIs.
|
|
|
|
Practice in START
|
|
-----------------
|
|
|
|
When the component is added into project, a quick example is generated, in
|
|
usb_start.c. If the HAL driver and clocks are correctly configured, the example
|
|
enumerates the USB device connected to root hub port and read its device
|
|
descriptor. To practice you can invoke example routine in your main.c of
|
|
generated project, start debugging, connect your USB device and break, you will
|
|
find the device descriptor in shared control buffer.
|
|
|
|
Clock configurations:
|
|
|
|
- If the hardware supports high-speed and you want that, enable the 480MHz clock
|
|
and make that to be one of your hardware clock source
|
|
- If the hardware supports low-speed and full-speed and you want that, enable
|
|
the 48MHz(or 96MHz for some hardware) and make that to be one of your hardware
|
|
clock source
|
|
|
|
Dependencies
|
|
------------
|
|
|
|
* USB Host Driver
|
|
* USB Protocol Core
|
|
|
|
Limitations
|
|
-----------
|
|
|
|
Currently the driver just enumerates the first device connected to the root hub
|
|
port.
|