-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add dcd_configure for dwc2 FIFO config #3358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
|
|
||
| // TX FIFO empty level for interrupt is complete empty | ||
| uint32_t gahbcfg = dwc2->gahbcfg; | ||
| gahbcfg |= GAHBCFG_TX_FIFO_EPMTY_LVL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to set FIFO level to complete empty in any case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new configuration API (dcd_configure) to dynamically configure DWC2 device controller behavior, specifically enabling double buffering for IN endpoints to improve throughput. The implementation replaces the previous hardcoded TX FIFO empty level configuration with a configurable double buffering approach.
Key changes:
- New public API
tud_configure()to configure device stack behavior before initialization - DWC2-specific configuration structure to specify which IN endpoints should be double buffered
- FIFO allocation logic updated to support double buffering based on configuration
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/device/usbd.h | Adds new configuration API types and tud_configure() function declaration |
| src/device/usbd.c | Implements tud_configure() as a passthrough to dcd_configure() with weak default implementation |
| src/device/dcd.h | Declares dcd_configure() for device controller drivers to implement |
| src/portable/synopsys/dwc2/dcd_dwc2.c | Implements dcd_configure() for DWC2 and updates FIFO allocation logic to support double buffering; removes hardcoded TX FIFO empty level setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
|



Describe the PR
Add dcd_configure to configure dwc2 IN EP double buffer.
Although the gain is minimal as bandwidth limit is close (29MB/s vs 31MB/s). My PC's host controller only does 8 transfer per msof which yields a maximum throughput of 32MB/s.