1 #ifndef __ASM_CRIS_ARCH_ATOMIC__
2 #define __ASM_CRIS_ARCH_ATOMIC__
4 #include <asm/system.h>
6 extern void cris_spin_unlock(void *l, int val);
7 extern void cris_spin_lock(void *l);
8 extern int cris_spin_trylock(void* l);
11 #define cris_atomic_save(addr, flags) local_irq_save(flags);
12 #define cris_atomic_restore(addr, flags) local_irq_restore(flags);
15 extern spinlock_t cris_atomic_locks[];
16 #define LOCK_COUNT 128
17 #define HASH_ADDR(a) (((int)a) & 127)
19 #define cris_atomic_save(addr, flags) \
20 local_irq_save(flags); \
21 cris_spin_lock((void*)&cris_atomic_locks[HASH_ADDR(addr)].lock);
23 #define cris_atomic_restore(addr, flags) \
25 spinlock_t *lock = (void*)&cris_atomic_locks[HASH_ADDR(addr)]; \
26 __asm__ volatile ("move.d %1,%0" \
30 local_irq_restore(flags); \