From 733166973d4dc88521555e14d4bb118f62989bbc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 10 Aug 2012 14:01:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4551 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/icu_lld.c | 2 +- os/hal/platforms/STM32/pwm_lld.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'os/hal') diff --git a/os/hal/platforms/STM32/icu_lld.c b/os/hal/platforms/STM32/icu_lld.c index 8e546d80d..82fb39769 100644 --- a/os/hal/platforms/STM32/icu_lld.c +++ b/os/hal/platforms/STM32/icu_lld.c @@ -104,7 +104,7 @@ static void icu_lld_serve_interrupt(ICUDriver *icup) { uint16_t sr; sr = icup->tim->SR & icup->tim->DIER; - icup->tim->SR = 0; + icup->tim->SR = ~sr; if (icup->config->channel == ICU_CHANNEL_1) { if ((sr & TIM_SR_CC1IF) != 0) _icu_isr_invoke_period_cb(icup); diff --git a/os/hal/platforms/STM32/pwm_lld.c b/os/hal/platforms/STM32/pwm_lld.c index 0fd66d168..dcd0d166f 100644 --- a/os/hal/platforms/STM32/pwm_lld.c +++ b/os/hal/platforms/STM32/pwm_lld.c @@ -101,13 +101,11 @@ PWMDriver PWMD8; * * @param[in] pwmp pointer to a @p PWMDriver object */ -static void serve_interrupt(PWMDriver *pwmp) { +static void pwm_lld_serve_interrupt(PWMDriver *pwmp) { uint16_t sr; - sr = pwmp->tim->SR; - sr &= pwmp->tim->DIER; - pwmp->tim->SR = ~(TIM_SR_CC1IF | TIM_SR_CC2IF | TIM_SR_CC3IF | - TIM_SR_CC4IF | TIM_SR_UIF); + sr = pwmp->tim->SR & pwmp->tim->DIER; + pwmp->tim->SR = ~sr; if ((sr & TIM_SR_CC1IF) != 0) pwmp->config->channels[0].callback(pwmp); if ((sr & TIM_SR_CC2IF) != 0) @@ -192,7 +190,7 @@ CH_IRQ_HANDLER(STM32_TIM2_HANDLER) { CH_IRQ_PROLOGUE(); - serve_interrupt(&PWMD2); + pwm_lld_serve_interrupt(&PWMD2); CH_IRQ_EPILOGUE(); } @@ -211,7 +209,7 @@ CH_IRQ_HANDLER(STM32_TIM3_HANDLER) { CH_IRQ_PROLOGUE(); - serve_interrupt(&PWMD3); + pwm_lld_serve_interrupt(&PWMD3); CH_IRQ_EPILOGUE(); } @@ -230,7 +228,7 @@ CH_IRQ_HANDLER(STM32_TIM4_HANDLER) { CH_IRQ_PROLOGUE(); - serve_interrupt(&PWMD4); + pwm_lld_serve_interrupt(&PWMD4); CH_IRQ_EPILOGUE(); } @@ -249,7 +247,7 @@ CH_IRQ_HANDLER(STM32_TIM5_HANDLER) { CH_IRQ_PROLOGUE(); - serve_interrupt(&PWMD5); + pwm_lld_serve_interrupt(&PWMD5); CH_IRQ_EPILOGUE(); } -- cgit v1.2.3