Skip to content

Commit

Permalink
ADjust short packet length.
Browse files Browse the repository at this point in the history
  • Loading branch information
HiFiPhile committed Apr 6, 2024
1 parent 905075a commit 2e8c4d4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/portable/synopsys/dwc2/dcd_dwc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,10 +1083,15 @@ static void handle_epout_irq(uint8_t rhport) {
// Schedule another packet to be received.
edpt_schedule_packets(rhport, n, TUSB_DIR_OUT, 1, ep0_pending[TUSB_DIR_OUT]);
} else {
dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true);
if((n == 0) && dma_supported(rhport)) {
dma_ep0_start(rhport);
if(dma_supported(rhport)) {
xfer->total_len -= (epout->doeptsiz & DOEPTSIZ_XFRSIZ_Msk) >> DOEPTSIZ_XFRSIZ_Pos;
if(n == 0) {
dma_ep0_start(rhport);
}
}

dcd_event_xfer_complete(rhport, n, xfer->total_len, XFER_RESULT_SUCCESS, true);

}
}
}
Expand All @@ -1113,10 +1118,10 @@ static void handle_epin_irq(uint8_t rhport) {
// Schedule another packet to be transmitted.
edpt_schedule_packets(rhport, n, TUSB_DIR_IN, 1, ep0_pending[TUSB_DIR_IN]);
} else {
dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true);
if((n == 0) && dma_supported(rhport)) {
dma_ep0_start(rhport);
}
dcd_event_xfer_complete(rhport, n | TUSB_DIR_IN_MASK, xfer->total_len, XFER_RESULT_SUCCESS, true);
}
}

Expand Down

0 comments on commit 2e8c4d4

Please sign in to comment.