00001
00002
00003
00004 #ifndef __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__
00005 #define __L4UTIL__INCLUDE__ARCH_ARM__ATOMIC_ARCH_H__
00006
00007 #ifdef __GNUC__
00008
00009 #include <l4/sys/kdebug.h>
00010
00011 EXTERN_C_BEGIN
00012
00013 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG32
00014 L4_INLINE int
00015 l4util_cmpxchg32(volatile l4_uint32_t * dest,
00016 l4_uint32_t cmp_val, l4_uint32_t new_val)
00017 {
00018 return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
00019 }
00020
00021 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG
00022 L4_INLINE int
00023 l4util_cmpxchg(volatile l4_umword_t * dest,
00024 l4_umword_t cmp_val, l4_umword_t new_val)
00025 {
00026 return l4_atomic_cmpxchg((volatile long int *)dest, cmp_val, new_val);
00027 }
00028
00029 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG32_RES
00030 L4_INLINE l4_uint32_t
00031 l4util_cmpxchg32_res(volatile l4_uint32_t * dest,
00032 l4_uint32_t cmp_val, l4_uint32_t new_val)
00033 {
00034 return l4_atomic_cmpxchg_res((volatile long int *)dest, cmp_val, new_val);
00035 }
00036
00037 #define __L4UTIL_ATOMIC_HAVE_ARCH_CMPXCHG_RES
00038 L4_INLINE l4_umword_t
00039 l4util_cmpxchg_res(volatile l4_umword_t * dest,
00040 l4_umword_t cmp_val, l4_umword_t new_val)
00041 {
00042 return l4_atomic_cmpxchg_res((volatile long int *)dest, cmp_val, new_val);
00043 }
00044
00045 #define __L4UTIL_ATOMIC_HAVE_ARCH_ADD
00046 L4_INLINE void
00047 l4util_atomic_add(volatile long *dest, long val)
00048 {
00049 l4_atomic_add(dest, val);
00050 }
00051
00052 #define __L4UTIL_ATOMIC_HAVE_ARCH_INC
00053 L4_INLINE void
00054 l4util_atomic_inc(volatile long *dest)
00055 {
00056 l4_atomic_add(dest, 1);
00057 }
00058
00059 L4_INLINE void
00060 l4util_inc32(volatile l4_uint32_t *dest)
00061 {
00062 l4_atomic_add((volatile long int *)dest, 1);
00063 }
00064
00065 L4_INLINE void
00066 l4util_dec32(volatile l4_uint32_t *dest)
00067 {
00068 l4_atomic_add((volatile long int *)dest, -1);
00069 }
00070
00071 EXTERN_C_END
00072
00073 #endif //__GNUC__
00074
00075 #endif