1 #ifndef _H8300_IRQFLAGS_H 2 #define _H8300_IRQFLAGS_H 3 arch_local_save_flags(void)4static inline unsigned long arch_local_save_flags(void) 5 { 6 unsigned long flags; 7 asm volatile ("stc ccr,%w0" : "=r" (flags)); 8 return flags; 9 } 10 arch_local_irq_disable(void)11static inline void arch_local_irq_disable(void) 12 { 13 asm volatile ("orc #0x80,ccr" : : : "memory"); 14 } 15 arch_local_irq_enable(void)16static inline void arch_local_irq_enable(void) 17 { 18 asm volatile ("andc #0x7f,ccr" : : : "memory"); 19 } 20 arch_local_irq_save(void)21static inline unsigned long arch_local_irq_save(void) 22 { 23 unsigned long flags = arch_local_save_flags(); 24 arch_local_irq_disable(); 25 return flags; 26 } 27 arch_local_irq_restore(unsigned long flags)28static inline void arch_local_irq_restore(unsigned long flags) 29 { 30 asm volatile ("ldc %w0,ccr" : : "r" (flags) : "memory"); 31 } 32 arch_irqs_disabled_flags(unsigned long flags)33static inline bool arch_irqs_disabled_flags(unsigned long flags) 34 { 35 return (flags & 0x80) == 0x80; 36 } 37 arch_irqs_disabled(void)38static inline bool arch_irqs_disabled(void) 39 { 40 return arch_irqs_disabled_flags(arch_local_save_flags()); 41 } 42 43 #endif /* _H8300_IRQFLAGS_H */ 44