summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2022-01-30 17:31:05 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2022-04-16 21:37:28 +0200
commit1d1072825c0c2cfaecae74f93a9ede50bbfefa31 (patch)
tree28a1067332dc1ed70391abd3cd9c65fefc273532
parent5e3480f8ffe976aefb7bd1fe7ca2434ee0146a82 (diff)
WIP: stm32_hsem: lock get/release helpers
-rw-r--r--wpan/stm32_hsem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/wpan/stm32_hsem.h b/wpan/stm32_hsem.h
index f8d9dd3..7cac70c 100644
--- a/wpan/stm32_hsem.h
+++ b/wpan/stm32_hsem.h
@@ -23,4 +23,12 @@ template <typename T>
class STM32_HSEM_t : public mmio_ptr<T> {
public:
using mmio_ptr<T>::ptr;
+
+ bool get_lock_1step(uint32_t sem) const {
+ return ptr()->RLR[sem] == (uint32_t)((1<<31) | (4<<8)); // cpu1 coreid
+ }
+
+ void release(uint32_t sem, uint32_t process) const {
+ ptr()->R[sem] = (4<<8) | process; // cpu1 coreid
+ }
}; \ No newline at end of file