diff options
| author | Ha Thach <[email protected]> | 2020-04-28 11:12:58 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-28 11:12:58 +0700 |
| commit | b52bc894f89b3cf0bc338a6b23170d90fb2e98fa (patch) | |
| tree | b6b90325f5a55670ff933de708d8504539e06585 /src/device/usbd_control.c | |
| parent | d54343e4a6bc84549caf69ecd26a98852127ef3f (diff) | |
| parent | fcdb22b2f9db6f4e08ce05a1b2b7a1c9cc06a4ab (diff) | |
Merge pull request #380 from hathach/fix-usbnet-synopsys
synopsys turn off TX FIFO Empty for EPIN if all bytes are written
Diffstat (limited to 'src/device/usbd_control.c')
| -rw-r--r-- | src/device/usbd_control.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c index b0ae85e3b..353a66ad1 100644 --- a/src/device/usbd_control.c +++ b/src/device/usbd_control.c @@ -58,6 +58,7 @@ static uint8_t _usbd_ctrl_buf[CFG_TUD_ENDPOINT0_SIZE]; // Application API //--------------------------------------------------------------------+ +// Queue ZLP status transaction static inline bool _status_stage_xact(uint8_t rhport, tusb_control_request_t const * request) { // Opposite to endpoint in Data Phase @@ -81,7 +82,7 @@ bool tud_control_status(uint8_t rhport, tusb_control_request_t const * request) return _status_stage_xact(rhport, request); } -// Transfer an transaction in Data Stage +// Queue a transaction in Data Stage // Each transaction has up to Endpoint0's max packet size. // This function can also transfer an zero-length packet static bool _data_stage_xact(uint8_t rhport) @@ -102,7 +103,6 @@ static bool _data_stage_xact(uint8_t rhport) } // Transmit data to/from the control endpoint. -// // If the request's wLength is zero, a status packet is sent instead. bool tud_control_xfer(uint8_t rhport, tusb_control_request_t const * request, void* buffer, uint16_t len) { @@ -182,7 +182,7 @@ bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result // Data Stage is complete when all request's length are transferred or // a short packet is sent including zero-length packet. - if ( (_ctrl_xfer.request.wLength == _ctrl_xfer.total_xferred) || xferred_bytes < CFG_TUD_ENDPOINT0_SIZE ) + if ( (_ctrl_xfer.request.wLength == _ctrl_xfer.total_xferred) || (xferred_bytes < CFG_TUD_ENDPOINT0_SIZE) ) { // DATA stage is complete bool is_ok = true; @@ -191,6 +191,11 @@ bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result // callback can still stall control in status phase e.g out data does not make sense if ( _ctrl_xfer.complete_cb ) { + #if CFG_TUSB_DEBUG >= 2 + extern void usbd_driver_print_control_complete_name(bool (*control_complete) (uint8_t, tusb_control_request_t const *)); + usbd_driver_print_control_complete_name(_ctrl_xfer.complete_cb); + #endif + is_ok = _ctrl_xfer.complete_cb(rhport, &_ctrl_xfer.request); } |
