From 24ce8dfbf20b684abb940b97b006415abbb686c4 Mon Sep 17 00:00:00 2001 From: guoshichao Date: Wed, 7 Feb 2024 11:39:41 +0800 Subject: [PATCH] armv7-a/irq: add up_irq_disable method implementation Signed-off-by: guoshichao (cherry picked from commit 7059b05e501d67c342f1753e8eb96e723b99d6b8) --- arch/arm/include/armv7-a/irq.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/include/armv7-a/irq.h b/arch/arm/include/armv7-a/irq.h index 941a02f7dd..a158e056db 100644 --- a/arch/arm/include/armv7-a/irq.h +++ b/arch/arm/include/armv7-a/irq.h @@ -394,6 +394,24 @@ static inline irqstate_t up_irq_enable(void) return cpsr; } +/* Disable IRQs and return the previous IRQ state */ + +static inline irqstate_t up_irq_disable(void) +{ + unsigned int cpsr; + + __asm__ __volatile__ + ( + "\tmrs %0, cpsr\n" + "\tcpsid i\n" + : "=r" (cpsr) + : + : "memory" + ); + + return cpsr; +} + /* Restore saved IRQ & FIQ state */ noinstrument_function static inline void up_irq_restore(irqstate_t flags)