From 173b3f87d0b2e71c4e7ce7ea26700df333e39cf5 Mon Sep 17 00:00:00 2001 From: RockyZeroFour Date: Sun, 8 Dec 2024 18:45:51 +0100 Subject: [PATCH] Fix livelock on IN or OUT transactions - Handles new interrupt flags for IN & OUT endpoints - Catches interrupts when certain error conditions occured - Prevents livelocks for some error conditions --- src/portable/synopsys/dwc2/dcd_dwc2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c index 010c395bf0..9caa898897 100644 --- a/src/portable/synopsys/dwc2/dcd_dwc2.c +++ b/src/portable/synopsys/dwc2/dcd_dwc2.c @@ -1175,6 +1175,9 @@ static void handle_epout_irq (uint8_t rhport) dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true); } } + + // Failsafe, clear all pending interrupts if set + epout[n].doepint = epout[n].doepint; } } } @@ -1252,6 +1255,9 @@ static void handle_epin_irq (uint8_t rhport) dwc2->diepempmsk &= ~(1 << n); } } + + // Failsafe, clear all pending interrupts if set + epin[n].diepint = epin[n].diepint; } } } @@ -1348,7 +1354,7 @@ void dcd_int_handler(uint8_t rhport) do { handle_rxflvl_irq(rhport); - } while(dwc2->gotgint & GINTSTS_RXFLVL); + } while(dwc2->gintsts & GINTSTS_RXFLVL); // Manage RX FIFO size if (_out_ep_closed)