Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
uac2_ops Struct Reference

USB Audio 2 application event handlers. More...

#include <usbd_uac2.h>

Data Fields

void(* sof_cb )(const struct device *dev, void *user_data)
 Start of Frame callback.
 
void(* terminal_update_cb )(const struct device *dev, uint8_t terminal, bool enabled, bool microframes, void *user_data)
 Terminal update callback.
 
void *(* get_recv_buf )(const struct device *dev, uint8_t terminal, uint16_t size, void *user_data)
 Get receive buffer address.
 
void(* data_recv_cb )(const struct device *dev, uint8_t terminal, void *buf, uint16_t size, void *user_data)
 Data received.
 
void(* buf_release_cb )(const struct device *dev, uint8_t terminal, void *buf, void *user_data)
 Transmit buffer release callback.
 
uint32_t(* feedback_cb )(const struct device *dev, uint8_t terminal, void *user_data)
 Get Explicit Feedback value.
 
uint32_t(* get_sample_rate )(const struct device *dev, uint8_t clock_id, void *user_data)
 Get active sample rate.
 
int(* set_sample_rate )(const struct device *dev, uint8_t clock_id, uint32_t rate, void *user_data)
 Set active sample rate.
 

Detailed Description

USB Audio 2 application event handlers.

Field Documentation

◆ buf_release_cb

void(* uac2_ops::buf_release_cb) (const struct device *dev, uint8_t terminal, void *buf, void *user_data)

Transmit buffer release callback.

This function releases buffer provided in usbd_uac2_send when the class no longer needs it.

Parameters
devUSB Audio 2 device
terminalOutput Terminal ID linked to AudioStreaming interface
bufBuffer previously provided via usbd_uac2_send
user_dataOpaque user data pointer

◆ data_recv_cb

void(* uac2_ops::data_recv_cb) (const struct device *dev, uint8_t terminal, void *buf, uint16_t size, void *user_data)

Data received.

This function releases buffer obtained in get_recv_buf after USB has written data to the buffer and/or no longer needs it.

Parameters
devUSB Audio 2 device
terminalInput Terminal ID linked to AudioStreaming interface
bufBuffer previously obtained via get_recv_buf
sizeNumber of bytes written to buffer
user_dataOpaque user data pointer

◆ feedback_cb

uint32_t(* uac2_ops::feedback_cb) (const struct device *dev, uint8_t terminal, void *user_data)

Get Explicit Feedback value.

Explicit feedback value format depends terminal connection speed. If device is High-Speed capable, it must use Q16.16 format if and only if the terminal_update_cb was called with microframes parameter set to true. On Full-Speed only devices, or if High-Speed capable device is operating at Full-Speed (microframes was false), the format is Q10.14 stored on 24 least significant bits (i.e. 8 most significant bits are ignored).

Parameters
devUSB Audio 2 device
terminalInput Terminal ID whose feedback should be returned
user_dataOpaque user data pointer

◆ get_recv_buf

void *(* uac2_ops::get_recv_buf) (const struct device *dev, uint8_t terminal, uint16_t size, void *user_data)

Get receive buffer address.

USB stack calls this function to obtain receive buffer address for AudioStreaming interface. The buffer is owned by USB stack until data_recv_cb callback is called. The buffer must be sufficiently aligned and otherwise suitable for use by UDC driver.

Parameters
devUSB Audio 2 device
terminalInput Terminal ID linked to AudioStreaming interface
sizeMaximum number of bytes USB stack will write to buffer.
user_dataOpaque user data pointer

◆ get_sample_rate

uint32_t(* uac2_ops::get_sample_rate) (const struct device *dev, uint8_t clock_id, void *user_data)

Get active sample rate.

USB stack calls this function when the host asks for active sample rate if the Clock Source entity supports more than one sample rate. This function won't ever be called (should be NULL) if all Clock Source entities support only one sample rate.

Parameters
devUSB Audio 2 device
clock_idClock Source ID whose sample rate should be returned
user_dataOpaque user data pointer
Returns
Active sample rate in Hz

◆ set_sample_rate

int(* uac2_ops::set_sample_rate) (const struct device *dev, uint8_t clock_id, uint32_t rate, void *user_data)

Set active sample rate.

USB stack calls this function when the host sets active sample rate. This callback may be NULL if all Clock Source entities have only one sample rate. USB stack sanitizes the sample rate to closest valid rate for given Clock Source entity.

Parameters
devUSB Audio 2 device
clock_idClock Source ID whose sample rate should be set
rateSample rate in Hz
user_dataOpaque user data pointer
Returns
0 on success, negative value on error

◆ sof_cb

void(* uac2_ops::sof_cb) (const struct device *dev, void *user_data)

Start of Frame callback.

Notifies application about SOF event on the bus.

Parameters
devUSB Audio 2 device
user_dataOpaque user data pointer

◆ terminal_update_cb

void(* uac2_ops::terminal_update_cb) (const struct device *dev, uint8_t terminal, bool enabled, bool microframes, void *user_data)

Terminal update callback.

Notifies application that host has enabled or disabled a terminal.

Parameters
devUSB Audio 2 device
terminalTerminal ID linked to AudioStreaming interface
enabledTrue if host enabled terminal, False otherwise
microframesTrue if USB connection speed uses microframes
user_dataOpaque user data pointer

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