You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/12/28 01:45:36 UTC

[nuttx] 02/04: esp32s2: Clear the timer interrupt to avoid losing the next one

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e67b968f1506bc82bd25f00c89c5f853ec7aa9cd
Author: Alan Carvalho de Assis <ac...@gmail.com>
AuthorDate: Tue Dec 27 16:39:39 2022 -0300

    esp32s2: Clear the timer interrupt to avoid losing the next one
---
 arch/xtensa/src/esp32s2/esp32s2_tim_lowerhalf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/xtensa/src/esp32s2/esp32s2_tim_lowerhalf.c b/arch/xtensa/src/esp32s2/esp32s2_tim_lowerhalf.c
index b481c783aa..9c1099ebf1 100644
--- a/arch/xtensa/src/esp32s2/esp32s2_tim_lowerhalf.c
+++ b/arch/xtensa/src/esp32s2/esp32s2_tim_lowerhalf.c
@@ -153,6 +153,8 @@ static int esp32s2_timer_handler(int irq, void *context, void *arg)
     (struct esp32s2_timer_lowerhalf_s *)arg;
   uint32_t next_interval_us = 0;
 
+  ESP32S2_TIM_ACKINT(priv->tim);        /* Clear the Interrupt */
+
   if (priv->callback(&next_interval_us, priv->upper))
     {
       if (next_interval_us > 0)
@@ -168,7 +170,6 @@ static int esp32s2_timer_handler(int irq, void *context, void *arg)
     }
 
   ESP32S2_TIM_SETALRM(priv->tim, true); /* Re-enables the alarm */
-  ESP32S2_TIM_ACKINT(priv->tim);        /* Clear the Interrupt */
   return OK;
 }