MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
Exclusive Access Locks

Lock functions to obtain and release a variable for exclusive access. More...

Functions

int mxc_get_lock (uint32_t *lock, uint32_t value)
 Attempts to acquire the lock. More...
 
void mxc_free_lock (uint32_t *lock)
 Free the given lock. More...
 

Detailed Description

These functions are marked interrupt safe if they are interrupt safe.

Function Documentation

◆ 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
lockPointer to variable that is used for the lock.
valueValue 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]lockPointer to the variable used for the lock. When the lock is free, the value pointed to by lock is set to zero.