From 70aa87fa213972cf1b9f0f751c1685cb4fcf7688 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Wed, 14 Oct 2026 16:14:37 +0800 Subject: fix(port/ehci): fix killed to zero by 6c40a28302 Signed-off-by: sakumisu <1203593632@qq.com> --- port/ehci/usb_hc_ehci.c | 8 ++++---- port/ehci/usb_hc_ehci.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c index 3cbdae17..eaef8aad 100644 --- a/port/ehci/usb_hc_ehci.c +++ b/port/ehci/usb_hc_ehci.c @@ -634,14 +634,13 @@ static void ehci_urb_waitup(struct usbh_bus *bus, struct usbh_urb *urb) qh = (struct ehci_qh_hw *)urb->hcpriv; + qh->remove_in_iaad = 0; + if (qh->killed == 1U) { qh->killed = 2U; return; } - qh->remove_in_iaad = 0; - qh->killed = 0; - #ifdef CONFIG_USB_DCACHE_ENABLE if (urb->transfer_buffer && ((urb->setup && urb->setup->bmRequestType & 0x80) || (urb->ep->bEndpointAddress & 0x80)) && @@ -1393,10 +1392,10 @@ int usbh_kill_urb(struct usbh_urb *urb) EHCI_HCOR->usbcmd |= (EHCI_USBCMD_PSEN | EHCI_USBCMD_ASEN); qh = (struct ehci_qh_hw *)urb->hcpriv; - qh->killed = 1U; urb->errorcode = -USB_ERR_SHUTDOWN; if (remove_in_iaad) { + qh->killed = 1U; /* trigger iaad isr and wait isr done */ qh->remove_in_iaad = 1; EHCI_HCOR->usbcmd |= EHCI_USBCMD_IAAD; usb_osal_leave_critical_section(flags); @@ -1410,6 +1409,7 @@ int usbh_kill_urb(struct usbh_urb *urb) return -USB_ERR_TIMEOUT; } } + qh->killed = 0; } else { usb_osal_leave_critical_section(flags); } diff --git a/port/ehci/usb_hc_ehci.h b/port/ehci/usb_hc_ehci.h index 918feb3e..8e040489 100644 --- a/port/ehci/usb_hc_ehci.h +++ b/port/ehci/usb_hc_ehci.h @@ -64,7 +64,7 @@ struct ehci_qh_hw { struct usbh_urb *urb; usb_osal_sem_t waitsem; uint8_t remove_in_iaad; - volatile uint8_t killed; + volatile uint8_t killed; /* only used in usbh_kill_urb */ } __attribute__((aligned(CONFIG_USB_EHCI_ALIGN_SIZE))); struct ehci_itd_hw { -- cgit v1.3.1