From db9c410f10474a5998869d447565f9089c69ccff Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 20 Aug 2012 15:09:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4592 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/OTGv1/usb_lld.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'os') diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c index 2653698fd..ef59199c2 100644 --- a/os/hal/platforms/STM32/OTGv1/usb_lld.c +++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c @@ -114,6 +114,14 @@ static const stm32_otg_params_t hsparams = { /* Driver local functions. */ /*===========================================================================*/ +static void usb_lld_wakeup_pump(USBDriver *usbp) { + + if (usbp->thd_wait != NULL) { + chThdResumeI(usbp->thd_wait); + usbp->thd_wait = NULL; + } +} + static void otg_core_reset(stm32_otg_t *otgp) { /* Core reset and delay of at least 3 PHY cycles.*/ @@ -546,10 +554,7 @@ static void otg_epin_handler(USBDriver *usbp, usbep_t ep) { chSysLockFromIsr(); usbp->txpending |= (1 << ep); otgp->DIEPEMPMSK &= ~(1 << ep); - if (usbp->thd_wait != NULL) { - chThdResumeI(usbp->thd_wait); - usbp->thd_wait = NULL; - } + usb_lld_wakeup_pump(usbp); chSysUnlockFromIsr(); } } @@ -615,14 +620,9 @@ static void usb_lld_serve_interrupt(USBDriver *usbp) { if (sts & GINTSTS_RXFLVL) { /* The interrupt is masked while the thread has control or it would be triggered again.*/ - otgp->GINTMSK &= ~GINTMSK_RXFLVLM; - /* Checks if the thread is waiting for an event.*/ chSysLockFromIsr(); - if (usbp->thd_wait != NULL) { - /* The thread is made ready, it will be scheduled on ISR exit.*/ - chThdResumeI(usbp->thd_wait); - usbp->thd_wait = NULL; - } + otgp->GINTMSK &= ~GINTMSK_RXFLVLM; + usb_lld_wakeup_pump(usbp); chSysUnlockFromIsr(); } -- cgit v1.2.3