2 * C6X IRQ flag handling
4 * Copyright (C) 2010 Texas Instruments Incorporated
5 * Written by Mark Salter (msalter@redhat.com)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
13 #ifndef _ASM_IRQFLAGS_H
14 #define _ASM_IRQFLAGS_H
18 /* read interrupt enabled status */
19 static inline unsigned long arch_local_save_flags(void)
23 asm volatile (" mvc .s2 CSR,%0\n" : "=b"(flags
));
27 /* set interrupt enabled status */
28 static inline void arch_local_irq_restore(unsigned long flags
)
30 asm volatile (" mvc .s2 %0,CSR\n" : : "b"(flags
));
33 /* unconditionally enable interrupts */
34 static inline void arch_local_irq_enable(void)
36 unsigned long flags
= arch_local_save_flags();
38 arch_local_irq_restore(flags
);
41 /* unconditionally disable interrupts */
42 static inline void arch_local_irq_disable(void)
44 unsigned long flags
= arch_local_save_flags();
46 arch_local_irq_restore(flags
);
49 /* get status and disable interrupts */
50 static inline unsigned long arch_local_irq_save(void)
54 flags
= arch_local_save_flags();
55 arch_local_irq_restore(flags
& ~1);
60 static inline int arch_irqs_disabled_flags(unsigned long flags
)
62 return (flags
& 1) == 0;
65 /* test hardware interrupt enable bit */
66 static inline int arch_irqs_disabled(void)
68 return arch_irqs_disabled_flags(arch_local_save_flags());
71 #endif /* __ASSEMBLY__ */
72 #endif /* __ASM_IRQFLAGS_H */