This commit rearranges the USBH functions into new groupings to provide a
clearer abstraction. This is in preparation for refactoring/removing the Hub
related functions in the USBH API. This commit DOES NOT MAKE ANY BEHAVIORAL
CHANGES to the code.
Functions are now grouped into...
- USBH Processing: Functions dealing with overall USBH processing
- Device Pool: Functions that add/remove/open/close devices from the internal
device pool
- Device: Functions that pertain to setting/getting a particular device
- Endpoints: Functions that pertain to a particular endpoint
- Transfer: Functions that pertain to sending transfers
Previously, on a device disconnection, the USBH and Hub would the require the
following 2-way interaction:
- Hub -> usbh_hub_pass_event() -> USBH to indicate a port error
- USBH -> usbh_hub_req_cb_t -> Hub to request port recovery after the device
has been freed.
The 2-way interaction has been simplified:
- USBH now nofities upper layers of devices being freed via the
USBH_EVENT_DEV_FREE event
- Hub now handles port recovery only after a device has been freed
This commit does the following:
- Updates the USBH event callback arguments to now pass a usbh_event_data_t
which can contain different data for each event
- Updated event names
This commit fixes a bug where if multiple concurrent USBH API calls trigger
multiple events on the same device, some events will be lost. As a result,
those lost events don't get processed by the subsequent usbh_process() call.
- user callback funciton to set device configuration
as a part of usb_host_install
- callback provides device descriptor of a device being enumerated
- user can set which cfg descriptor the USB device will be set with
- user can filter device enumeration
- Kconfig menu to enable callback function
- usb_host_lib example demonstration
- Renamed usb_otg_periph.h/c to usb_dwc_periph.h/c to match naming convention
of other DWC OTG related files
- Added compatibility header for usb_otg_periph.h
This commit renames USB PHY related HAL files from "usb_phy_xxx" to
"usb_fsls_phy_xxx" since they are only designed to support Full-Speed/Low-Speed
Serial USB PHYs. This renmaing is done to accommodate future USB PHYs that use
other PHY interfaces (e.g., UTMI, ULPI etc).
This commit removes internal event flags in the USB Host Library event handling
functions (i.e., usb_host_lib_handle_events() and usb_host_client_handle_events()).
Previously, these flags were added to reduce the number of times semaphores
were given. However, these flags were removed as the performance gain is
negligible and made the logic more complicated.
For usb_host_client_handle_events(), the following flags were removed:
- Remove 'events_pending' flag. The semaphore is now always given
- Remove 'blocked' flag. The 'handling_events' flag is already sufficient
- Critical sections are now shortened due to simplication of semaphore usage.
For usb_host_lib_handle_events(), the following flags were removed:
- Remove 'process_pending' flag. The semaphore is now always given
- Renamed 'blocked' flag to 'handling_events'
This commit removes the ability to reserve a header in the data buffer of an
allocated URB. The header was required for a now defunct implementation of a
synchronous USB Host library API. Thus, headers are no longer required in
URB data buffers.
Some devices return full LANGID table, even if short LANGID table was requested.
No memory overflow occurs, because we have allocated enough memory for transfers to the
default pipe. So we can ignore the error and continue with string desc fetching.
This commit adds a subset of the DWC OTG configuration values to the
'usb_dwc_ll.h' file. Only relevant configuration values have been added.
Some DWC OTG releated constants have also been moved from 'usb_dwc_hal.h'
to 'usb_dwc_ll.h' and renamed.
* All components which won't build (yet) on Linux are excluded.
This enables switching to Linux in an application without
explicitly setting COMPONENTS to main in the main
CMakeLists.txt.
* ESP Timer provides headers for Linux now
* automatically disabling LWIP in Kconfig if it is not available
doc(linux): brought section
"Component Linux/Mock Support Overview" up to date
Some component test apps do not use the "set(COMPONENTS main)" command in their
project level "CMakeLists.txt", thus leading to their builds pulling in all
ESP-IDF components.
This commit trims the build of multiple component test apps:
- Add "set(COMPONENTS main ...)" to project level "CMakeLists.txt"
- Add missing "PRIV_REQUIRES" in some "main" component "CMakeLists.txt"
Also removed repeated configuraiton options in legacy_i2c_driver/sdkconfig.ci.defaults
as they are already specified in legacy_i2c_driver/sdkconfig.defaults
This commit refactors the USBH and the USB Host Library in the following ways:
- USBH now presents an abstraction of an endpoint (via usbh_ep_handle_t)
- Added separate functions to enqueue/dequeue URBs to a particular endpoint
- USB Host Library no longer calls HCD API directly. Calls USBH endpoint API
instead.
- Renamed "notif_cb" to "proc_req_cb" (Processing Request Callback)
- This is to avoid confusion with FreerTOS task notifications and Host
Library client event notifications.
- The processing functions of each layer (i.e., "xxx_process()") request
calls via the "proc_req_cb"
- The main handling function (i.e., usb_host_lib_handle_events()) is
responsible for calling the required "xxx_process()" of each layer
When a USB does not support a particular string dsecriptor (e.g.,
manufacturer, product, and serial number), the string descriptors corresponding
index will be set to 0 in the device descriptor (e.g., iManufacturer, iProduct,
iString).
Previously, the Hub driver would always attempt to fetch the all three string
descriptors, thus leading an error in CHECK_SHORT_SER_STR_DESC if the device
did not support the descriptor.
This commit fixes the Hub drvier by skipping the enumeration stages of a
particular descriptor if its index is 0 (i.e., not supported by the device).
USB devices may support string descriptors in multiple languages. The supported
languages are stored in a LANGID table, which itself is a string descriptor at
index 0.
When fetching the LANGID table itself, the USB 2.0 specification does not
specify what LANGID to use, thus the Hub driver would use the default LANGID
"ENUM_LANGID". However, this would cause some devices to stall.
This commit fixes the issue by always requesting the LANGID table itself using
a LANGID of 0.
usb_host_transfer_submit_control() uses the incorrect bmRequestType direction
flag. Therefore, when doing a transfer check, all transfers were mistakenly
treated as OUT transfers (only affects transfer check and not actual transfer).