![]() |
nRF5 SDK
v16.0.0
|
| Choose documentation: | nRF5 SDK | S112 SoftDevice API | S113 SoftDevice API | S132 SoftDevice API | S140 SoftDevice API | S212 SoftDevice API | S312 SoftDevice API | S332 SoftDevice API | S340 SoftDevice API |
This module handles block memory allocator features. More...
Modules | |
| Block allocator module configuration | |
| Macros for preparing debug flags for block allocator module. | |
Data Structures | |
| struct | nrf_balloc_cb_t |
| Block memory allocator control block. More... | |
| struct | nrf_balloc_t |
| Block memory allocator pool instance. The pool is made of elements of the same size. More... | |
Macros | |
| #define | NRF_BALLOC_LOG_NAME balloc |
| Name of the module used for logger messaging. | |
| #define | NRF_BALLOC_HAS_NAME 0 |
| #define | NRF_BALLOC_DEFAULT_DEBUG_FLAGS 0 |
| Default debug flags for Block memory allocator. This is used by the NRF_BALLOC_DEF macro. Flags can be changed in SDK configuration header file. | |
| #define | NRF_BALLOC_BLOCK_SIZE(_element_size, _debug_flags) ALIGN_NUM(sizeof(uint32_t), (_element_size)) |
| Get total memory consumed by single block (element size with overhead caused by debug flags). More... | |
| #define | NRF_BALLOC_ELEMENT_SIZE(_p_balloc) (_p_balloc)->block_size |
| Get element size ( excluding debugging overhead is present) flags). More... | |
| #define | __NRF_BALLOC_ASSIGN_DEBUG_FLAGS(_debug_flags) |
| #define | __NRF_BALLOC_ASSIGN_POOL_NAME(_name) |
| #define | NRF_BALLOC_DBG_DEF(_name, _element_size, _pool_size, _debug_flags) |
| Create a block allocator instance with custom debug flags. More... | |
| #define | NRF_BALLOC_DEF(_name, _element_size, _pool_size) NRF_BALLOC_DBG_DEF(_name, _element_size, _pool_size, NRF_BALLOC_DEFAULT_DEBUG_FLAGS) |
| Create a block allocator instance. More... | |
| #define | NRF_BALLOC_INTERFACE_DEC(_type, _name) |
| Create a block allocator interface. More... | |
| #define | NRF_BALLOC_INTERFACE_CUSTOM_DEF(_attr, _type, _name, _p_pool) |
| Define a custom block allocator interface. More... | |
| #define | NRF_BALLOC_INTERFACE_DEF(_type, _name, _p_pool) NRF_BALLOC_INTERFACE_CUSTOM_DEF(/* empty */, _type, _name, _p_pool) |
| Define block allocator interface. More... | |
| #define | NRF_BALLOC_INTERFACE_LOCAL_DEF(_type, _name, _p_pool) NRF_BALLOC_INTERFACE_CUSTOM_DEF(static, _type, _name, _p_pool) |
| Define a local block allocator interface. More... | |
Functions | |
| ret_code_t | nrf_balloc_init (nrf_balloc_t const *p_pool) |
| Function for initializing a block memory allocator pool. More... | |
| void * | nrf_balloc_alloc (nrf_balloc_t const *p_pool) |
| Function for allocating an element from the pool. More... | |
| void | nrf_balloc_free (nrf_balloc_t const *p_pool, void *p_element) |
| Function for freeing an element back to the pool. More... | |
| __STATIC_INLINE uint8_t | nrf_balloc_max_utilization_get (nrf_balloc_t const *p_pool) |
| Function for getting maximum memory pool utilization. More... | |
| __STATIC_INLINE uint8_t | nrf_balloc_utilization_get (nrf_balloc_t const *p_pool) |
| Function for getting current memory pool utilization. More... | |
This module handles block memory allocator features.
| #define NRF_BALLOC_BLOCK_SIZE | ( | _element_size, | |
| _debug_flags | |||
| ) | ALIGN_NUM(sizeof(uint32_t), (_element_size)) |
Get total memory consumed by single block (element size with overhead caused by debug flags).
| [in] | _element_size | Size of an element. |
| [in] | _debug_flags | Debug flags. |
| #define NRF_BALLOC_DBG_DEF | ( | _name, | |
| _element_size, | |||
| _pool_size, | |||
| _debug_flags | |||
| ) |
Create a block allocator instance with custom debug flags.
| [in] | _name | Name of the allocator. |
| [in] | _element_size | Size of one element. |
| [in] | _pool_size | Size of the pool. |
| [in] | _debug_flags | Debug flags (Macros for preparing debug flags for block allocator module.). |
| #define NRF_BALLOC_DEF | ( | _name, | |
| _element_size, | |||
| _pool_size | |||
| ) | NRF_BALLOC_DBG_DEF(_name, _element_size, _pool_size, NRF_BALLOC_DEFAULT_DEBUG_FLAGS) |
Create a block allocator instance.
| [in] | _name | Name of the allocator. |
| [in] | _element_size | Size of one element. |
| [in] | _pool_size | Size of the pool. |
| #define NRF_BALLOC_ELEMENT_SIZE | ( | _p_balloc | ) | (_p_balloc)->block_size |
Get element size ( excluding debugging overhead is present) flags).
| [in] | _p_balloc | Pointer to balloc instance. |
| #define NRF_BALLOC_INTERFACE_CUSTOM_DEF | ( | _attr, | |
| _type, | |||
| _name, | |||
| _p_pool | |||
| ) |
Define a custom block allocator interface.
| [in] | _attr | Function attribute that will be added to allocator function definition. |
| [in] | _type | Type which is allocated. |
| [in] | _name | Name of the allocator. |
| [in] | _p_pool | Pool from which data will be allocated. |
| #define NRF_BALLOC_INTERFACE_DEC | ( | _type, | |
| _name | |||
| ) |
| #define NRF_BALLOC_INTERFACE_DEF | ( | _type, | |
| _name, | |||
| _p_pool | |||
| ) | NRF_BALLOC_INTERFACE_CUSTOM_DEF(/* empty */, _type, _name, _p_pool) |
Define block allocator interface.
| [in] | _type | Type which is allocated. |
| [in] | _name | Name of the allocator. |
| [in] | _p_pool | Pool from which data will be allocated. |
| #define NRF_BALLOC_INTERFACE_LOCAL_DEF | ( | _type, | |
| _name, | |||
| _p_pool | |||
| ) | NRF_BALLOC_INTERFACE_CUSTOM_DEF(static, _type, _name, _p_pool) |
Define a local block allocator interface.
| [in] | _type | Type which is allocated. |
| [in] | _name | Name of the allocator. |
| [in] | _p_pool | Pool from which data will be allocated. |
| void* nrf_balloc_alloc | ( | nrf_balloc_t const * | p_pool | ) |
Function for allocating an element from the pool.
| [in] | p_pool | Pointer to the memory pool from which the element will be allocated. |
| void nrf_balloc_free | ( | nrf_balloc_t const * | p_pool, |
| void * | p_element | ||
| ) |
Function for freeing an element back to the pool.
| [in] | p_pool | Pointer to the memory pool. |
| [in] | p_element | Element to be freed. |
| ret_code_t nrf_balloc_init | ( | nrf_balloc_t const * | p_pool | ) |
Function for initializing a block memory allocator pool.
| [out] | p_pool | Pointer to the pool that is to be initialized. |
| __STATIC_INLINE uint8_t nrf_balloc_max_utilization_get | ( | nrf_balloc_t const * | p_pool | ) |
Function for getting maximum memory pool utilization.
| [in] | p_pool | Pointer to the memory pool instance. |
| __STATIC_INLINE uint8_t nrf_balloc_utilization_get | ( | nrf_balloc_t const * | p_pool | ) |
Function for getting current memory pool utilization.
| [in] | p_pool | Pointer to the memory pool instance. |