Clear ep0_pending if rx short packet

This commit is contained in:
Jan Dümpelmann 2020-06-30 17:56:25 +02:00
parent 9e35ef73f7
commit 378e6aab8c
1 changed files with 5 additions and 2 deletions

View File

@ -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;