Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
irqflags.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004-2006 Atmel Corporation
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8 #ifndef __ASM_AVR32_IRQFLAGS_H
9 #define __ASM_AVR32_IRQFLAGS_H
10 
11 #include <linux/types.h>
12 #include <asm/sysreg.h>
13 
14 static inline unsigned long arch_local_save_flags(void)
15 {
16  return sysreg_read(SR);
17 }
18 
19 /*
20  * This will restore ALL status register flags, not only the interrupt
21  * mask flag.
22  *
23  * The empty asm statement informs the compiler of this fact while
24  * also serving as a barrier.
25  */
26 static inline void arch_local_irq_restore(unsigned long flags)
27 {
28  sysreg_write(SR, flags);
29  asm volatile("" : : : "memory", "cc");
30 }
31 
32 static inline void arch_local_irq_disable(void)
33 {
34  asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
35 }
36 
37 static inline void arch_local_irq_enable(void)
38 {
39  asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
40 }
41 
42 static inline bool arch_irqs_disabled_flags(unsigned long flags)
43 {
44  return (flags & SYSREG_BIT(GM)) != 0;
45 }
46 
47 static inline bool arch_irqs_disabled(void)
48 {
50 }
51 
52 static inline unsigned long arch_local_irq_save(void)
53 {
54  unsigned long flags = arch_local_save_flags();
55 
57 
58  return flags;
59 }
60 
61 #endif /* __ASM_AVR32_IRQFLAGS_H */