summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-05-11 18:11:46 +0700
committerhathach <[email protected]>2021-05-18 12:58:24 +0700
commit13613eafb70acd028572305b3e0b9064f905b835 (patch)
treebc8b219196bd18c3f0d2ca626b20bb93fb352f6c /src/portable
parent3a7f8b3ac3988eeb653ada6e3efdd7acb68fbe0f (diff)
correct ehci control endpoint address report on xfer complete
improve host log
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/ehci/ehci.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c
index 484e49600..eab1f8928 100644
--- a/src/portable/ehci/ehci.c
+++ b/src/portable/ehci/ehci.c
@@ -513,18 +513,19 @@ static void qhd_xfer_complete_isr(ehci_qhd_t * p_qhd)
// free all TDs from the head td to the first active TD
while(p_qhd->p_qtd_list_head != NULL && !p_qhd->p_qtd_list_head->active)
{
- // TD need to be freed and removed from qhd, before invoking callback
- bool is_ioc = (p_qhd->p_qtd_list_head->int_on_complete != 0);
- p_qhd->total_xferred_bytes += p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes;
+ ehci_qtd_t * volatile qtd = (ehci_qtd_t * volatile) p_qhd->p_qtd_list_head;
+ bool const is_ioc = (qtd->int_on_complete != 0);
+ uint8_t const ep_addr = tu_edpt_addr(p_qhd->ep_number, qtd->pid == EHCI_PID_IN ? 1 : 0);
- p_qhd->p_qtd_list_head->used = 0; // free QTD
+ p_qhd->total_xferred_bytes += qtd->expected_bytes - qtd->total_bytes;
+
+ // TD need to be freed and removed from qhd, before invoking callback
+ qtd->used = 0; // free QTD
qtd_remove_1st_from_qhd(p_qhd);
if (is_ioc)
{
- // end of request
- // call USBH callback
- hcd_event_xfer_complete(p_qhd->dev_addr, tu_edpt_addr(p_qhd->ep_number, p_qhd->pid == EHCI_PID_IN ? 1 : 0), p_qhd->total_xferred_bytes, XFER_RESULT_SUCCESS, true);
+ hcd_event_xfer_complete(p_qhd->dev_addr, ep_addr, p_qhd->total_xferred_bytes, XFER_RESULT_SUCCESS, true);
p_qhd->total_xferred_bytes = 0;
}
}