Go to the documentation of this file. 1 #ifndef __ARCH_H8300_ATOMIC__
2 #define __ARCH_H8300_ATOMIC__
4 #include <linux/types.h>
5 #include <asm/cmpxchg.h>
12 #define ATOMIC_INIT(i) { (i) }
14 #define atomic_read(v) (*(volatile int *)&(v)->counter)
15 #define atomic_set(v, i) (((v)->counter) = i)
17 #include <linux/kernel.h>
29 #define atomic_add(i, v) atomic_add_return(i, v)
30 #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
42 #define atomic_sub(i, v) atomic_sub_return(i, v)
43 #define atomic_sub_and_test(i,v) (atomic_sub_return(i, v) == 0)
56 #define atomic_inc(v) atomic_inc_return(v)
66 #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
79 #define atomic_dec(v) atomic_dec_return(v)
105 static inline int __atomic_add_unless(
atomic_t *v,
int a,
int u)
120 __asm__ __volatile__(
"stc ccr,r1l\n\t"
126 :
"=m" (*v) :
"g" (~(mask)) :
"er0",
"er1");
131 __asm__ __volatile__(
"stc ccr,r1l\n\t"
137 :
"=m" (*v) :
"g" (mask) :
"er0",
"er1");
141 #define smp_mb__before_atomic_dec() barrier()
142 #define smp_mb__after_atomic_dec() barrier()
143 #define smp_mb__before_atomic_inc() barrier()
144 #define smp_mb__after_atomic_inc() barrier()