• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2005-2017 Andes Technology Corporation
3 
4 #include <asm/nds32.h>
5 #include <nds32_intrinsic.h>
6 
7 #define arch_local_irq_disable()	\
8 	GIE_DISABLE();
9 
10 #define arch_local_irq_enable()	\
11 	GIE_ENABLE();
arch_local_irq_save(void)12 static inline unsigned long arch_local_irq_save(void)
13 {
14 	unsigned long flags;
15 	flags = __nds32__mfsr(NDS32_SR_PSW) & PSW_mskGIE;
16 	GIE_DISABLE();
17 	return flags;
18 }
19 
arch_local_save_flags(void)20 static inline unsigned long arch_local_save_flags(void)
21 {
22 	unsigned long flags;
23 	flags = __nds32__mfsr(NDS32_SR_PSW) & PSW_mskGIE;
24 	return flags;
25 }
26 
arch_local_irq_restore(unsigned long flags)27 static inline void arch_local_irq_restore(unsigned long flags)
28 {
29 	if(flags)
30 		GIE_ENABLE();
31 }
32 
arch_irqs_disabled_flags(unsigned long flags)33 static inline int arch_irqs_disabled_flags(unsigned long flags)
34 {
35 	return !flags;
36 }
37 
arch_irqs_disabled(void)38 static inline int arch_irqs_disabled(void)
39 {
40 	return arch_irqs_disabled_flags(arch_local_save_flags());
41 }
42