Files
CherryUSB/class/audio/usbd_audio.c

489 lines
18 KiB
C
Raw Normal View History

2022-02-08 11:44:46 +08:00
/**
* @file usbd_audio.c
* @brief
*
* Copyright (c) 2022 sakumisu
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
#include "usbd_core.h"
#include "usbd_audio.h"
2022-04-09 16:29:41 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200
2022-04-08 15:07:44 +08:00
struct usbd_audio_volume_info {
2022-02-12 18:49:06 +08:00
uint16_t vol_min;
uint16_t vol_max;
uint16_t vol_res;
uint16_t vol_current;
2022-04-08 15:07:44 +08:00
};
2022-04-09 16:29:41 +08:00
struct usbd_audio_attribute_control {
2022-04-08 15:07:44 +08:00
struct usbd_audio_volume_info volume[CONFIG_USBDEV_AUDIO_MAX_CHANNEL];
uint8_t mute[CONFIG_USBDEV_AUDIO_MAX_CHANNEL];
uint8_t automatic_gain[CONFIG_USBDEV_AUDIO_MAX_CHANNEL];
};
2022-04-09 16:29:41 +08:00
#else
2022-04-08 15:07:44 +08:00
struct audio_v2_control_range2_param_block_default {
uint16_t wNumSubRanges;
struct
{
uint16_t wMin;
uint16_t wMax;
uint16_t wRes;
} subrange[CONFIG_USBDEV_AUDIO_MAX_CHANNEL];
} __PACKED;
2022-04-09 16:29:41 +08:00
struct usbd_audio_attribute_control {
2022-04-08 15:07:44 +08:00
uint32_t volume_bCUR;
uint32_t mute_bCUR;
struct audio_v2_control_range2_param_block_default volume;
uint8_t mute[CONFIG_USBDEV_AUDIO_MAX_CHANNEL];
};
2022-04-09 16:29:41 +08:00
#endif
2022-04-08 15:07:44 +08:00
struct audio_entity_info {
usb_slist_t list;
uint8_t bDescriptorSubtype;
uint8_t bEntityId;
2022-08-11 17:27:00 +08:00
void *priv[2];
2022-04-08 15:07:44 +08:00
};
static usb_slist_t usbd_audio_entity_info_head = USB_SLIST_OBJECT_INIT(usbd_audio_entity_info_head);
2022-08-17 20:12:37 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200
2022-04-09 16:29:41 +08:00
const uint8_t default_sampling_freq_table[] = {
2022-08-11 17:27:00 +08:00
AUDIO_SAMPLE_FREQ_NUM(1),
// AUDIO_SAMPLE_FREQ_4B(8000),
// AUDIO_SAMPLE_FREQ_4B(8000),
// AUDIO_SAMPLE_FREQ_4B(0x00),
2022-04-09 16:29:41 +08:00
AUDIO_SAMPLE_FREQ_4B(16000),
AUDIO_SAMPLE_FREQ_4B(16000),
AUDIO_SAMPLE_FREQ_4B(0x00),
AUDIO_SAMPLE_FREQ_4B(32000),
AUDIO_SAMPLE_FREQ_4B(32000),
AUDIO_SAMPLE_FREQ_4B(0x00),
AUDIO_SAMPLE_FREQ_4B(44100),
AUDIO_SAMPLE_FREQ_4B(44100),
AUDIO_SAMPLE_FREQ_4B(0x00),
AUDIO_SAMPLE_FREQ_4B(48000),
AUDIO_SAMPLE_FREQ_4B(48000),
2022-04-09 16:29:41 +08:00
AUDIO_SAMPLE_FREQ_4B(0x00),
2022-08-11 17:27:00 +08:00
AUDIO_SAMPLE_FREQ_4B(88200),
AUDIO_SAMPLE_FREQ_4B(88200),
AUDIO_SAMPLE_FREQ_4B(0x00),
AUDIO_SAMPLE_FREQ_4B(96000),
AUDIO_SAMPLE_FREQ_4B(96000),
AUDIO_SAMPLE_FREQ_4B(0x00),
AUDIO_SAMPLE_FREQ_4B(192000),
AUDIO_SAMPLE_FREQ_4B(192000),
AUDIO_SAMPLE_FREQ_4B(0x00),
2022-04-09 16:29:41 +08:00
};
2022-08-17 20:12:37 +08:00
#endif
2022-04-09 16:29:41 +08:00
2022-04-08 15:07:44 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200
static int audio_custom_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
{
uint8_t control_selector;
2022-04-09 16:29:41 +08:00
uint32_t sampling_freq = 0;
2022-04-08 15:07:44 +08:00
uint8_t pitch_enable;
uint8_t ep;
if ((setup->bmRequestType & USB_REQUEST_RECIPIENT_MASK) == USB_REQUEST_RECIPIENT_ENDPOINT) {
control_selector = HI_BYTE(setup->wValue);
ep = LO_BYTE(setup->wIndex);
switch (setup->bRequest) {
case AUDIO_REQUEST_SET_CUR:
switch (control_selector) {
case AUDIO_EP_CONTROL_SAMPLING_FEQ:
2022-04-09 16:29:41 +08:00
memcpy((uint8_t *)&sampling_freq, *data, *len);
2022-05-25 11:00:25 +08:00
USB_LOG_DBG("Set ep:%02x %d Hz\r\n", ep, (int)sampling_freq);
2022-04-12 16:37:09 +08:00
usbd_audio_set_sampling_freq(0, ep, sampling_freq);
2022-05-25 11:00:25 +08:00
break;
2022-04-08 15:07:44 +08:00
case AUDIO_EP_CONTROL_PITCH:
pitch_enable = (*data)[0];
usbd_audio_set_pitch(ep, pitch_enable);
2022-05-25 11:00:25 +08:00
break;
2022-04-08 15:07:44 +08:00
default:
USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
break;
2022-05-25 11:00:25 +08:00
case AUDIO_REQUEST_GET_CUR:
sampling_freq = 16000;
memcpy(*data, &sampling_freq, 4);
*len = 4;
break;
2022-04-08 15:07:44 +08:00
default:
USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
2022-05-25 11:00:25 +08:00
} else {
return -1;
2022-04-08 15:07:44 +08:00
}
2022-05-25 11:00:25 +08:00
return 0;
2022-04-08 15:07:44 +08:00
}
#endif
2022-02-12 18:49:06 +08:00
static int audio_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len)
2022-02-08 11:44:46 +08:00
{
USB_LOG_DBG("AUDIO Class request: "
2022-02-12 18:49:06 +08:00
"bRequest 0x%02x\r\n",
setup->bRequest);
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
struct audio_entity_info *current_entity_info = NULL;
2022-08-11 17:27:00 +08:00
struct usbd_audio_attribute_control *current_feature_control = NULL;
2022-08-17 20:12:37 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200
2022-08-11 17:27:00 +08:00
uint32_t *sampling_freq;
2022-08-17 20:12:37 +08:00
#endif
2022-04-08 15:07:44 +08:00
usb_slist_t *i;
uint8_t entity_id;
uint8_t control_selector;
uint8_t ch;
uint8_t mute;
uint16_t volume;
const char *mute_string[2] = { "off", "on" };
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
entity_id = HI_BYTE(setup->wIndex);
control_selector = HI_BYTE(setup->wValue);
ch = LO_BYTE(setup->wValue);
2022-02-08 11:44:46 +08:00
2022-05-25 11:00:25 +08:00
ARG_UNUSED(mute_string);
2022-04-08 15:07:44 +08:00
if (ch > (CONFIG_USBDEV_AUDIO_MAX_CHANNEL - 1)) {
return -2;
}
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
usb_slist_for_each(i, &usbd_audio_entity_info_head)
{
struct audio_entity_info *tmp_entity_info = usb_slist_entry(i, struct audio_entity_info, list);
if (tmp_entity_info->bEntityId == entity_id) {
current_entity_info = tmp_entity_info;
2022-02-08 11:44:46 +08:00
break;
2022-04-08 15:07:44 +08:00
}
}
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
if (current_entity_info == NULL) {
return -2;
}
2022-02-08 11:44:46 +08:00
2022-08-11 17:27:00 +08:00
current_feature_control = (struct usbd_audio_attribute_control *)current_entity_info->priv[0];
2022-08-17 20:12:37 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200
2022-08-11 17:27:00 +08:00
sampling_freq = (uint32_t *)current_entity_info->priv[1];
2022-08-17 20:12:37 +08:00
#endif
2022-04-08 15:07:44 +08:00
if (current_entity_info->bDescriptorSubtype == AUDIO_CONTROL_FEATURE_UNIT) {
#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200
float volume2db = 0.0;
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
switch (control_selector) {
case AUDIO_FU_CONTROL_MUTE:
switch (setup->bRequest) {
case AUDIO_REQUEST_SET_CUR:
mute = (*data)[0];
2022-08-11 17:27:00 +08:00
current_feature_control->mute[ch] = mute;
2022-05-25 11:00:25 +08:00
USB_LOG_DBG("Set UnitId:%d ch[%d] mute %s\r\n", entity_id, ch, mute_string[mute]);
2022-04-12 16:37:09 +08:00
usbd_audio_set_mute(entity_id, ch, mute);
2022-04-08 15:07:44 +08:00
break;
case AUDIO_REQUEST_GET_CUR:
2022-08-11 17:27:00 +08:00
(*data)[0] = current_feature_control->mute[ch];
2022-04-08 15:07:44 +08:00
break;
default:
USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
break;
case AUDIO_FU_CONTROL_VOLUME:
switch (setup->bRequest) {
case AUDIO_REQUEST_SET_CUR:
volume = (((uint16_t)(*data)[1] << 8) | ((uint16_t)(*data)[0]));
2022-08-11 17:27:00 +08:00
current_feature_control->volume[ch].vol_current = volume;
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
if (volume < 0x8000) {
volume2db = 0.00390625 * volume;
} else if (volume > 0x8000) {
volume2db = -0.00390625 * (0xffff - volume + 1);
}
2022-05-25 11:00:25 +08:00
USB_LOG_DBG("Set UnitId:%d ch[%d] %0.4f dB\r\n", entity_id, ch, volume2db);
2022-04-12 16:37:09 +08:00
usbd_audio_set_volume(entity_id, ch, volume2db);
2022-04-08 15:07:44 +08:00
break;
case AUDIO_REQUEST_GET_CUR:
2022-08-11 17:27:00 +08:00
memcpy(*data, &current_feature_control->volume[ch].vol_current, 2);
2022-04-08 15:07:44 +08:00
*len = 2;
break;
case AUDIO_REQUEST_GET_MIN:
2022-08-11 17:27:00 +08:00
memcpy(*data, &current_feature_control->volume[ch].vol_min, 2);
2022-04-08 15:07:44 +08:00
*len = 2;
break;
case AUDIO_REQUEST_GET_MAX:
2022-08-11 17:27:00 +08:00
memcpy(*data, &current_feature_control->volume[ch].vol_max, 2);
2022-04-08 15:07:44 +08:00
*len = 2;
break;
case AUDIO_REQUEST_GET_RES:
2022-08-11 17:27:00 +08:00
memcpy(*data, &current_feature_control->volume[ch].vol_res, 2);
2022-04-08 15:07:44 +08:00
*len = 2;
break;
2022-05-25 11:00:25 +08:00
case AUDIO_REQUEST_SET_RES:
2022-08-11 17:27:00 +08:00
memcpy(&current_feature_control->volume[ch].vol_res, *data, 2);
2022-05-25 11:00:25 +08:00
*len = 2;
break;
2022-04-08 15:07:44 +08:00
default:
USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
break;
default:
USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
#else
switch (setup->bRequest) {
case AUDIO_REQUEST_CUR:
switch (control_selector) {
case AUDIO_FU_CONTROL_MUTE:
if (setup->bmRequestType & USB_REQUEST_DIR_MASK) {
2022-08-11 17:27:00 +08:00
(*data)[0] = current_feature_control->mute_bCUR;
2022-04-08 15:07:44 +08:00
*len = 1;
} else {
mute = (*data)[0];
2022-05-25 11:00:25 +08:00
USB_LOG_DBG("Set UnitId:%d ch[%d] mute %s\r\n", entity_id, ch, mute_string[mute]);
2022-04-12 16:37:09 +08:00
usbd_audio_set_mute(entity_id, ch, mute);
2022-04-08 15:07:44 +08:00
}
break;
case AUDIO_FU_CONTROL_VOLUME:
if (setup->bmRequestType & USB_REQUEST_DIR_MASK) {
2022-08-11 17:27:00 +08:00
(*data)[0] = current_feature_control->volume_bCUR & 0XFF;
(*data)[1] = (current_feature_control->volume_bCUR >> 8) & 0xff;
2022-04-08 15:07:44 +08:00
*len = 2;
} else {
volume = (((uint16_t)(*data)[1] << 8) | ((uint16_t)(*data)[0]));
2022-08-11 17:27:00 +08:00
current_feature_control->volume_bCUR = volume;
2022-05-25 11:00:25 +08:00
USB_LOG_DBG("Set UnitId:%d ch[%d] %d dB\r\n", entity_id, ch, volume);
2022-04-12 16:37:09 +08:00
usbd_audio_set_volume(entity_id, ch, volume);
2022-04-08 15:07:44 +08:00
}
break;
default:
USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
break;
case AUDIO_REQUEST_RANGE:
switch (control_selector) {
case AUDIO_FU_CONTROL_VOLUME:
if (setup->bmRequestType & USB_REQUEST_DIR_MASK) {
2022-08-11 17:27:00 +08:00
*((uint16_t *)(*data + 0)) = current_feature_control->volume.wNumSubRanges;
*((uint16_t *)(*data + 2)) = current_feature_control->volume.subrange[ch].wMin;
*((uint16_t *)(*data + 4)) = current_feature_control->volume.subrange[ch].wMax;
*((uint16_t *)(*data + 6)) = current_feature_control->volume.subrange[ch].wRes;
2022-04-08 15:07:44 +08:00
*len = 8;
} else {
}
break;
default:
USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
break;
default:
USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
#endif
2022-02-08 11:44:46 +08:00
}
2022-04-08 15:07:44 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200
else if (current_entity_info->bDescriptorSubtype == AUDIO_CONTROL_CLOCK_SOURCE) {
switch (setup->bRequest) {
case AUDIO_REQUEST_CUR:
switch (control_selector) {
case AUDIO_CS_CONTROL_SAM_FREQ:
if (setup->bmRequestType & USB_REQUEST_DIR_MASK) {
2022-08-11 17:27:00 +08:00
memcpy(*data, &sampling_freq[ch], sizeof(uint32_t));
2022-04-08 15:07:44 +08:00
*len = 4;
} else {
2022-08-11 17:27:00 +08:00
memcpy(&sampling_freq[ch], *data, setup->wLength);
USB_LOG_DBG("Set ClockId:%d ch[%d] %d Hz\r\n", entity_id, ch, (int)sampling_freq[ch]);
usbd_audio_set_sampling_freq(entity_id, ch, sampling_freq[ch]);
2022-04-08 15:07:44 +08:00
}
break;
case AUDIO_CS_CONTROL_CLOCK_VALID:
if (setup->bmRequestType & USB_REQUEST_DIR_MASK) {
(*data)[0] = 1;
*len = 1;
} else {
}
break;
default:
USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
break;
case AUDIO_REQUEST_RANGE:
switch (control_selector) {
case AUDIO_CS_CONTROL_SAM_FREQ:
if (setup->bmRequestType & USB_REQUEST_DIR_MASK) {
2022-04-09 16:29:41 +08:00
uint8_t *sampling_freq_table = NULL;
uint16_t num;
2022-04-12 16:37:09 +08:00
usbd_audio_get_sampling_freq_table(entity_id, &sampling_freq_table);
2022-04-09 16:29:41 +08:00
num = (uint16_t)((uint16_t)(sampling_freq_table[1] << 8) | ((uint16_t)sampling_freq_table[0]));
*data = sampling_freq_table;
*len = (12 * num + 2);
2022-04-08 15:07:44 +08:00
} else {
}
break;
default:
USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector);
2022-05-25 11:00:25 +08:00
return -1;
2022-04-08 15:07:44 +08:00
}
2022-02-08 11:44:46 +08:00
2022-04-08 15:07:44 +08:00
break;
default:
USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest);
return -1;
}
}
#endif
2022-05-25 11:00:25 +08:00
else {
return -1;
}
2022-02-08 11:44:46 +08:00
return 0;
}
2022-02-12 18:49:06 +08:00
static void audio_notify_handler(uint8_t event, void *arg)
2022-02-08 11:44:46 +08:00
{
switch (event) {
case USBD_EVENT_RESET:
break;
case USBD_EVENT_SOF:
2022-02-12 18:49:06 +08:00
usbd_audio_sof_callback();
2022-02-08 11:44:46 +08:00
break;
2022-04-08 15:07:44 +08:00
case USBD_EVENT_SET_INTERFACE: {
2022-02-12 18:49:06 +08:00
struct usb_interface_descriptor *intf = (struct usb_interface_descriptor *)arg;
if (intf->bAlternateSetting == 1) {
usbd_audio_open(intf->bInterfaceNumber);
} else {
usbd_audio_close(intf->bInterfaceNumber);
}
2022-04-08 15:07:44 +08:00
}
break;
2022-02-08 11:44:46 +08:00
default:
break;
}
}
void usbd_audio_add_interface(usbd_class_t *devclass, usbd_interface_t *intf)
{
static usbd_class_t *last_class = NULL;
if (last_class != devclass) {
last_class = devclass;
usbd_class_register(devclass);
}
intf->class_handler = audio_class_request_handler;
2022-04-08 15:07:44 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200
intf->custom_handler = audio_custom_request_handler;
#else
2022-02-08 11:44:46 +08:00
intf->custom_handler = NULL;
2022-04-08 15:07:44 +08:00
#endif
2022-02-08 11:44:46 +08:00
intf->vendor_handler = NULL;
intf->notify_handler = audio_notify_handler;
usbd_class_add_interface(devclass, intf);
}
2022-04-08 15:07:44 +08:00
void usbd_audio_add_entity(uint8_t entity_id, uint16_t bDescriptorSubtype)
{
2022-04-12 16:37:09 +08:00
struct audio_entity_info *entity_info = usb_malloc(sizeof(struct audio_entity_info));
2022-04-08 15:07:44 +08:00
memset(entity_info, 0, sizeof(struct audio_entity_info));
entity_info->bEntityId = entity_id;
entity_info->bDescriptorSubtype = bDescriptorSubtype;
if (bDescriptorSubtype == AUDIO_CONTROL_FEATURE_UNIT) {
#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200
2022-04-12 16:37:09 +08:00
struct usbd_audio_attribute_control *control = usb_malloc(sizeof(struct usbd_audio_attribute_control));
2022-04-09 16:29:41 +08:00
memset(control, 0, sizeof(struct usbd_audio_attribute_control));
2022-04-08 15:07:44 +08:00
for (uint8_t ch = 0; ch < CONFIG_USBDEV_AUDIO_MAX_CHANNEL; ch++) {
control->volume[ch].vol_min = 0xdb00;
control->volume[ch].vol_max = 0x0000;
control->volume[ch].vol_res = 0x0100;
control->volume[ch].vol_current = 0xf600;
control->mute[ch] = 0;
control->automatic_gain[ch] = 0;
}
#else
2022-04-15 16:49:54 +08:00
struct usbd_audio_attribute_control *control = usb_malloc(sizeof(struct usbd_audio_attribute_control));
2022-04-09 16:29:41 +08:00
memset(control, 0, sizeof(struct usbd_audio_attribute_control));
2022-04-08 15:07:44 +08:00
for (uint8_t ch = 0; ch < CONFIG_USBDEV_AUDIO_MAX_CHANNEL; ch++) {
control->volume.wNumSubRanges = 1;
control->volume.subrange[ch].wMin = 0;
control->volume.subrange[ch].wMax = 100;
control->volume.subrange[ch].wRes = 1;
control->mute[ch] = 0;
control->volume_bCUR = 50;
control->mute_bCUR = 0;
}
#endif
2022-08-11 17:27:00 +08:00
entity_info->priv[0] = control;
2022-04-08 15:07:44 +08:00
} else if (bDescriptorSubtype == AUDIO_CONTROL_CLOCK_SOURCE) {
2022-08-17 20:12:37 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200
2022-08-11 17:27:00 +08:00
uint32_t *sampling_freq = usb_malloc(sizeof(uint32_t) * CONFIG_USBDEV_AUDIO_MAX_CHANNEL);
for (size_t ch = 0; ch < CONFIG_USBDEV_AUDIO_MAX_CHANNEL; ch++) {
sampling_freq[ch] = 16000;
}
entity_info->priv[1] = sampling_freq;
2022-08-17 20:12:37 +08:00
#else
entity_info->priv[1] = NULL;
#endif
2022-04-08 15:07:44 +08:00
}
usb_slist_add_tail(&usbd_audio_entity_info_head, &entity_info->list);
}
2022-04-12 16:37:09 +08:00
__WEAK void usbd_audio_set_volume(uint8_t entity_id, uint8_t ch, float dB)
2022-04-08 15:07:44 +08:00
{
}
2022-04-12 16:37:09 +08:00
__WEAK void usbd_audio_set_mute(uint8_t entity_id, uint8_t ch, uint8_t enable)
2022-04-08 15:07:44 +08:00
{
}
2022-04-12 16:37:09 +08:00
__WEAK void usbd_audio_set_sampling_freq(uint8_t entity_id, uint8_t ep_ch, uint32_t sampling_freq)
2022-02-08 11:44:46 +08:00
{
}
2022-08-17 20:12:37 +08:00
#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200
2022-04-12 16:37:09 +08:00
__WEAK void usbd_audio_get_sampling_freq_table(uint8_t entity_id, uint8_t **sampling_freq_table)
2022-04-09 16:29:41 +08:00
{
*sampling_freq_table = (uint8_t *)default_sampling_freq_table;
}
2022-08-17 20:12:37 +08:00
#endif
2022-04-08 15:07:44 +08:00
__WEAK void usbd_audio_set_pitch(uint8_t ep, bool enable)
2022-02-12 18:49:06 +08:00
{
}
__WEAK void usbd_audio_sof_callback(void)
{
2022-03-27 14:38:47 +08:00
}