Ver Fonte

Clear ep0_pending if rx short packet

Jan Dümpelmann há 5 anos atrás
pai
commit
378e6aab8c
1 ficheiros alterados com 5 adições e 2 exclusões
  1. 5 2
      src/portable/st/synopsys/dcd_synopsys.c

+ 5 - 2
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;