Skip to content

Conversation

@HiFiPhile
Copy link
Collaborator

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.

Signed-off-by: HiFiPhile <[email protected]>
Copilot AI review requested due to automatic review settings November 21, 2025 15:54
Copilot finished reviewing on behalf of HiFiPhile November 21, 2025 15:56

// TX FIFO empty level for interrupt is complete empty
uint32_t gahbcfg = dwc2->gahbcfg;
gahbcfg |= GAHBCFG_TX_FIFO_EPMTY_LVL;
Copy link
Collaborator Author

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 ?

Copy link
Contributor

Copilot AI left a 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.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants