diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2023-04-14 23:59:34 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2023-04-24 11:29:43 -0400 |
commit | 8b2074e068b661fcc91ba7d70fe239a4b08fa0e5 (patch) | |
tree | e6962ce1299411d9c50cb09c72eecc62201cf85d /src/stm32 | |
parent | 10e816979e628784ee0b9fe2bc76b2d3f7cc9d50 (diff) | |
download | kutter-8b2074e068b661fcc91ba7d70fe239a4b08fa0e5.tar.gz kutter-8b2074e068b661fcc91ba7d70fe239a4b08fa0e5.tar.xz kutter-8b2074e068b661fcc91ba7d70fe239a4b08fa0e5.zip |
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>
Diffstat (limited to 'src/stm32')
-rw-r--r-- | src/stm32/usbotg.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/stm32/usbotg.c b/src/stm32/usbotg.c index b61c99ca..74829256 100644 --- a/src/stm32/usbotg.c +++ b/src/stm32/usbotg.c @@ -397,11 +397,11 @@ OTG_FS_IRQHandler(void) } if (sts & USB_OTG_GINTSTS_IEPINT) { // Can transmit data - disable irq and notify endpoint - uint32_t daint = OTGD->DAINT; - OTGD->DAINTMSK &= ~daint; - if (daint & (1 << 0)) + uint32_t daint = OTGD->DAINT, msk = OTGD->DAINTMSK, pend = daint & msk; + OTGD->DAINTMSK = msk & ~daint; + if (pend & (1 << 0)) usb_notify_ep0(); - if (daint & (1 << USB_CDC_EP_BULK_IN)) + if (pend & (1 << USB_CDC_EP_BULK_IN)) usb_notify_bulk_in(); } } |