pub struct HardwareSemaphoreChannel<'a, T: Instance> { /* private fields */ }Expand description
Hardware semaphore channel
Implementations§
Source§impl<'a, T: Instance> HardwareSemaphoreChannel<'a, T>
impl<'a, T: Instance> HardwareSemaphoreChannel<'a, T>
Sourcepub async fn fast_lock(&mut self) -> HardwareSemaphoreMutex<'a, T>
pub async fn fast_lock(&mut self) -> HardwareSemaphoreMutex<'a, T>
Asynchronously lock a hardware semaphore with 1-step lock procedure and interrupts This lock does not use process ID, and should only be used to synchronize between cores. Locking a 1 step lock from the same AHB bus master ID will read the semaphore as locked
Sourcepub async fn lock(&mut self, process_id: u8) -> HardwareSemaphoreMutex<'a, T>
pub async fn lock(&mut self, process_id: u8) -> HardwareSemaphoreMutex<'a, T>
Asynchronously lock a hardware semaphore with 2-step lock procedure and interrupts outlined in RM0399 11.3.7.
- Try to lock the semaphore and return if it is obtained
- If the lock fails:
- Clear pending interrupt status and retry the lock
- If the lock is obtained, return
- If the lock fails, register the waker and enable interrupt in IER
Sourcepub fn blocking_lock(&mut self, process_id: u8) -> HardwareSemaphoreMutex<'a, T>
pub fn blocking_lock(&mut self, process_id: u8) -> HardwareSemaphoreMutex<'a, T>
Locks the semaphore in a blocking wait loop
Sourcepub fn blocking_notify(&mut self)
pub fn blocking_notify(&mut self)
Lock and unlock the semaphore to notify a listening core
Sourcepub fn blocking_listen(&mut self)
pub fn blocking_listen(&mut self)
Blocking poll for semaphore interrupt flag
Sourcepub async fn listen(&mut self)
pub async fn listen(&mut self)
Asynchronous listen for a notification interrupt when this semaphore channel is unlocked
Sourcepub fn try_lock(
&mut self,
process_id: u8,
) -> Option<HardwareSemaphoreMutex<'a, T>>
pub fn try_lock( &mut self, process_id: u8, ) -> Option<HardwareSemaphoreMutex<'a, T>>
Try to lock the semaphore The 2-step lock procedure consists in a write to lock the semaphore, followed by a read to check if the lock has been successful, carried out from the HSEM_Rx register.
Sourcepub fn try_fast_lock(&mut self) -> Option<HardwareSemaphoreMutex<'a, T>>
pub fn try_fast_lock(&mut self) -> Option<HardwareSemaphoreMutex<'a, T>>
Try to a lock a single step semaphore. This should only be used from different cores, as fast locks do not use process IDs
Sourcepub fn two_step_lock(&mut self, process_id: u8) -> Result<(), HsemError>
pub fn two_step_lock(&mut self, process_id: u8) -> Result<(), HsemError>
Locks the semaphore. The 2-step lock procedure consists in a write to lock the semaphore, followed by a read to check if the lock has been successful, carried out from the HSEM_Rx register.
Sourcepub fn one_step_lock(&mut self) -> Result<(), HsemError>
pub fn one_step_lock(&mut self) -> Result<(), HsemError>
Locks the semaphore. The 1-step procedure consists in a read to lock and check the semaphore in a single step, carried out from the HSEM_RLRx register.
This is only safe to use when acquiring from different cores/AHB masters, as a 1-step is only exclusive per core, AHB bus master ID
Trait Implementations§
Source§impl<'a, T: Clone + Instance> Clone for HardwareSemaphoreChannel<'a, T>
impl<'a, T: Clone + Instance> Clone for HardwareSemaphoreChannel<'a, T>
Source§fn clone(&self) -> HardwareSemaphoreChannel<'a, T>
fn clone(&self) -> HardwareSemaphoreChannel<'a, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more