Skip to content

Commit 048bb5c

Browse files
CopilotHiFiPhile
andauthored
Make fsdev errata delay helper 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>
1 parent 41575d2 commit 048bb5c

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/portable/st/stm32_fsdev/fsdev_common.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,4 @@ void btable_set_rx_bufsize(uint32_t ep_id, uint8_t buf_id, uint16_t wCount) {
113113
#endif
114114
}
115115

116-
/* STM32 FSDEV PMA Buffer Description Table errata workaround:
117-
* - ES0561 (STM32H503), ES0587 (STM32U535/U545)
118-
* - CTR may trigger before final PMA SRAM accesses complete on OUT transfers.
119-
* - Insert delay before reading PMA count/data.
120-
*/
121-
void fsdev_btable_workaround_delay(bool low_speed) {
122-
#if defined(TUP_USBIP_FSDEV_STM32) && defined(CFG_TUSB_FSDEV_32BIT)
123-
uint32_t cycle_count = low_speed ? CFG_TUSB_FSDEV_BTABLE_LS_DELAY_COUNT : CFG_TUSB_FSDEV_BTABLE_FS_DELAY_COUNT;
124-
volatile uint32_t delay_count = cycle_count;
125-
while (delay_count > 0U) {
126-
delay_count--;
127-
}
128-
#else
129-
(void) low_speed;
130-
#endif
131-
}
132-
133116
#endif

src/portable/st/stm32_fsdev/fsdev_common.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,17 @@ void btable_set_rx_bufsize(uint32_t ep_id, uint8_t buf_id, uint16_t wCount);
469469

470470
// Delay helper for STM32 FSDEV PMA Buffer Description Table errata (ES0561/ES0587).
471471
// Low-speed path uses CFG_TUSB_FSDEV_BTABLE_LS_DELAY_COUNT, otherwise full-speed count.
472-
void fsdev_btable_workaround_delay(bool low_speed);
472+
TU_ATTR_ALWAYS_INLINE static inline void fsdev_btable_workaround_delay(bool low_speed) {
473+
#if defined(TUP_USBIP_FSDEV_STM32) && defined(CFG_TUSB_FSDEV_32BIT)
474+
uint32_t cycle_count = low_speed ? CFG_TUSB_FSDEV_BTABLE_LS_DELAY_COUNT : CFG_TUSB_FSDEV_BTABLE_FS_DELAY_COUNT;
475+
volatile uint32_t delay_count = cycle_count;
476+
while (delay_count > 0U) {
477+
delay_count--;
478+
}
479+
#else
480+
(void) low_speed;
481+
#endif
482+
}
473483

474484
#ifdef __cplusplus
475485
}

0 commit comments

Comments
 (0)