usb_f103: Clear ISR bit as soon as possible, as for the other IRQs.

Reported by Uwe in https://github.com/libopencm3/libopencm3/pull/274 but
expanded and provided by BuFran finally.
This commit is contained in:
Frantisek Burian 2014-12-19 00:34:01 +01:00 committed by Karl Palsson
parent a4bb8f7e24
commit 13004f81ee

View File

@ -300,9 +300,9 @@ static void stm32f103_poll(usbd_device *dev)
uint16_t istr = *USB_ISTR_REG; uint16_t istr = *USB_ISTR_REG;
if (istr & USB_ISTR_RESET) { if (istr & USB_ISTR_RESET) {
USB_CLR_ISTR_RESET();
dev->pm_top = 0x40; dev->pm_top = 0x40;
_usbd_reset(dev); _usbd_reset(dev);
USB_CLR_ISTR_RESET();
return; return;
} }
@ -338,9 +338,9 @@ static void stm32f103_poll(usbd_device *dev)
} }
if (istr & USB_ISTR_SOF) { if (istr & USB_ISTR_SOF) {
USB_CLR_ISTR_SOF();
if (dev->user_callback_sof) { if (dev->user_callback_sof) {
dev->user_callback_sof(); dev->user_callback_sof();
} }
USB_CLR_ISTR_SOF();
} }
} }