summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/portable/synopsys/dwc2/hcd_dwc2.c14
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;
}