arm: add nvic_disable_irq_sync()

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 02d317a3f47853f6d2c4338a90257739cddd5b41
Author: Aidan MacDonald <[email protected]>
Date:   Sat Feb 7 14:20:06 2026 +0000

    arm: add nvic_disable_irq_sync()
    
    Disabling an IRQ in the NVIC may not take effect right away;
    if the IRQ is being disabled to implement a critical section
    it's necessary to follow up with dsb + isb to serialize the
    NVIC update. Add a helper function for doing this.
    
    Change-Id: Iaaa238ad39997cc3c6d62867d265cf9e9e0e5c4b

diff --git a/firmware/target/arm/nvic-arm.h b/firmware/target/arm/nvic-arm.h
index 57a16f43aa..f695279e8c 100644
--- a/firmware/target/arm/nvic-arm.h
+++ b/firmware/target/arm/nvic-arm.h
@@ -43,6 +43,13 @@ static inline void nvic_disable_irq(int nr)
     reg_var(CM_NVIC_ICER(reg)) = BIT_N(bit);
 }
 
+static inline void nvic_disable_irq_sync(int nr)
+{
+    nvic_disable_irq(nr);
+    arm_dsb();
+    arm_isb();
+}
+
 static inline void nvic_set_pending_irq(int nr)
 {
     int reg = nr / 32;
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.