summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-05-11 14:26:12 +0700
committerhathach <[email protected]>2023-05-16 11:09:21 +0700
commit206d63e038744b228cfa6051d701cab50b520fe6 (patch)
tree602da2f1181946ced8114784d85510de02098efd /src/portable
parente2d3c0b2d3905a5194abb7bb8894e8b6b9c9b7e4 (diff)
correct EHCI reporting failed xfer (instead of stalled) when device is unplugged
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/ehci/ehci.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c
index 494e2e50f..69e59ce65 100644
--- a/src/portable/ehci/ehci.c
+++ b/src/portable/ehci/ehci.c
@@ -142,8 +142,11 @@ static inline ehci_qhd_t* qhd_get_from_addr (uint8_t dev_addr, uint8_t ep_addr);
// determine if a queue head has bus-related error
static inline bool qhd_has_xact_error (ehci_qhd_t * p_qhd)
{
- return (p_qhd->qtd_overlay.buffer_err || p_qhd->qtd_overlay.babble_err || p_qhd->qtd_overlay.xact_err);
- //p_qhd->qtd_overlay.non_hs_period_missed_uframe || p_qhd->qtd_overlay.pingstate_err TODO split transaction error
+ volatile ehci_qtd_t *qtd_overlay = &p_qhd->qtd_overlay;
+
+ // Error count = 0 often occurs when device disconnected
+ return (qtd_overlay->err_count == 0 || qtd_overlay->buffer_err || qtd_overlay->babble_err || qtd_overlay->xact_err);
+ //qtd_overlay->non_hs_period_missed_uframe || qtd_overlay->pingstate_err TODO split transaction error
}
static void qhd_init(ehci_qhd_t *p_qhd, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc);
@@ -630,7 +633,9 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd)
p_qhd->total_xferred_bytes += p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes;
-// if ( XFER_RESULT_FAILED == error_event ) TU_BREAKPOINT(); // TODO skip unplugged device
+// if ( XFER_RESULT_FAILED == error_event ) {
+// TU_BREAKPOINT(); // TODO skip unplugged device
+// }
p_qhd->p_qtd_list_head->used = 0; // free QTD
qtd_remove_1st_from_qhd(p_qhd);