summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrunelauridsen <[email protected]>2026-09-01 10:10:33 +0200
committerrunelauridsen <[email protected]>2026-09-01 10:10:33 +0200
commit04a6ec80d94e13c70087c44dcf095d842302bafa (patch)
tree260a9f8d9e8ec3a5c4933d55653161f3422c9f96
parent84dcec43c709643f8a1b1ebbab6d08fbbc605a6d (diff)
Fix DWC2 DMA data toggle mismatch in IN-transfers
-rw-r--r--src/portable/synopsys/dwc2/hcd_dwc2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/portable/synopsys/dwc2/hcd_dwc2.c b/src/portable/synopsys/dwc2/hcd_dwc2.c
index 089b839ae..761627730 100644
--- a/src/portable/synopsys/dwc2/hcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/hcd_dwc2.c
@@ -1129,6 +1129,10 @@ static bool handle_channel_in_dma(dwc2_regs_t* dwc2, uint8_t ch_id, uint32_t hci
channel_send_in_token(dwc2, channel);
}
} else if (hcint & (HCINT_XFER_COMPLETE | HCINT_STALL | HCINT_BABBLE_ERR)) {
+ if (edpt->hcchar_bm.ep_num != 0 && (hcint & HCINT_XFER_COMPLETE)) {
+ edpt->next_pid = hctsiz.pid; // save pid (already toggled)
+ }
+
const uint16_t remain_bytes = (uint16_t) hctsiz.xfer_size;
const uint16_t remain_packets = hctsiz.packet_count;
const uint16_t actual_len = edpt->buflen - remain_bytes;