summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dümpelmann <[email protected]>2020-06-30 17:56:25 +0200
committerJan Dümpelmann <[email protected]>2020-06-30 17:56:25 +0200
commit378e6aab8cfba70dff135f6ba083eb1adefdae80 (patch)
treea35f6b29fdbe5b03f147695326a522b1009eeeab
parent9e35ef73f7ea4813eea5531b4b8edc871cbc9e8d (diff)
Clear ep0_pending if rx short packet
-rw-r--r--src/portable/st/synopsys/dcd_synopsys.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c
index 0e8743ad8..84430ec98 100644
--- a/src/portable/st/synopsys/dcd_synopsys.c
+++ b/src/portable/st/synopsys/dcd_synopsys.c
@@ -578,9 +578,12 @@ static void handle_rxflvl_ints(USB_OTG_OUTEndpointTypeDef * out_ep) {
xfer->buffer += bcnt;
// Truncate transfer length in case of short packet
- if(bcnt < xfer->max_size){
+ if(bcnt < xfer->max_size) {
xfer->total_len -= (out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DOEPTSIZ_XFRSIZ_Pos;
- if(epnum == 0) xfer->total_len -= ep0_pending[TUSB_DIR_OUT];
+ if(epnum == 0) {
+ xfer->total_len -= ep0_pending[TUSB_DIR_OUT];
+ ep0_pending[TUSB_DIR_OUT] = 0;
+ }
}
}
break;