Path: blob/master/arch/avr32/include/asm/irqflags.h
10818 views
/*1* Copyright (C) 2004-2006 Atmel Corporation2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License version 2 as5* published by the Free Software Foundation.6*/7#ifndef __ASM_AVR32_IRQFLAGS_H8#define __ASM_AVR32_IRQFLAGS_H910#include <linux/types.h>11#include <asm/sysreg.h>1213static inline unsigned long arch_local_save_flags(void)14{15return sysreg_read(SR);16}1718/*19* This will restore ALL status register flags, not only the interrupt20* mask flag.21*22* The empty asm statement informs the compiler of this fact while23* also serving as a barrier.24*/25static inline void arch_local_irq_restore(unsigned long flags)26{27sysreg_write(SR, flags);28asm volatile("" : : : "memory", "cc");29}3031static inline void arch_local_irq_disable(void)32{33asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");34}3536static inline void arch_local_irq_enable(void)37{38asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");39}4041static inline bool arch_irqs_disabled_flags(unsigned long flags)42{43return (flags & SYSREG_BIT(GM)) != 0;44}4546static inline bool arch_irqs_disabled(void)47{48return arch_irqs_disabled_flags(arch_local_save_flags());49}5051static inline unsigned long arch_local_irq_save(void)52{53unsigned long flags = arch_local_save_flags();5455arch_local_irq_disable();5657return flags;58}5960#endif /* __ASM_AVR32_IRQFLAGS_H */616263