test
Fork of nrf51-sdk by
Mutex
[Peer_manager]
An internal module of Peer_manager. More...
Functions | |
void | pm_mutex_init (uint8_t *p_mutex, uint16_t mutex_size) |
Initializes a mutex group. | |
bool | pm_mutex_lock (uint8_t *p_mutex, uint16_t mutex_bit_id) |
Locks the mutex specified by the bit id. | |
uint16_t | pm_mutex_lock_first_available (uint8_t *p_mutex, uint16_t mutex_size) |
Locks the first unlocked mutex within the mutex group. | |
void | pm_mutex_unlock (uint8_t *p_mutex, uint16_t mutex_bit_id) |
Unlocks the mutex specified by the bit id. | |
bool | pm_mutex_lock_status_get (uint8_t *p_mutex, uint16_t mutex_bit_id) |
Gets the locking status of the specified mutex. |
Detailed Description
An internal module of Peer_manager.
This module provides thread-safe mutexes.
Function Documentation
void pm_mutex_init | ( | uint8_t * | p_mutex, |
uint16_t | mutex_size | ||
) |
Initializes a mutex group.
- Parameters:
-
[in] p_mutex Pointer to the mutex group. See MUTEX_STORAGE_SIZE(). [in] mutex_size The size of the mutex group in number of mutexes.
Definition at line 71 of file pm_mutex.c.
bool pm_mutex_lock | ( | uint8_t * | p_mutex, |
uint16_t | mutex_bit_id | ||
) |
Locks the mutex specified by the bit id.
- Parameters:
-
inout] p_mutex Pointer to the mutex group. [in] mutex_bit_id The bit id of the mutex.
- Return values:
-
true if it was possible to lock the mutex. false otherwise.
Definition at line 80 of file pm_mutex.c.
uint16_t pm_mutex_lock_first_available | ( | uint8_t * | p_mutex, |
uint16_t | mutex_size | ||
) |
Locks the first unlocked mutex within the mutex group.
- Parameters:
-
[in,out] p_mutex Pointer to the mutex group. [in] mutex_size The size of the mutex group.
- Returns:
- The first unlocked mutex id in the group.
- Return values:
-
group-size if there was no unlocked mutex available.
Definition at line 108 of file pm_mutex.c.
bool pm_mutex_lock_status_get | ( | uint8_t * | p_mutex, |
uint16_t | mutex_bit_id | ||
) |
Gets the locking status of the specified mutex.
- Parameters:
-
[in,out] p_mutex Pointer to the mutex group. [in] mutex_bit_id The bit id of the mutex.
- Return values:
-
true if the mutex was locked. false otherwise.
Definition at line 125 of file pm_mutex.c.
void pm_mutex_unlock | ( | uint8_t * | p_mutex, |
uint16_t | mutex_bit_id | ||
) |
Unlocks the mutex specified by the bit id.
- Parameters:
-
[in,out] p_mutex Pointer to the mutex group. [in] mutex_bit_id The bit id of the mutex.
Definition at line 93 of file pm_mutex.c.
Generated on Tue Jul 12 2022 15:51:32 by 1.7.2