Lock functions to obtain and release a variable for exclusive access.
More...
These functions are marked interrupt safe if they are interrupt safe.
◆ mxc_get_lock()
int mxc_get_lock |
( |
uint32_t * |
lock, |
|
|
uint32_t |
value |
|
) |
| |
This in an interrupt safe function that can be used as a mutex. The lock variable must remain in scope until the lock is released. Will not block if another thread has already acquired the lock.
- Parameters
-
lock | Pointer to variable that is used for the lock. |
value | Value to be place in the lock. Can not be 0. |
- Returns
- E_NO_ERROR if everything successful, E_BUSY if lock is taken.
◆ mxc_free_lock()
void mxc_free_lock |
( |
uint32_t * |
lock | ) |
|
- Parameters
-
[in,out] | lock | Pointer to the variable used for the lock. When the lock is free, the value pointed to by lock is set to zero. |