Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_GENERIC_IRQFLAGS_H
0003 #define __ASM_GENERIC_IRQFLAGS_H
0004 
0005 /*
0006  * All architectures should implement at least the first two functions,
0007  * usually inline assembly will be the best way.
0008  */
0009 #ifndef ARCH_IRQ_DISABLED
0010 #define ARCH_IRQ_DISABLED 0
0011 #define ARCH_IRQ_ENABLED 1
0012 #endif
0013 
0014 /* read interrupt enabled status */
0015 #ifndef arch_local_save_flags
0016 unsigned long arch_local_save_flags(void);
0017 #endif
0018 
0019 /* set interrupt enabled status */
0020 #ifndef arch_local_irq_restore
0021 void arch_local_irq_restore(unsigned long flags);
0022 #endif
0023 
0024 /* get status and disable interrupts */
0025 #ifndef arch_local_irq_save
0026 static inline unsigned long arch_local_irq_save(void)
0027 {
0028     unsigned long flags;
0029     flags = arch_local_save_flags();
0030     arch_local_irq_restore(ARCH_IRQ_DISABLED);
0031     return flags;
0032 }
0033 #endif
0034 
0035 /* test flags */
0036 #ifndef arch_irqs_disabled_flags
0037 static inline int arch_irqs_disabled_flags(unsigned long flags)
0038 {
0039     return flags == ARCH_IRQ_DISABLED;
0040 }
0041 #endif
0042 
0043 /* unconditionally enable interrupts */
0044 #ifndef arch_local_irq_enable
0045 static inline void arch_local_irq_enable(void)
0046 {
0047     arch_local_irq_restore(ARCH_IRQ_ENABLED);
0048 }
0049 #endif
0050 
0051 /* unconditionally disable interrupts */
0052 #ifndef arch_local_irq_disable
0053 static inline void arch_local_irq_disable(void)
0054 {
0055     arch_local_irq_restore(ARCH_IRQ_DISABLED);
0056 }
0057 #endif
0058 
0059 /* test hardware interrupt enable bit */
0060 #ifndef arch_irqs_disabled
0061 static inline int arch_irqs_disabled(void)
0062 {
0063     return arch_irqs_disabled_flags(arch_local_save_flags());
0064 }
0065 #endif
0066 
0067 #endif /* __ASM_GENERIC_IRQFLAGS_H */