2 * interface to Blackfin CEC
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
8 #ifndef __ASM_BFIN_IRQFLAGS_H__
9 #define __ASM_BFIN_IRQFLAGS_H__
13 # include <asm/processor.h>
14 /* Forward decl needed due to cdef inter dependencies */
15 static inline uint32_t __pure bfin_dspid(void);
16 # define blackfin_core_id() (bfin_dspid() & 0xff)
17 # define bfin_irq_flags cpu_pda[blackfin_core_id()].imask
19 extern unsigned long bfin_irq_flags;
22 static inline void bfin_sti(unsigned long flags)
24 asm volatile("sti %0;" : : "d" (flags));
27 static inline unsigned long bfin_cli(void)
30 asm volatile("cli %0;" : "=d" (flags));
34 static inline void raw_local_irq_disable(void)
38 static inline void raw_local_irq_enable(void)
40 bfin_sti(bfin_irq_flags);
43 #define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0)
45 #define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
47 static inline void raw_local_irq_restore(unsigned long flags)
49 if (!raw_irqs_disabled_flags(flags))
50 raw_local_irq_enable();
53 static inline unsigned long __raw_local_irq_save(void)
55 unsigned long flags = bfin_cli();
56 #ifdef CONFIG_DEBUG_HWERR
61 #define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0)