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

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


The following commit(s) were added to refs/heads/master by this push:
     new d934557ed3e include/nuttx/irq.h: add irq_save/irq_restore
d934557ed3e is described below

commit d934557ed3ebc9c2ec644436ab541730d03962b4
Author: wangzhi16 <[email protected]>
AuthorDate: Mon Nov 16 15:12:41 2026 +0800

    include/nuttx/irq.h: add irq_save/irq_restore
    
    Add irq_save()/irq_restore() as the architecture-independent way for code
    outside arch/ to disable and restore local interrupts.  They map to
    up_irq_save()/up_irq_restore() and give one place to hook IRQ-disabled
    time monitoring later.
    
    The lock-free ring in include/nuttx/ring.h is the first user.  Existing
    up_irq_save() callers are left as they are.
    
    Signed-off-by: wangzhi16 <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 include/nuttx/irq.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h
index 566d7d2b6b2..28495e1f1a8 100644
--- a/include/nuttx/irq.h
+++ b/include/nuttx/irq.h
@@ -136,6 +136,13 @@
 
 #define IRQ_WAKE_THREAD 1
 
+/* Disable/restore local interrupts from code above the arch layer */
+
+#ifndef __ASSEMBLY__
+#  define irq_save()          up_irq_save()
+#  define irq_restore(flags)  up_irq_restore(flags)
+#endif
+
 /* Scheduling monitor */
 
 #ifndef CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD

Reply via email to