summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorMengsk <[email protected]>2025-09-30 16:02:19 +0200
committerMengsk <[email protected]>2025-09-30 16:30:34 +0200
commit7867fa6c7d3ebe8324c168e7177a42b8f54a5a99 (patch)
treeee2167b1109cd7816d278d15cd1af97bc440b2c3 /src/class
parente463e87097edb592ca3d0d2cc3b7a17af90e5813 (diff)
Remove feedback format correction since no longer needed
Signed-off-by: Mengsk <[email protected]>
Diffstat (limited to 'src/class')
-rw-r--r--src/class/audio/audio_device.c16
-rw-r--r--src/class/audio/audio_device.h15
2 files changed, 5 insertions, 26 deletions
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index 65013b7e9..961aa7260 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -254,7 +254,6 @@ typedef struct
uint8_t frame_shift;// bInterval-1 in unit of frame (FS), micro-frame (HS)
uint8_t compute_method;
- bool format_correction;
union {
uint8_t power_of_2;// pre-computed power of 2 shift
float float_const; // pre-computed float constant
@@ -364,11 +363,6 @@ TU_ATTR_WEAK void tud_audio_feedback_params_cb(uint8_t func_id, uint8_t alt_itf,
feedback_param->method = AUDIO_FEEDBACK_METHOD_DISABLED;
}
-TU_ATTR_WEAK bool tud_audio_feedback_format_correction_cb(uint8_t func_id) {
- (void) func_id;
- return CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION;
-}
-
TU_ATTR_WEAK TU_ATTR_FAST_FUNC void tud_audio_feedback_interval_isr(uint8_t func_id, uint32_t frame_number, uint8_t interval_shift) {
(void) func_id;
(void) frame_number;
@@ -632,10 +626,9 @@ bool tud_audio_int_n_write(uint8_t func_id, const audio_interrupt_data_t *data)
// This function is called once a transmit of a feedback packet was successfully completed. Here, we get the next feedback value to be sent
static inline bool audiod_fb_send(uint8_t func_id) {
audiod_function_t *audio = &_audiod_fct[func_id];
- bool apply_correction = tud_audio_n_version(func_id) == 1 ||
- (TUSB_SPEED_FULL == tud_speed_get()) && audio->feedback.format_correction;
+ uint8_t uac_version = tud_audio_n_version(func_id);
// Format the feedback value
- if (apply_correction) {
+ if (uac_version == 1) {
uint8_t *fb = (uint8_t *) audio->fb_buf;
// For FS format is 10.14
@@ -660,7 +653,7 @@ static inline bool audiod_fb_send(uint8_t func_id) {
// 10.14 3 3 Linux, OSX
//
// We send 3 bytes since sending packet larger than wMaxPacketSize is pretty ugly
- return usbd_edpt_xfer(audio->rhport, audio->ep_fb, (uint8_t *) audio->fb_buf, apply_correction ? 3 : 4);
+ return usbd_edpt_xfer(audio->rhport, audio->ep_fb, (uint8_t *) audio->fb_buf, uac_version == 1 ? 3 : 4);
}
uint32_t tud_audio_feedback_update(uint8_t func_id, uint32_t cycles) {
@@ -1296,9 +1289,6 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *p
tud_audio_feedback_params_cb(func_id, alt, &fb_param);
audio->feedback.compute_method = fb_param.method;
- if (TUSB_SPEED_FULL == tud_speed_get())
- audio->feedback.format_correction = tud_audio_feedback_format_correction_cb(func_id);
-
// Minimal/Maximum value in 16.16 format for full speed (1ms per frame) or high speed (125 us per frame)
uint32_t const frame_div = (TUSB_SPEED_FULL == tud_speed_get()) ? 1000 : 8000;
audio->feedback.min_value = ((fb_param.sample_freq - 1) / frame_div) << 16;
diff --git a/src/class/audio/audio_device.h b/src/class/audio/audio_device.h
index d2d794053..39212472a 100644
--- a/src/class/audio/audio_device.h
+++ b/src/class/audio/audio_device.h
@@ -163,12 +163,6 @@
#define CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP 0 // Feedback - 0 or 1
#endif
-// Enable/disable conversion from 16.16 to 10.14 format on full-speed devices. See tud_audio_n_fb_set().
-// Can be override by tud_audio_feedback_format_correction_cb()
-#ifndef CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION
-#define CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION 0 // 0 or 1
-#endif
-
// Enable/disable interrupt EP (required for notifying host of control changes)
#ifndef CFG_TUD_AUDIO_ENABLE_INTERRUPT_EP
#define CFG_TUD_AUDIO_ENABLE_INTERRUPT_EP 0 // Feedback - 0 or 1
@@ -286,9 +280,8 @@ bool tud_audio_rx_done_isr(uint8_t rhport, uint16_t n_bytes_received, uint8_t fu
// This function is used to provide data rate feedback from an asynchronous sink. Feedback value will be sent at FB endpoint interval till it's changed.
//
-// The feedback format is specified to be 16.16 for HS and 10.14 for FS devices (see Universal Serial Bus Specification Revision 2.0 5.12.4.2). By default,
-// the choice of format is left to the caller and feedback argument is sent as-is. If CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION is set or tud_audio_feedback_format_correction_cb()
-// return true, then tinyusb expects 16.16 format and handles the conversion to 10.14 on FS.
+// The feedback format is specified to be 16.16 for HS and 10.14 for FS devices (see Universal Serial Bus Specification Revision 2.0 5.12.4.2).
+// For simplicity, this function always uses 16.16 format. For FS devices, the driver will automatically convert the value to 10.14 format.
//
// Note that due to a bug in its USB Audio 2.0 driver, Windows currently requires 16.16 format for _all_ USB 2.0 devices. On Linux and it seems the
// driver can work with either format.
@@ -340,10 +333,6 @@ void tud_audio_feedback_params_cb(uint8_t func_id, uint8_t alt_itf, audio_feedba
// frame_number : current SOF count
// interval_shift: number of bit shift i.e log2(interval) from Feedback endpoint descriptor
TU_ATTR_FAST_FUNC void tud_audio_feedback_interval_isr(uint8_t func_id, uint32_t frame_number, uint8_t interval_shift);
-
-// (Full-Speed only) Callback to set feedback format correction is applied or not,
-// default to CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION if not implemented.
-bool tud_audio_feedback_format_correction_cb(uint8_t func_id);
#endif // CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP
#if CFG_TUD_AUDIO_ENABLE_INTERRUPT_EP