diff options
| author | Ha Thach <[email protected]> | 2020-07-01 00:11:21 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-07-01 00:11:21 +0700 |
| commit | e4391c32a6f27cdbeaa3a5b034fcb5787bc5579c (patch) | |
| tree | a35f6b29fdbe5b03f147695326a522b1009eeeab /src | |
| parent | 05996aee640269b7e91fcf441c286d3ec09f3c34 (diff) | |
| parent | 378e6aab8cfba70dff135f6ba083eb1adefdae80 (diff) | |
Merge pull request #451 from duempel/fix_synopsys_short_packet
Fix receiving of short packet data (Synopsys)
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/st/synopsys/dcd_synopsys.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c index b47101e60..84430ec98 100644 --- a/src/portable/st/synopsys/dcd_synopsys.c +++ b/src/portable/st/synopsys/dcd_synopsys.c @@ -576,6 +576,15 @@ static void handle_rxflvl_ints(USB_OTG_OUTEndpointTypeDef * out_ep) { // Increment pointer to xfer data xfer->buffer += bcnt; + + // Truncate transfer length in case of short packet + 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]; + ep0_pending[TUSB_DIR_OUT] = 0; + } + } } break; case 0x03: // Out packet done (Interrupt) |
