diff options
| author | hathach <[email protected]> | 2013-07-02 17:37:55 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-07-02 17:37:55 +0700 |
| commit | 539c7cdbe16d7805eac053a6779f509a4c9b4c68 (patch) | |
| tree | c6dd166cb24c60c17dbe33ee78c25a0811300465 /tinyusb | |
| parent | e1ad7b62cf453735b3f8b9d97abe2b3e6579a099 (diff) | |
update usbh_xfer_isr to take actual byte transferred and correct tests
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/host/ehci/ehci.c | 6 | ||||
| -rw-r--r-- | tinyusb/host/usbh.c | 2 | ||||
| -rw-r--r-- | tinyusb/host/usbh_hcd.h | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index c016a3a3c..c1ea9a7ed 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -529,7 +529,7 @@ void qhd_xfer_complete_isr(ehci_qhd_t * p_qhd, tusb_xfer_type_t xfer_type) if (is_ioc) // end of request { usbh_xfer_isr( qhd_create_pipe_handle(p_qhd, xfer_type), - p_qhd->class_code, TUSB_EVENT_XFER_COMPLETE); // call USBH callback + p_qhd->class_code, TUSB_EVENT_XFER_COMPLETE, actual_bytes_xferred); // call USBH callback } } } @@ -602,13 +602,15 @@ void qhd_xfer_error_isr(ehci_qhd_t * p_qhd, tusb_xfer_type_t xfer_type) error_event = ( !(p_qhd->qtd_overlay.buffer_err || p_qhd->qtd_overlay.babble_err || p_qhd->qtd_overlay.xact_err) ) ? TUSB_EVENT_XFER_STALLED : TUSB_EVENT_XFER_ERROR; + uint16_t actual_bytes_xferred = p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes; + hal_debugger_breakpoint(); p_qhd->p_qtd_list_head->used = 0; // free QTD qtd_remove_1st_from_qhd(p_qhd); usbh_xfer_isr( qhd_create_pipe_handle(p_qhd, xfer_type), - p_qhd->class_code, error_event); // call USBH callback + p_qhd->class_code, error_event, actual_bytes_xferred); // call USBH callback } } diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index f5689b07c..794fd3be7 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -236,7 +236,7 @@ tusb_interface_status_t usbh_pipe_status_get(pipe_handle_t pipe_hdl) // USBH-HCD ISR/Callback API //--------------------------------------------------------------------+ // interrupt caused by a TD (with IOC=1) in pipe of class class_code -void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event) +void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event, uint32_t xferred_bytes) { uint8_t class_index = std_class_code_to_index(class_code); if (TUSB_XFER_CONTROL == pipe_hdl.xfer_type) diff --git a/tinyusb/host/usbh_hcd.h b/tinyusb/host/usbh_hcd.h index c8b0a9f4a..cda043541 100644 --- a/tinyusb/host/usbh_hcd.h +++ b/tinyusb/host/usbh_hcd.h @@ -113,7 +113,7 @@ extern usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; // including //--------------------------------------------------------------------+ // callback from HCD ISR //--------------------------------------------------------------------+ -void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event); +void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event, uint32_t xferred_bytes); void usbh_device_plugged_isr(uint8_t hostid); void usbh_device_unplugged_isr(uint8_t hostid); |
