summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-04-09 16:29:08 +0200
committerHiFiPhile <[email protected]>2024-04-09 18:32:03 +0200
commit472996e2bfbd14341e99aa58e9f0c24e69a5043e (patch)
tree0dfb7674e9b5bd981f2696eee8ffac76bdd703c8 /src
parent973d29acd095662a3a5f1dfb8d57a3ad8092f89b (diff)
Ignore spurious RX interrupt.
Diffstat (limited to 'src')
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
index 4844c916d..a6d92c7c0 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -153,6 +153,7 @@ typedef struct
uint16_t queued_len;
uint16_t max_packet_size;
uint8_t ep_idx; // index for USB_EPnR register
+ bool in_complete; // Workaround for ISO IN EP doesn't have interrupt mask
} xfer_ctl_t;
// EP allocator
@@ -518,6 +519,19 @@ static void dcd_ep_ctr_tx_handler(uint32_t wIstr)
pcd_clear_tx_ep_ctr(USB, EPindex);
xfer_ctl_t * xfer = xfer_ctl_ptr(ep_addr);
+
+ /* Ignore spurious int */
+ if(xfer->in_complete) return;
+ xfer->in_complete = true;
+
+ if ((wEPRegVal & USB_EP_TYPE_MASK) == USB_EP_ISOCHRONOUS) {
+ if (wEPRegVal & USB_EP_DTOG_TX) {
+ pcd_set_ep_tx_dbuf0_cnt(USB, EPindex, 0);
+ } else {
+ pcd_set_ep_tx_dbuf1_cnt(USB, EPindex, 0);
+ }
+ }
+
if((xfer->total_len != xfer->queued_len)) /* TX not complete */
{
dcd_transmit_packet(xfer, EPindex);
@@ -1019,7 +1033,10 @@ static void dcd_transmit_packet(xfer_ctl_t * xfer, uint16_t ep_ix)
}
xfer->queued_len = (uint16_t)(xfer->queued_len + len);
+ dcd_int_disable(0);
pcd_set_ep_tx_status(USB, ep_ix, USB_EP_TX_VALID);
+ xfer->in_complete = false;
+ dcd_int_enable(0);
}
static bool edpt_xfer(uint8_t rhport, uint8_t ep_addr)