arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | List of all members
USBAudioHostBackend Class Referenceabstract

Abstract seam for every raw USB host stack call the UAC host class logic (USBAudioHostBase) needs. Concrete subclasses wrap TinyUSB host (USBAudioHostBackendTinyUSB) or the ESP-IDF usb_host library (USBAudioHostBackendESP32). More...

#include <USBAudioHostBackend.h>

Inheritance diagram for USBAudioHostBackend:
USBAudioHostBackendESP32 USBAudioHostBackendTinyUSB

Public Member Functions

virtual ~USBAudioHostBackend ()=default
 
virtual bool begin (USBAudioHostEvents *events, const USBAudioConfig &cfg)=0
 Start the host stack and register the event receiver.
 
virtual void closeStream (uint8_t daddr, uint8_t ep_addr)=0
 Stop streaming the indicated endpoint.
 
virtual bool control (uint8_t daddr, const UsbSetupPacket &setup, uint8_t *data)=0
 
virtual void end ()=0
 Stop all streams (the host stack itself keeps running).
 
virtual uint32_t millis () const =0
 Milliseconds since start (for control request timeouts).
 
virtual bool openStream (uint8_t daddr, const UsbEndpointDescriptorView &ep, UsbHostStreamRole role)=0
 
virtual bool setInterface (uint8_t daddr, uint8_t itf, uint8_t alt)=0
 
virtual UsbSpeed speed () const
 Bus speed of the attached device.
 
virtual void task ()=0
 Pump the host stack on platforms where the application drives it.
 

Detailed Description

Abstract seam for every raw USB host stack call the UAC host class logic (USBAudioHostBase) needs. Concrete subclasses wrap TinyUSB host (USBAudioHostBackendTinyUSB) or the ESP-IDF usb_host library (USBAudioHostBackendESP32).

Control requests are asynchronous: the result is reported via USBAudioHostEvents::onControlComplete(), which may also be called before control()/setInterface() returns. Only one control request is in flight at any time. Streaming endpoints are kept running by the backend itself (resubmitting transfers) once openStream() was called.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ ~USBAudioHostBackend()

virtual ~USBAudioHostBackend ( )
virtualdefault

Member Function Documentation

◆ begin()

virtual bool begin ( USBAudioHostEvents *  events,
const USBAudioConfig &  cfg 
)
pure virtual

Start the host stack and register the event receiver.

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ closeStream()

virtual void closeStream ( uint8_t  daddr,
uint8_t  ep_addr 
)
pure virtual

Stop streaming the indicated endpoint.

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ control()

virtual bool control ( uint8_t  daddr,
const UsbSetupPacket &  setup,
uint8_t *  data 
)
pure virtual

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().

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ end()

virtual void end ( )
pure virtual

Stop all streams (the host stack itself keeps running).

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ millis()

virtual uint32_t millis ( ) const
pure virtual

Milliseconds since start (for control request timeouts).

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ openStream()

virtual bool openStream ( uint8_t  daddr,
const UsbEndpointDescriptorView &  ep,
UsbHostStreamRole  role 
)
pure virtual

Open an isochronous endpoint of the currently selected alternate setting and start streaming it in the indicated role.

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ setInterface()

virtual bool setInterface ( uint8_t  daddr,
uint8_t  itf,
uint8_t  alt 
)
pure virtual

Asynchronous SET_INTERFACE: select alternate setting alt of interface itf. Completion is reported via onControlComplete().

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ speed()

virtual UsbSpeed speed ( ) const
inlinevirtual

Bus speed of the attached device.

Reimplemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.

◆ task()

virtual void task ( )
pure virtual

Pump the host stack on platforms where the application drives it.

Implemented in USBAudioHostBackendESP32, and USBAudioHostBackendTinyUSB.


The documentation for this class was generated from the following file: