|
arduino-audio-tools
|
USBAudioHostBackend for the ESP-IDF usb_host library which is part of arduino-esp32 (ESP32-S2, ESP32-S3 and ESP32-P4). More...
#include <USBAudioHostBackendESP32.h>
Classes | |
| struct | Interface |
| struct | Stream |
Public Member Functions | |
| ~USBAudioHostBackendESP32 () | |
| bool | begin (USBAudioHostEvents *events, const USBAudioConfig &cfg) override |
| Start the host stack and register the event receiver. | |
| void | closeStream (uint8_t daddr, uint8_t ep_addr) override |
| Stop streaming the indicated endpoint. | |
| bool | control (uint8_t daddr, const UsbSetupPacket &setup, uint8_t *data) override |
| void | end () override |
| Stop all streams (the host stack itself keeps running). | |
| uint32_t | millis () const override |
| Milliseconds since start (for control request timeouts). | |
| bool | openStream (uint8_t daddr, const UsbEndpointDescriptorView &ep, UsbHostStreamRole role) override |
| bool | setInterface (uint8_t daddr, uint8_t itf, uint8_t alt) override |
| UsbSpeed | speed () const override |
| Bus speed of the attached device. | |
| void | task () override |
| Pump the host stack on platforms where the application drives it. | |
Static Public Attributes | |
| static constexpr int | kPacketsPerTransfer = 4 |
| Number of isochronous packets (1 ms at full speed) per transfer. | |
| static constexpr int | kTransfersInFlight = 2 |
| Number of transfers which are kept in flight per endpoint. | |
Protected Member Functions | |
| void | closeDevice () |
| Interface * | findInterface (uint8_t itf) |
| Stream * | findStream (uint8_t ep_addr) |
| Stream * | findStream (usb_transfer_t *xfer) |
| void | freeTransfers (Stream &s) |
| void | openDevice (uint8_t address) |
| bool | releaseInterface (Interface &itf) |
| void | submit (Stream &s, usb_transfer_t *xfer) |
Static Protected Member Functions | |
| static void | clientEvent (const usb_host_client_event_msg_t *msg, void *arg) |
| static void | controlComplete (usb_transfer_t *xfer) |
| static bool | installLibrary () |
| static void | isoComplete (usb_transfer_t *xfer) |
| static void | libraryTask (void *) |
Protected Attributes | |
| usb_host_client_handle_t | client_ = nullptr |
| uint8_t * | ctrl_data_ = nullptr |
| uint16_t | ctrl_len_ = 0 |
| usb_transfer_t * | ctrl_xfer_ = nullptr |
| uint8_t | daddr_ = 0 |
| usb_device_handle_t | dev_ = nullptr |
| USBAudioHostEvents * | events_ = nullptr |
| std::vector< Interface > | interfaces_ |
| std::vector< Stream > | streams_ |
Static Protected Attributes | |
| static constexpr size_t | kCtrlXferSize = 8 + 512 |
| static bool | s_library_installed_ = false |
| static TaskHandle_t | s_library_task_ = nullptr |
USBAudioHostBackend for the ESP-IDF usb_host library which is part of arduino-esp32 (ESP32-S2, ESP32-S3 and ESP32-P4).
begin() installs the USB host library (unless it was already installed, e.g. by another library) and starts a task which processes the library events. The client events and transfer completions are processed by task(), which is called continuously by the USB task of USBAudioHostESP32.
Isochronous endpoints are streamed with two transfers in flight, each covering kPacketsPerTransfer service intervals.
|
inline |
|
inlineoverridevirtual |
Start the host stack and register the event receiver.
Implements USBAudioHostBackend.
|
inlinestaticprotected |
|
inlineprotected |
|
inlineoverridevirtual |
Stop streaming the indicated endpoint.
Implements USBAudioHostBackend.
|
inlineoverridevirtual |
Asynchronous control request on EP0. For IN requests data receives up to setup.wLength bytes; for OUT requests it holds the payload. data must stay valid until onControlComplete().
Implements USBAudioHostBackend.
|
inlinestaticprotected |
|
inlineoverridevirtual |
Stop all streams (the host stack itself keeps running).
Implements USBAudioHostBackend.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlinestaticprotected |
Installs the USB host library and starts the task which handles its events
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlineoverridevirtual |
Milliseconds since start (for control request timeouts).
Implements USBAudioHostBackend.
|
inlineprotected |
Opens a newly enumerated device and provides its audio control interface to the class logic
|
inlineoverridevirtual |
Open an isochronous endpoint of the currently selected alternate setting and start streaming it in the indicated role.
Implements USBAudioHostBackend.
|
inlineprotected |
Releasing an interface requires that its endpoints are idle: when transfers are still being returned this fails and setInterface() is retried by the class logic.
|
inlineoverridevirtual |
Claims the interface with the alternate setting (which allocates its endpoints) and sends SET_INTERFACE.
Implements USBAudioHostBackend.
|
inlineoverridevirtual |
Bus speed of the attached device.
Reimplemented from USBAudioHostBackend.
|
inlineprotected |
|
inlineoverridevirtual |
Pump the host stack on platforms where the application drives it.
Implements USBAudioHostBackend.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |
|
staticconstexpr |
Number of isochronous packets (1 ms at full speed) per transfer.
|
staticconstexpr |
Number of transfers which are kept in flight per endpoint.
|
inlinestaticprotected |
|
inlinestaticprotected |
|
protected |