summaryrefslogtreecommitdiff
path: root/core/cortex-m
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2022-03-04 11:47:37 +0100
committerCommit Bot <commit-bot@chromium.org>2022-03-09 09:49:29 +0000
commitc755fffea0e2e05733e61ea254d820612e869b7a (patch)
tree6c92d6c062de5d1d9ac16f576d34023588ee9b46 /core/cortex-m
parent3f1fe1e185c05c8037576466d246945be385973d (diff)
downloadchrome-ec-c755fffea0e2e05733e61ea254d820612e869b7a.tar.gz
atomic: add atomic_and function
Add atomic_and functions for all cores. The functions will be used for more complex atomic operations for bits manipulating that will be merged in a following CL. BRANCH=none BUG=b:208435177 TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I659ee8214206750fbe8af4df21672d8cbfc59278 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500418 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
Diffstat (limited to 'core/cortex-m')
-rw-r--r--core/cortex-m/atomic.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/cortex-m/atomic.h b/core/cortex-m/atomic.h
index ce183465e8..a09f5cc8be 100644
--- a/core/cortex-m/atomic.h
+++ b/core/cortex-m/atomic.h
@@ -36,4 +36,9 @@ static inline atomic_val_t atomic_clear(atomic_t *addr)
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
}
+static inline atomic_val_t atomic_and(atomic_t *addr, atomic_val_t bits)
+{
+ return __atomic_fetch_and(addr, bits, __ATOMIC_SEQ_CST);
+}
+
#endif /* __CROS_EC_ATOMIC_H */