Skip to content

Commit 70aa87f

Browse files
committed
fix(port/ehci): fix killed to zero by 6c40a28
Signed-off-by: sakumisu <1203593632@qq.com>
1 parent cc6003b commit 70aa87f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎port/ehci/usb_hc_ehci.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,14 +634,13 @@ static void ehci_urb_waitup(struct usbh_bus *bus, struct usbh_urb *urb)
634634

635635
qh = (struct ehci_qh_hw *)urb->hcpriv;
636636

637+
qh->remove_in_iaad = 0;
638+
637639
if (qh->killed == 1U) {
638640
qh->killed = 2U;
639641
return;
640642
}
641643

642-
qh->remove_in_iaad = 0;
643-
qh->killed = 0;
644-
645644
#ifdef CONFIG_USB_DCACHE_ENABLE
646645
if (urb->transfer_buffer &&
647646
((urb->setup && urb->setup->bmRequestType & 0x80) || (urb->ep->bEndpointAddress & 0x80)) &&
@@ -1393,10 +1392,10 @@ int usbh_kill_urb(struct usbh_urb *urb)
13931392
EHCI_HCOR->usbcmd |= (EHCI_USBCMD_PSEN | EHCI_USBCMD_ASEN);
13941393

13951394
qh = (struct ehci_qh_hw *)urb->hcpriv;
1396-
qh->killed = 1U;
13971395
urb->errorcode = -USB_ERR_SHUTDOWN;
13981396

13991397
if (remove_in_iaad) {
1398+
qh->killed = 1U; /* trigger iaad isr and wait isr done */
14001399
qh->remove_in_iaad = 1;
14011400
EHCI_HCOR->usbcmd |= EHCI_USBCMD_IAAD;
14021401
usb_osal_leave_critical_section(flags);
@@ -1410,6 +1409,7 @@ int usbh_kill_urb(struct usbh_urb *urb)
14101409
return -USB_ERR_TIMEOUT;
14111410
}
14121411
}
1412+
qh->killed = 0;
14131413
} else {
14141414
usb_osal_leave_critical_section(flags);
14151415
}

‎port/ehci/usb_hc_ehci.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct ehci_qh_hw {
6464
struct usbh_urb *urb;
6565
usb_osal_sem_t waitsem;
6666
uint8_t remove_in_iaad;
67-
volatile uint8_t killed;
67+
volatile uint8_t killed; /* only used in usbh_kill_urb */
6868
} __attribute__((aligned(CONFIG_USB_EHCI_ALIGN_SIZE)));
6969

7070
struct ehci_itd_hw {

0 commit comments

Comments
 (0)