nRF51 SDK v10.0.0
Macros | Functions

An internal module of Peer Manager. This module provides thread-safe mutexes. More...

Macros

#define MUTEX_STORAGE_SIZE(number_of_mutexes)   ((7 + (number_of_mutexes)) >> 3)
 Defines the storage size of a specified mutex group. More...
 

Functions

void pm_mutex_init (uint8_t *p_mutex, uint16_t mutex_size)
 Initializes a mutex group. More...
 
bool pm_mutex_lock (uint8_t *p_mutex, uint16_t mutex_bit_id)
 Locks the mutex specified by the bit id. More...
 
uint16_t pm_mutex_lock_first_available (uint8_t *p_mutex, uint16_t mutex_size)
 Locks the first unlocked mutex within the mutex group. More...
 
void pm_mutex_unlock (uint8_t *p_mutex, uint16_t mutex_bit_id)
 Unlocks the mutex specified by the bit id. More...
 
bool pm_mutex_lock_status_get (uint8_t *p_mutex, uint16_t mutex_bit_id)
 Gets the locking status of the specified mutex. More...
 

Detailed Description

An internal module of Peer Manager. This module provides thread-safe mutexes.

Macro Definition Documentation

#define MUTEX_STORAGE_SIZE (   number_of_mutexes)    ((7 + (number_of_mutexes)) >> 3)

Defines the storage size of a specified mutex group.

Parameters
number_of_mutexesthe number of mutexes in the group.

Function Documentation

void pm_mutex_init ( uint8_t *  p_mutex,
uint16_t  mutex_size 
)

Initializes a mutex group.

Parameters
[in]p_mutexPointer to the mutex group. See MUTEX_STORAGE_SIZE().
[in]mutex_sizeThe size of the mutex group in number of mutexes.
bool pm_mutex_lock ( uint8_t *  p_mutex,
uint16_t  mutex_bit_id 
)

Locks the mutex specified by the bit id.

Parameters
[in,out]p_mutexPointer to the mutex group.
[in]mutex_bit_idThe bit id of the mutex.
Return values
trueif it was possible to lock the mutex.
falseotherwise.
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_mutexPointer to the mutex group.
[in]mutex_sizeThe size of the mutex group.
Returns
The first unlocked mutex id in the group.
Return values
group-sizeif there was no unlocked mutex available.
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_mutexPointer to the mutex group.
[in]mutex_bit_idThe bit id of the mutex.
Return values
trueif the mutex was locked.
falseotherwise.
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_mutexPointer to the mutex group.
[in]mutex_bit_idThe bit id of the mutex.

This document was last updated on Mon Nov 9 2015.
Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone.