[riot-notifications] [RIOT-OS/RIOT] core: add irq_is_enabled() function to irq interface (#11117)

Marian Buschsieweke notifications at github.com
Tue Jun 29 11:02:41 CEST 2021


This might work for ESP (untested):

```diff
diff --git a/cpu/esp_common/irq_arch.c b/cpu/esp_common/irq_arch.c
index d6292baf8c..8cceaedd53 100644
--- a/cpu/esp_common/irq_arch.c
+++ b/cpu/esp_common/irq_arch.c
@@ -99,3 +99,16 @@ int IRAM irq_is_in(void)
     DEBUG("irq_interrupt_nesting = %d\n", irq_interrupt_nesting);
     return irq_interrupt_nesting;
 }
+
+int IRAM irq_is_enabled(void)
+{
+    unsigned ps_reg;
+    __asm__ volatile (
+        "rsr.ps     %[dest]"
+        : [dest]    "=r"    (ps_reg)
+        : /* no inputs */
+        : "memory"
+    );
+    unsigned irq_level = ps_reg & 0xf;
+    return (irq_level == 0);
+}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11117#issuecomment-870415216
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210629/00877663/attachment.htm>


More information about the notifications mailing list