Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
usb_audio.h
Go to the documentation of this file.
1/*
2 * USB audio class core header
3 *
4 * Copyright (c) 2020 Nordic Semiconductor ASA
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
21#ifndef ZEPHYR_INCLUDE_USB_CLASS_AUDIO_H_
22#define ZEPHYR_INCLUDE_USB_CLASS_AUDIO_H_
23
24#include <zephyr/usb/usb_ch9.h>
25#include <zephyr/device.h>
26#include <zephyr/net_buf.h>
27#include <zephyr/sys/util.h>
28
38
53
63
81
98
174
182
207
219typedef void (*usb_audio_data_request_cb_t)(const struct device *dev);
220
232typedef void (*usb_audio_data_completion_cb_t)(const struct device *dev,
233 struct net_buf *buffer,
234 size_t size);
235
248typedef void (*usb_audio_feature_updated_cb_t)(const struct device *dev,
249 const struct usb_audio_fu_evt *evt);
250
280
295size_t usb_audio_get_in_frame_size(const struct device *dev);
296
306void usb_audio_register(const struct device *dev,
307 const struct usb_audio_ops *ops);
308
329int usb_audio_send(const struct device *dev, struct net_buf *buffer,
330 size_t len);
331
332#endif /* ZEPHYR_INCLUDE_USB_CLASS_AUDIO_H_ */
Buffer management.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:412
Network buffer representation.
Definition net_buf.h:1006
uint16_t size
Amount of data that this buffer can store.
Definition net_buf.h:1038
Feature Unit event structure.
Definition usb_audio.h:189
enum usb_audio_fucs cs
Control selector feature that has been changed.
Definition usb_audio.h:196
const void * val
Value of the feature that has been set.
Definition usb_audio.h:205
enum usb_audio_direction dir
The device direction that has been changed.
Definition usb_audio.h:194
uint8_t val_len
Length of the val field.
Definition usb_audio.h:203
uint8_t channel
Device channel that has been changed.
Definition usb_audio.h:201
Audio callbacks used to interact with audio devices by user App.
Definition usb_audio.h:261
usb_audio_data_completion_cb_t data_written_cb
Callback called when data were successfully written with sending capable device.
Definition usb_audio.h:269
usb_audio_data_completion_cb_t data_received_cb
Callback called when data were successfully received by receive capable device.
Definition usb_audio.h:275
usb_audio_data_request_cb_t data_request_cb
Callback called when data could be send.
Definition usb_audio.h:263
usb_audio_feature_updated_cb_t feature_update_cb
Callback called when features were modified by the Host.
Definition usb_audio.h:278
Misc utilities.
usb_audio_int_subclass_codes
Audio Interface Subclass Codes.
Definition usb_audio.h:32
@ USB_AUDIO_MIDISTREAMING
Definition usb_audio.h:36
@ USB_AUDIO_AUDIOSTREAMING
Definition usb_audio.h:35
@ USB_AUDIO_AUDIOCONTROL
Definition usb_audio.h:34
@ USB_AUDIO_SUBCLASS_UNDEFINED
Definition usb_audio.h:33
usb_audio_fucs
Feature Unit Control Selectors Refer to Table A-11 from audio10.pdf.
Definition usb_audio.h:85
@ USB_AUDIO_FU_CONTROL_UNDEFINED
Definition usb_audio.h:86
@ USB_AUDIO_FU_BASS_BOOST_CONTROL
Definition usb_audio.h:95
@ USB_AUDIO_FU_GRAPHIC_EQUALIZER_CONTROL
Definition usb_audio.h:92
@ USB_AUDIO_FU_BASS_CONTROL
Definition usb_audio.h:89
@ USB_AUDIO_FU_TREBLE_CONTROL
Definition usb_audio.h:91
@ USB_AUDIO_FU_VOLUME_CONTROL
Definition usb_audio.h:88
@ USB_AUDIO_FU_AUTOMATIC_GAIN_CONTROL
Definition usb_audio.h:93
@ USB_AUDIO_FU_MID_CONTROL
Definition usb_audio.h:90
@ USB_AUDIO_FU_LOUDNESS_CONTROL
Definition usb_audio.h:96
@ USB_AUDIO_FU_MUTE_CONTROL
Definition usb_audio.h:87
@ USB_AUDIO_FU_DELAY_CONTROL
Definition usb_audio.h:94
void(* usb_audio_data_completion_cb_t)(const struct device *dev, struct net_buf *buffer, size_t size)
Callback type used to inform the app that data were successfully send/received.
Definition usb_audio.h:232
void(* usb_audio_feature_updated_cb_t)(const struct device *dev, const struct usb_audio_fu_evt *evt)
Callback type used to inform the app that Host has changed one of the features configured for the dev...
Definition usb_audio.h:248
void usb_audio_register(const struct device *dev, const struct usb_audio_ops *ops)
Register the USB Audio device and make it usable.
void(* usb_audio_data_request_cb_t)(const struct device *dev)
Callback type used to inform the app that data were requested from the device and may be send to the ...
Definition usb_audio.h:219
usb_audio_cs_ac_int_desc_subtypes
Audio Class-Specific AC Interface Descriptor Subtypes.
Definition usb_audio.h:42
@ USB_AUDIO_MIXER_UNIT
Definition usb_audio.h:47
@ USB_AUDIO_AC_DESCRIPTOR_UNDEFINED
Definition usb_audio.h:43
@ USB_AUDIO_OUTPUT_TERMINAL
Definition usb_audio.h:46
@ USB_AUDIO_HEADER
Definition usb_audio.h:44
@ USB_AUDIO_INPUT_TERMINAL
Definition usb_audio.h:45
@ USB_AUDIO_SELECTOR_UNIT
Definition usb_audio.h:48
@ USB_AUDIO_FEATURE_UNIT
Definition usb_audio.h:49
@ USB_AUDIO_EXTENSION_UNIT
Definition usb_audio.h:51
@ USB_AUDIO_PROCESSING_UNIT
Definition usb_audio.h:50
usb_audio_direction
Audio device direction.
Definition usb_audio.h:178
@ USB_AUDIO_OUT
Definition usb_audio.h:180
@ USB_AUDIO_IN
Definition usb_audio.h:179
usb_audio_cs_req_codes
Audio Class-Specific Request Codes Refer to Table A-9 from audio10.pdf.
Definition usb_audio.h:67
@ USB_AUDIO_SET_CUR
Definition usb_audio.h:69
@ USB_AUDIO_SET_RES
Definition usb_audio.h:75
@ USB_AUDIO_GET_STAT
Definition usb_audio.h:79
@ USB_AUDIO_GET_MIN
Definition usb_audio.h:72
@ USB_AUDIO_GET_RES
Definition usb_audio.h:76
@ USB_AUDIO_GET_MEM
Definition usb_audio.h:78
@ USB_AUDIO_REQUEST_CODE_UNDEFINED
Definition usb_audio.h:68
@ USB_AUDIO_SET_MIN
Definition usb_audio.h:71
@ USB_AUDIO_GET_CUR
Definition usb_audio.h:70
@ USB_AUDIO_SET_MAX
Definition usb_audio.h:73
@ USB_AUDIO_GET_MAX
Definition usb_audio.h:74
@ USB_AUDIO_SET_MEM
Definition usb_audio.h:77
usb_audio_terminal_types
USB Terminal Types Refer to Table 2-1 - Table 2-4 from termt10.pdf.
Definition usb_audio.h:102
@ USB_AUDIO_IO_SPEAKERPHONE_ECHO_NONE
Speakerphone, no echo reduction.
Definition usb_audio.h:168
@ USB_AUDIO_IO_HANDSET
Handset.
Definition usb_audio.h:164
@ USB_AUDIO_IN_MIC_ARRAY
Microphone array.
Definition usb_audio.h:130
@ USB_AUDIO_IN_DESKTOP_MIC
Desktop microphone.
Definition usb_audio.h:124
@ USB_AUDIO_IO_SPEAKERPHONE_ECHO_CAN
Speakerphone, echo cancellation.
Definition usb_audio.h:172
@ USB_AUDIO_OUT_SPEAKER
Speaker.
Definition usb_audio.h:142
@ USB_AUDIO_IN_PERSONAL_MIC
Personal microphone.
Definition usb_audio.h:126
@ USB_AUDIO_IN_OM_DIR_MIC
Omni directional microphone.
Definition usb_audio.h:128
@ USB_AUDIO_USB_VENDOR_SPEC
USB vendor specific.
Definition usb_audio.h:112
@ USB_AUDIO_OUT_UNDEFINED
Output undefined.
Definition usb_audio.h:140
@ USB_AUDIO_IN_MICROPHONE
Microphone.
Definition usb_audio.h:122
@ USB_AUDIO_OUT_LOW_FREQ_SPEAKER
Low frequency effects speaker.
Definition usb_audio.h:154
@ USB_AUDIO_USB_UNDEFINED
USB undefined.
Definition usb_audio.h:108
@ USB_AUDIO_USB_STREAMING
USB streaming.
Definition usb_audio.h:110
@ USB_AUDIO_IO_SPEAKERPHONE_ECHO_SUP
Speakerphone, echo reduction.
Definition usb_audio.h:170
@ USB_AUDIO_OUT_HEADPHONES
Headphones.
Definition usb_audio.h:144
@ USB_AUDIO_IN_PROC_MIC_ARRAY
Processing microphone array.
Definition usb_audio.h:132
@ USB_AUDIO_IO_UNDEFINED
Bidirectional undefined.
Definition usb_audio.h:162
@ USB_AUDIO_OUT_DESKTOP_SPEAKER
Desktop speaker.
Definition usb_audio.h:148
@ USB_AUDIO_OUT_ROOM_SPEAKER
Room speaker.
Definition usb_audio.h:150
@ USB_AUDIO_OUT_HEAD_AUDIO
Head mounted display audio.
Definition usb_audio.h:146
@ USB_AUDIO_IO_HEADSET
Headset.
Definition usb_audio.h:166
@ USB_AUDIO_IN_UNDEFINED
Input undefined.
Definition usb_audio.h:120
@ USB_AUDIO_OUT_COMM_SPEAKER
Communication speaker.
Definition usb_audio.h:152
usb_audio_cs_as_int_desc_subtypes
Audio Class-Specific AS Interface Descriptor Subtypes Refer to Table A-6 from audio10....
Definition usb_audio.h:57
@ USB_AUDIO_AS_DESCRIPTOR_UNDEFINED
Definition usb_audio.h:58
@ USB_AUDIO_AS_GENERAL
Definition usb_audio.h:59
@ USB_AUDIO_FORMAT_TYPE
Definition usb_audio.h:60
@ USB_AUDIO_FORMAT_SPECIFIC
Definition usb_audio.h:61
int usb_audio_send(const struct device *dev, struct net_buf *buffer, size_t len)
Send data using USB Audio device.
size_t usb_audio_get_in_frame_size(const struct device *dev)
Get the frame size that is accepted by the Host.
USB Chapter 9 structures and definitions.