R1 code for micro:bit based train controller code, requires second micro:bit running rx code to operate - see https://meanderingpi.wordpress.com/ for more information
Fork of nrf51-sdk by
Buffer
[Peer_manager]
An internal module of Peer_manager. More...
Functions | |
ret_code_t | pm_buffer_init (pm_buffer_t *p_buffer, uint8_t *p_buffer_memory, uint32_t buffer_memory_size, uint8_t *p_mutex_memory, uint32_t mutex_memory_size, uint32_t n_blocks, uint32_t block_size) |
Function for initializing a buffer instance. | |
uint8_t | pm_buffer_block_acquire (pm_buffer_t *p_buffer, uint32_t n_blocks) |
Function for acquiring a buffer block in a buffer. | |
uint8_t * | pm_buffer_ptr_get (pm_buffer_t *p_buffer, uint8_t id) |
Function for getting a pointer to a specific buffer block. | |
void | pm_buffer_release (pm_buffer_t *p_buffer, uint8_t id) |
Function for releasing a buffer block. |
Detailed Description
An internal module of Peer_manager.
This module provides a simple buffer.
Function Documentation
uint8_t pm_buffer_block_acquire | ( | pm_buffer_t * | p_buffer, |
uint32_t | n_blocks | ||
) |
Function for acquiring a buffer block in a buffer.
- Parameters:
-
[in] p_buffer The buffer instance acquire from. [in] n_blocks The number of contiguous blocks to acquire.
- Returns:
- The id of the acquired block, if successful.
- Return values:
-
BUFFER_INVALID_ID If unsuccessful.
Definition at line 79 of file pm_buffer.c.
ret_code_t pm_buffer_init | ( | pm_buffer_t * | p_buffer, |
uint8_t * | p_buffer_memory, | ||
uint32_t | buffer_memory_size, | ||
uint8_t * | p_mutex_memory, | ||
uint32_t | mutex_memory_size, | ||
uint32_t | n_blocks, | ||
uint32_t | block_size | ||
) |
Function for initializing a buffer instance.
- Parameters:
-
[out] p_buffer The buffer instance to initialize. [in] p_buffer_memory The memory this buffer will use. [in] buffer_memory_size The size of p_buffer_memory. This must be at least n_blocks*block_size. [in] p_mutex_memory The memory for the mutexes. This must be at least MUTEX_STORAGE_SIZE(n_blocks). [in] mutex_memory_size The size of p_mutex_memory. [in] n_blocks The number of blocks in the buffer. [in] block_size The size of each block.
- Return values:
-
NRF_SUCCESS Successfully initialized buffer instance. NRF_ERROR_INVALID_PARAM A parameter was 0 or NULL or a size was too small.
Definition at line 48 of file pm_buffer.c.
uint8_t* pm_buffer_ptr_get | ( | pm_buffer_t * | p_buffer, |
uint8_t | id | ||
) |
Function for getting a pointer to a specific buffer block.
- Parameters:
-
[in] p_buffer The buffer instance get from. [in] id The id of the buffer to get the pointer for.
- Returns:
- A pointer to the buffer for the specified id, if the id is valid.
- Return values:
-
NULL If the id is invalid.
Definition at line 115 of file pm_buffer.c.
void pm_buffer_release | ( | pm_buffer_t * | p_buffer, |
uint8_t | id | ||
) |
Function for releasing a buffer block.
- Parameters:
-
[in] p_buffer The buffer instance containing the block to release. [in] id The id of the block to release.
Definition at line 134 of file pm_buffer.c.
Generated on Tue Jul 12 2022 19:00:13 by 1.7.2