diff options
| author | Ha Thach <[email protected]> | 2023-09-12 12:53:52 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-12 12:53:52 +0700 |
| commit | e9ba93315c1cd2b70c47526e0ba6b97e87624d18 (patch) | |
| tree | 6c37c99fb3187da704d249c248e2c069855d54d9 /src | |
| parent | 6d922de0cb11e2aa8e1b64b0c2019a2a8649b96c (diff) | |
| parent | 228acbeac2642534753beffd866db2a7eab45e31 (diff) | |
Merge pull request #2245 from arduino/fix_msd_extraneus_bytes_on_reading
Fix msd extraneus bytes on reading
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/renesas/rusb2/dcd_rusb2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/portable/renesas/rusb2/dcd_rusb2.c b/src/portable/renesas/rusb2/dcd_rusb2.c index 3ec1b70b5..24edc30e7 100644 --- a/src/portable/renesas/rusb2/dcd_rusb2.c +++ b/src/portable/renesas/rusb2/dcd_rusb2.c @@ -266,6 +266,14 @@ static void pipe_read_packet_ff(rusb2_reg_t * rusb, tu_fifo_t *f, volatile void tu_fifo_advance_write_pointer(f, count); } + +static bool wait_pipe_fifo_empty(rusb2_reg_t* rusb, uint8_t num) { + TU_ASSERT(num); + while( (rusb->PIPE_CTR[num-1] & RUSB2_PIPE_CTR_INBUFM_Msk) > 0 ) {} + return true; +} + + //--------------------------------------------------------------------+ // Pipe Transfer //--------------------------------------------------------------------+ @@ -339,6 +347,7 @@ static bool pipe_xfer_in(rusb2_reg_t* rusb, unsigned num) const unsigned rem = pipe->remaining; if (!rem) { + wait_pipe_fifo_empty(rusb, num); pipe->buf = NULL; return true; } |
