[alsa-devel] [PATCH] add atomic operations for Blackfin parts

Mike Frysinger vapier at gentoo.org
Sun Jan 17 22:55:03 CET 2010


Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 include/iatomic.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/iatomic.h b/include/iatomic.h
index 8f6ec22..e92dbfd 100644
--- a/include/iatomic.h
+++ b/include/iatomic.h
@@ -1079,6 +1079,29 @@ static __inline__ int atomic_sub_return(int i, volatile atomic_t *v)
 
 #endif /* __sh__ */
 
+#ifdef __bfin__
+
+#include <bfin_fixed_code.h>
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i)   { (i) }
+
+#define atomic_read(v)   ((v)->counter)
+#define atomic_set(v,i)  (((v)->counter) = (i))
+#define atomic_add(i,v)  bfin_atomic_add32(&(v)->counter, i)
+#define atomic_sub(i,v)  bfin_atomic_sub32(&(v)->counter, i)
+#define atomic_inc(v)    bfin_atomic_inc32(&(v)->counter);
+#define atomic_dec(v)    bfin_atomic_dec32(&(v)->counter);
+
+#define mb() __asm__ __volatile__ ("" : : : "memory")
+#define rmb() mb()
+#define wmb() mb()
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __bfin__ */
+
 #ifndef IATOMIC_DEFINED
 /*
  * non supported architecture.
-- 
1.6.6



More information about the Alsa-devel mailing list