diff options
| author | hathach <[email protected]> | 2020-04-29 11:31:27 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-04-29 11:31:27 +0700 |
| commit | 6f4b6a1d03efa2a1f878e90d523746395be622c6 (patch) | |
| tree | 54bac102b970d07278eb58ecce1b32fdf2e5d3a7 /src | |
| parent | 94fed7db0e4c75caafaeff250c796ce1d9ab4c11 (diff) | |
remove the use of TU_VERIFY_HDLR
Diffstat (limited to 'src')
| -rw-r--r-- | src/device/usbd.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index 62133bdb8..06e724cb3 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -995,12 +995,21 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t TU_LOG2(" Queue EP %02X with %u bytes ... ", ep_addr, total_bytes); + // Set busy first since the actual transfer can be complete before dcd_edpt_xfer() could return + // and usbd task can preempt and clear the busy _usbd_dev.ep_status[epnum][dir].busy = true; - TU_VERIFY_HDLR( dcd_edpt_xfer(rhport, ep_addr, buffer, total_bytes), _usbd_dev.ep_status[epnum][dir].busy = false); - TU_LOG2("OK\r\n"); - - return true; + if ( dcd_edpt_xfer(rhport, ep_addr, buffer, total_bytes) ) + { + TU_LOG2("OK\r\n"); + return true; + }else + { + _usbd_dev.ep_status[epnum][dir].busy = false; + TU_LOG2("failed\r\n"); + TU_BREAKPOINT(); + return false; + } } bool usbd_edpt_busy(uint8_t rhport, uint8_t ep_addr) |
