00001 00038 #ifndef ARCH_INTERRUPT_H_INCLUDED 00039 #define ARCH_INTERRUPT_H_INCLUDED 00040 00041 #include <compiler.h> 00042 #include <cpu/regs.h> 00043 #include <types.h> 00044 00048 typedef uint8_t irqflags_t; 00049 00055 __always_inline static irqflags_t cpu_irq_save(void) 00056 { 00057 irqflags_t flags; 00058 00059 flags = cpu_read_reg8(SREG); 00060 cpu_irq_disable(); 00061 00062 return flags; 00063 } 00064 00069 __always_inline static void cpu_irq_restore(irqflags_t flags) 00070 { 00071 barrier(); 00072 cpu_write_reg8(SREG, flags); 00073 } 00074 00081 __always_inline static bool cpu_irq_is_enabled_flags(irqflags_t flags) 00082 { 00083 return (flags & CPUR_SREG_I); 00084 } 00085 00091 #define cpu_irq_is_enabled() \ 00092 cpu_irq_is_enabled_flags(cpu_read_reg8(SREG)) 00093 00094 #endif /* ARCH_INTERRUPT_H_INCLUDED */
1.6.3