From 50a7d923dd66cbb996c5587db4821fc52a307902 Mon Sep 17 00:00:00 2001 From: milek7 Date: Sun, 23 Nov 2025 00:00:10 +0100 Subject: stm32_fsdev: Fix missed cases in single-buffered isochronous endpoint support. --- src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 381aa0b40..6276f0f07 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c @@ -293,7 +293,11 @@ static void handle_ctr_tx(uint32_t ep_id) { return; } xfer->iso_in_sending = false; +#if FSDEV_USE_SBUF_ISO == 0 uint8_t buf_id = (ep_reg & USB_EP_DTOG_TX) ? 0 : 1; +#else + uint8_t buf_id = BTABLE_BUF_TX; +#endif btable_set_count(ep_id, buf_id, 0); } @@ -774,7 +778,12 @@ static bool edpt_xfer(uint8_t rhport, uint8_t ep_num, tusb_dir_t dir) { uint16_t cnt = tu_min16(xfer->total_len, xfer->max_packet_size); - if (ep_is_iso(ep_reg)) { +#if FSDEV_USE_SBUF_ISO == 0 + bool const dbl_buf = ep_is_iso(ep_reg); +#else + bool const dbl_buf = false; +#endif + if (dbl_buf) { btable_set_rx_bufsize(ep_idx, 0, cnt); btable_set_rx_bufsize(ep_idx, 1, cnt); } else { -- cgit v1.3.1 From 4632a78883daeb0d6355542c2daa008bfc4d4cc3 Mon Sep 17 00:00:00 2001 From: Zixun LI Date: Tue, 25 Nov 2025 16:03:21 +0100 Subject: dcd/fsdev: re-enable SBUF for STM32U0, no more issue --- src/portable/st/stm32_fsdev/fsdev_stm32.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/portable/st/stm32_fsdev/fsdev_stm32.h b/src/portable/st/stm32_fsdev/fsdev_stm32.h index 30ffadc35..e7a57aca0 100644 --- a/src/portable/st/stm32_fsdev/fsdev_stm32.h +++ b/src/portable/st/stm32_fsdev/fsdev_stm32.h @@ -202,8 +202,7 @@ #include "stm32u0xx.h" #define FSDEV_PMA_SIZE (1024u) #define FSDEV_BUS_32BIT - // Disable SBUF_ISO on U0 for now due to bad performance (audio glitching) - #define FSDEV_HAS_SBUF_ISO 0 + #define FSDEV_HAS_SBUF_ISO 1 #define USB USB_DRD_FS #define USB_EP_CTR_RX USB_EP_VTRX -- cgit v1.3.1 From 3f0d2668f1acbda95fa6d8b341c6ade8b56ee02b Mon Sep 17 00:00:00 2001 From: Zixun LI Date: Tue, 25 Nov 2025 16:12:20 +0100 Subject: fifo: fix IAR Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined --- src/common/tusb_fifo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h index 9d8b864e9..2fb4f37d4 100644 --- a/src/common/tusb_fifo.h +++ b/src/common/tusb_fifo.h @@ -175,7 +175,9 @@ bool tu_fifo_full(const tu_fifo_t *f); bool tu_fifo_overflowed(const tu_fifo_t *f); TU_ATTR_ALWAYS_INLINE static inline bool tu_fifo_empty(const tu_fifo_t *f) { - return f->wr_idx == f->rd_idx; + uint16_t wr_idx = f->wr_idx; + uint16_t rd_idx = f->rd_idx; + return wr_idx == rd_idx; } TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_fifo_depth(const tu_fifo_t *f) { -- cgit v1.3.1