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

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

commit b3d0dca84e3c747e3a1d786e1854f54c9b440057
Author: Filipe Cavalcanti <[email protected]>
AuthorDate: Wed Sep 25 10:18:23 2024 -0300

    xtensa/esp32: fix cpuint debug asssertion bit mask
---
 arch/xtensa/include/esp32/irq.h   | 5 +++++
 arch/xtensa/src/esp32/esp32_irq.c | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/include/esp32/irq.h b/arch/xtensa/include/esp32/irq.h
index 05b273468f..7cc1311554 100644
--- a/arch/xtensa/include/esp32/irq.h
+++ b/arch/xtensa/include/esp32/irq.h
@@ -45,6 +45,11 @@
 #define ESP32_CPUINT_FLAG_SHARED  (1 << 2) /* Interrupt can be shared between 
ISRs */
 #define ESP32_CPUINT_FLAG_IRAM    (1 << 3) /* ISR can be called if cache is 
disabled */
 
+/* Trigger mask useful on debug assertion */
+
+#define ESP32_CPUINT_TRIGGER_MASK (ESP32_CPUINT_FLAG_LEVEL | \
+                                   ESP32_CPUINT_FLAG_EDGE)
+
 /* Interrupt Matrix
  *
  * The Interrupt Matrix embedded in the ESP32 independently allocates
diff --git a/arch/xtensa/src/esp32/esp32_irq.c 
b/arch/xtensa/src/esp32/esp32_irq.c
index f169ccf464..5490944452 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -393,8 +393,7 @@ static int esp32_alloc_cpuint(int cpu, int priority, int 
type)
 
   DEBUGASSERT(priority >= ESP32_MIN_PRIORITY &&
               priority <= ESP32_MAX_PRIORITY);
-  DEBUGASSERT(type == ESP32_CPUINT_LEVEL ||
-              type == ESP32_CPUINT_EDGE);
+  DEBUGASSERT(type & ESP32_CPUINT_TRIGGER_MASK);
 
   if ((type & (ESP32_CPUINT_LEVEL | ESP32_CPUINT_EDGE)) == 0)
     {

Reply via email to