From 7a0e8cae1a63986a102501309ce82de4c93d12bc Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sat, 10 May 2025 17:48:34 +0800 Subject: [PATCH] update(port/musb/usb_hc_musb): flush and disable ep intr in usbh_kill_urb Signed-off-by: sakumisu <1203593632@qq.com> --- port/musb/usb_hc_musb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index 4dc7a4bb..3de4ef36 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -766,6 +766,16 @@ int usbh_kill_urb(struct usbh_urb *urb) urb->errorcode = -USB_ERR_SHUTDOWN; pipe->urb = NULL; + if (urb->ep->bEndpointAddress & 0x80) { + HWREGH(USB_BASE + MUSB_RXIE_OFFSET) &= ~(1 << (urb->ep->bEndpointAddress & 0x0f)); + HWREGH(USB_BASE + MUSB_RXIS_OFFSET) = (1 << (urb->ep->bEndpointAddress & 0x0f)); + } else { + HWREGH(USB_BASE + MUSB_TXIE_OFFSET) &= ~(1 << (urb->ep->bEndpointAddress & 0x0f)); + HWREGH(USB_BASE + MUSB_TXIS_OFFSET) = (1 << (urb->ep->bEndpointAddress & 0x0f)); + } + + musb_fifo_flush(bus, urb->ep->bEndpointAddress); + if (urb->timeout) { usb_osal_sem_give(pipe->waitsem); } else {