diff options
| author | HiFiPHile <[email protected]> | 2026-08-27 15:35:56 +0200 |
|---|---|---|
| committer | HiFiPHile <[email protected]> | 2026-09-02 10:50:03 +0200 |
| commit | ee92fa7607c8eacac0ea44ffa09ece2d4e67a6f0 (patch) | |
| tree | cec0b76e88e0d567205d8236a7a7fe1de9fac772 | |
| parent | 389ab7e6c8e78f18092f2a968f533b65d18e856d (diff) | |
fix(dwc2): serialize deferred transfer abort
Protect periodic deferral cancellation from the SOF interrupt. Re-enable the host interrupt before disabling an active channel because slave-mode channel disable may wait for request-queue space.
| -rw-r--r-- | src/portable/synopsys/dwc2/hcd_dwc2.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/portable/synopsys/dwc2/hcd_dwc2.c b/src/portable/synopsys/dwc2/hcd_dwc2.c index ca16eec70..45add6c7f 100644 --- a/src/portable/synopsys/dwc2/hcd_dwc2.c +++ b/src/portable/synopsys/dwc2/hcd_dwc2.c @@ -787,14 +787,20 @@ bool hcd_edpt_abort_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr) { TU_VERIFY(ep_id < CFG_TUH_DWC2_ENDPOINT_MAX); hcd_endpoint_t* edpt = &_hcd_data.edpt[ep_id]; - if (edpt->xfer_pending) { + hcd_int_disable(rhport); + + const bool xfer_pending = edpt->xfer_pending; + if (xfer_pending) { edpt->xfer_pending = 0; edpt->uframe_countdown = 0; - return true; } + hcd_int_enable(rhport); - // hcd_int_disable(rhport); + if (xfer_pending) { + return true; + } + // Channel disable may wait for request-queue space in slave mode. // Find enabled channeled and disable it, channel will be de-allocated in the interrupt handler const uint8_t ch_id = channel_find_enabled(dwc2, dev_addr, ep_num, ep_dir); if (ch_id < 16) { @@ -802,8 +808,6 @@ bool hcd_edpt_abort_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr) { channel_disable(dwc2, channel); } - // hcd_int_enable(rhport); - return true; } |
