From 1d1072825c0c2cfaecae74f93a9ede50bbfefa31 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Sun, 30 Jan 2022 16:31:05 +0000 Subject: WIP: stm32_hsem: lock get/release helpers --- wpan/stm32_hsem.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'wpan') 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 class STM32_HSEM_t : public mmio_ptr { public: using mmio_ptr::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 -- cgit v1.2.3