stm32: Fix usbotg irq wakeup notification

The DAINTMSK prevents irqs but does not prevent the status reporting
in the GINTSTS and DAINT fields.  Thus, the mask bits should be
checked prior to sending a wakeup notification.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2023-04-14 23:59:34 -04:00
parent 10e816979e
commit 8b2074e068
1 changed files with 4 additions and 4 deletions

View File

@ -397,11 +397,11 @@ OTG_FS_IRQHandler(void)
} }
if (sts & USB_OTG_GINTSTS_IEPINT) { if (sts & USB_OTG_GINTSTS_IEPINT) {
// Can transmit data - disable irq and notify endpoint // Can transmit data - disable irq and notify endpoint
uint32_t daint = OTGD->DAINT; uint32_t daint = OTGD->DAINT, msk = OTGD->DAINTMSK, pend = daint & msk;
OTGD->DAINTMSK &= ~daint; OTGD->DAINTMSK = msk & ~daint;
if (daint & (1 << 0)) if (pend & (1 << 0))
usb_notify_ep0(); usb_notify_ep0();
if (daint & (1 << USB_CDC_EP_BULK_IN)) if (pend & (1 << USB_CDC_EP_BULK_IN))
usb_notify_bulk_in(); usb_notify_bulk_in();
} }
} }