WIP FPC-III support
[linux/fpc-iii.git] / arch / nios2 / include / asm / irqflags.h
blobb3ec3e510706d5560e9513b53f1576d7f3cfb6d5
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
4 */
5 #ifndef _ASM_IRQFLAGS_H
6 #define _ASM_IRQFLAGS_H
8 #include <asm/registers.h>
10 static inline unsigned long arch_local_save_flags(void)
12 return RDCTL(CTL_STATUS);
16 * This will restore ALL status register flags, not only the interrupt
17 * mask flag.
19 static inline void arch_local_irq_restore(unsigned long flags)
21 WRCTL(CTL_STATUS, flags);
24 static inline void arch_local_irq_disable(void)
26 unsigned long flags;
28 flags = arch_local_save_flags();
29 arch_local_irq_restore(flags & ~STATUS_PIE);
32 static inline void arch_local_irq_enable(void)
34 unsigned long flags;
36 flags = arch_local_save_flags();
37 arch_local_irq_restore(flags | STATUS_PIE);
40 static inline int arch_irqs_disabled_flags(unsigned long flags)
42 return (flags & STATUS_PIE) == 0;
45 static inline int arch_irqs_disabled(void)
47 return arch_irqs_disabled_flags(arch_local_save_flags());
50 static inline unsigned long arch_local_irq_save(void)
52 unsigned long flags;
54 flags = arch_local_save_flags();
55 arch_local_irq_restore(flags & ~STATUS_PIE);
56 return flags;
59 #endif /* _ASM_IRQFLAGS_H */