Conversation
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/3ec0d5b6-cb8e-48ff-8606-3371beb1efcb Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
HiFiPhile
April 9, 2026 10:48
View session
TinyUSB Average Code Size Metrics
Input files
|
Collaborator
|
@copilot make it static inline |
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/8588a09c-d4e5-4284-8944-47ae4e2a2a1f Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/8588a09c-d4e5-4284-8944-47ae4e2a2a1f Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
Refactor STM32 FSDEV PMA errata delay into shared helper and apply to DCD/HCD with overridable timing
Refactor STM32 FSDEV PMA errata delay into shared static inline helper and apply to DCD/HCD with overridable timing
Apr 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the STM32 FSDEV 32-bit PMA Buffer Description Table (BTable) errata delay workaround into shared FSDEV common code, reusing it from both host (HCD) and device (DCD) paths while making the delay timing configurable via macros.
Changes:
- Introduced a shared
fsdev_btable_workaround_delay(bool low_speed)static-inline helper and default delay-count macros infsdev_common.h. - Updated STM32 FSDEV HCD/DCD code paths to call the shared helper instead of duplicating delay loops.
- Consolidated STM32 max-CPU-MHz defaults into
fsdev_stm32.hand switched HCD’s stabilization delay to useFSDEV_STM32_CPU_MHZ.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/portable/st/stm32_fsdev/hcd_stm32_fsdev.c | Removes local CPU MHz + delay loop duplication; uses shared BTable errata delay helper and shared CPU MHz macro. |
| src/portable/st/stm32_fsdev/fsdev_stm32.h | Adds FSDEV_STM32_CPU_MHZ defaults for several STM32 FSDEV DRD families (incl. STM32U0). |
| src/portable/st/stm32_fsdev/fsdev_common.h | Adds overridable delay-count macros and the shared static inline errata delay helper. |
| src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | Replaces the device-side CTR_RX inline delay loop with the shared helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/b35badc2-444a-4329-b136-f314591cf693 Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. |
Signed-off-by: HiFiPhile <admin@hifiphile.com>
27d91e5 to
35045e0
Compare
|
hathach
reviewed
Apr 17, 2026
a83f801 to
5540b2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change extracts the STM32 FSDEV PMA buffer description table errata workaround from HCD-local logic into shared FSDEV common code, and applies the same workaround path to DCD. It also makes delay timing configurable via macros instead of fixed literals.
Errata workaround moved to shared FSDEV common layer
fsdev_btable_workaround_delay(bool low_speed)as astatic inlinehelper infsdev_common.h.DCD now uses the same workaround path
dcd_stm32_fsdev.cwith the shared helper.HCD duplication removed
channel_get_rx_count()with the shared helper.Delay count is now overridable
CFG_TUSB_FSDEV_BTABLE_FS_DELAY_COUNTCFG_TUSB_FSDEV_BTABLE_LS_DELAY_COUNTFSDEV_STM32_CPU_MHZwhen not explicitly configured.STM32 CPU MHz mapping consolidated
FSDEV_STM32_CPU_MHZdefaults infsdev_stm32.hfor STM32 FSDEV DRD families.