sam7fc/include/atomic.h

27 lines
581 B
C
Raw Normal View History

2008-02-03 21:41:39 +01:00
#ifndef ATOMIC_H_
#define ATOMIC_H_
//TODO: not for thumbcode?!
#define disable_irqs() \
{ \
int temp_; \
asm volatile ( \
"mrs %0, cpsr" "\n\t" \
"stmfd sp!, {%0}" "\n\t" \
"orr %0, %0, #0xC0" "\n\t" \
"msr cpsr, %0" "\n\t" \
: "=r" (temp_) : ); \
}
#define restore_irqs() \
{ \
int temp_; \
asm volatile ( \
"ldmfd sp!, {%0}" "\n\t" \
"msr cpsr, %0" "\n\t" \
: "=r" (temp_) : ); \
}
#endif /*ATOMIC_H_*/