Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
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. | |
USB Audio 2 application event handlers.
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.
dev | USB Audio 2 device |
terminal | Output Terminal ID linked to AudioStreaming interface |
buf | Buffer previously provided via usbd_uac2_send |
user_data | Opaque user data pointer |
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.
dev | USB Audio 2 device |
terminal | Input Terminal ID linked to AudioStreaming interface |
buf | Buffer previously obtained via get_recv_buf |
size | Number of bytes written to buffer |
user_data | Opaque user data pointer |
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).
dev | USB Audio 2 device |
terminal | Input Terminal ID whose feedback should be returned |
user_data | Opaque user data pointer |
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.
dev | USB Audio 2 device |
terminal | Input Terminal ID linked to AudioStreaming interface |
size | Maximum number of bytes USB stack will write to buffer. |
user_data | Opaque user data pointer |
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.
dev | USB Audio 2 device |
clock_id | Clock Source ID whose sample rate should be returned |
user_data | Opaque user data pointer |
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.
dev | USB Audio 2 device |
clock_id | Clock Source ID whose sample rate should be set |
rate | Sample rate in Hz |
user_data | Opaque user data pointer |
void(* uac2_ops::sof_cb) (const struct device *dev, void *user_data) |
Start of Frame callback.
Notifies application about SOF event on the bus.
dev | USB Audio 2 device |
user_data | Opaque user data pointer |
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.
dev | USB Audio 2 device |
terminal | Terminal ID linked to AudioStreaming interface |
enabled | True if host enabled terminal, False otherwise |
microframes | True if USB connection speed uses microframes |
user_data | Opaque user data pointer |