summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-02-05 14:15:47 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-02-11 09:36:50 +0100
commitd7504f837286619ae5a7d9dea2c36d739b420875 (patch)
treed4b88296a8feeb6f11989985963d2091af1f620a
parentUpdate to FreeBSD stable/12 2019-02-04 (diff)
downloadrtems-libbsd-d7504f837286619ae5a7d9dea2c36d739b420875.tar.bz2
atomic.h: Add atomic_load_32()
-rw-r--r--rtemsbsd/include/machine/atomic.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/rtemsbsd/include/machine/atomic.h b/rtemsbsd/include/machine/atomic.h
index 052df5a7..eb9e3ccb 100644
--- a/rtemsbsd/include/machine/atomic.h
+++ b/rtemsbsd/include/machine/atomic.h
@@ -997,6 +997,27 @@ atomic_readandclear_32(volatile uint32_t *p)
}
static inline uint32_t
+atomic_load_32(volatile uint32_t *p)
+{
+ uint32_t tmp;
+
+#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC)
+ std::atomic_int *q =
+ reinterpret_cast<std::atomic_uint_least32_t *>(const_cast<uint32_t *>(p));
+
+ tmp = q->load(std::memory_order_relaxed);
+#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC)
+ atomic_uint_least32_t *q = (atomic_uint_least32_t *)RTEMS_DEVOLATILE(uint32_t *, p);
+
+ tmp = atomic_load_explicit(q, memory_order_relaxed);
+#else
+ tmp = *p;
+#endif
+
+ return (tmp);
+}
+
+static inline uint32_t
atomic_load_acq_32(volatile uint32_t *p)
{
uint32_t tmp;