audio: Implement support for variable EP in flow control fifo level#3321
audio: Implement support for variable EP in flow control fifo level#3321HiFiPhile merged 6 commits intohathach:masterfrom
Conversation
…rget fifo size of the ep in flow control
|
Thank you, it's something I've in mind (also for OUT transfer) |
There was a problem hiding this comment.
Pull Request Overview
This PR adds FIFO threshold configuration support for USB audio devices, enabling fine-tuned control over both EP IN (transmit) and EP OUT (receive via feedback) FIFO buffer management for better latency control.
- Adds getter/setter API functions for EP IN FIFO threshold configuration
- Extends
audio_feedback_params_tstruct withfifo_count.fifo_thresholdfield for EP OUT feedback control - Updates flow control logic to use configurable thresholds instead of hardcoded half-depth values
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/class/audio/audio_device.h | Adds API function declarations for EP IN FIFO threshold control and extends feedback params struct with threshold field |
| src/class/audio/audio_device.c | Implements threshold getter/setter functions, updates packet sizing logic to use configurable thresholds, and refactors feedback parameter handling |
| examples/device/uac2_speaker_fb/src/main.c | Reorganizes sample_rates array scope and adds documentation explaining FIFO threshold usage in feedback callback |
Signed-off-by: HiFiPhile <admin@hifiphile.com>
5468954 to
f188a40
Compare
There was a problem hiding this comment.
Gates Failed
Prevent hotspot decline
(1 hotspot with Complex Method)
Enforce advisory code health rules
(1 file with Complex Method)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Prevent hotspot decline | Violations | Code Health Impact | |
|---|---|---|---|
| audio_device.c | 1 rule in this hotspot | 3.44 → 3.43 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| audio_device.c | 1 advisory rule | 3.44 → 3.43 | Suppress |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
HiFiPhile
left a comment
There was a problem hiding this comment.
I've done the fixup and also added RX FIFO threshold adjustment.
Describe the PR
This PR adds a
tud_audio_set_ep_in_target_fifo_sizefunction that allows the user to set the target fifo level of the EP IN flow control.Additional context
For applications that require dynamic configuration of the audio EP IN, having the target fifo size set to half of the fifo depth can be limiting. In some cases the input latency might be very big. This MR aims to add the ability to configure this value at run time using the
tud_audio_set_ep_in_target_fifo_sizefunction.