SLAB Allocator API

nRF5 SDK v15.0.0

Module for declaring the SLAB Allocator API. More...

Enumerations

enum sys_slab_buffer_type_t {
SYS_SLAB_FREE_BUFFER ,
SYS_SLAB_BUSY_BUFFER
}
The SLAB allocator buffer type (free or busy buffer). More...

Functions

void sys_sa_init (void)
Initializes the SLAB allocator. More...
void sys_sa_reset (void)
Resets the SLAB allocator. More...
void sys_sa_buffer_put ( sys_slab_buffer_type_t type, pd_data_ind_t *p_item)
Inserts item into one of the queues of the SLAB allocator. More...
pd_data_ind_t * sys_sa_buffer_get ( sys_slab_buffer_type_t type)
Gets item from one of the queues of the SLAB allocator. More...
void sys_sa_buffer_free (uint8_t *p_frame)
Deletes an allocated item from the heap. More...
void sys_sa_buffer_release ( pd_data_ind_t *p_item)
Returns buffer back to queue of free buffers. More...
bool sys_sa_memory_allocate (void)
Allocates memory for the queue of free buffers. More...
bool sys_sa_is_empty ( sys_slab_buffer_type_t type)
Checks if there are any buffers in the SLAB allocator queue or not. More...

Detailed Description

Module for declaring the SLAB Allocator API.

Enumeration Type Documentation

The SLAB allocator buffer type (free or busy buffer).

Enumerator
SYS_SLAB_FREE_BUFFER

The buffer is free

SYS_SLAB_BUSY_BUFFER

The buffer is busy

Function Documentation

void sys_sa_buffer_free ( uint8_t * p_frame )

Deletes an allocated item from the heap.

This function is used to delete allocated by SLAB allocator buffer from the heap. Pointer to a frame memory of an allocated item shall be used.

Parameters
[in] p_frame Pointer to a frame memory of an allocated item.
pd_data_ind_t * sys_sa_buffer_get ( sys_slab_buffer_type_t type )

Gets item from one of the queues of the SLAB allocator.

This function is used to get the item from the SLAB allocator queues. Type of buffer shall be chosen. The buffer is deleted from the SLAB allocator

Parameters
[in] type Type of a gotten buffer (free or busy).
Return values
Pointer to a gotten buffer in case of success. NULL otherwise.
void sys_sa_buffer_put ( sys_slab_buffer_type_t type ,
pd_data_ind_t * p_item
)

Inserts item into one of the queues of the SLAB allocator.

This function is used to put the item into the SLAB allocator queue. Type of buffer shall be chosen.

Parameters
[in] type Type of an inserted buffer (free or busy).
[in] p_item Pointer to an inserted buffer.
void sys_sa_buffer_release ( pd_data_ind_t * p_item )

Returns buffer back to queue of free buffers.

This function is used to return allocated buffer back to the queue without allocation and deallocation.

Parameters
[in] p_item Pointer to an allocated item.
void sys_sa_init ( void )

Initializes the SLAB allocator.

Preallocates the frame pool

bool sys_sa_is_empty ( sys_slab_buffer_type_t type )

Checks if there are any buffers in the SLAB allocator queue or not.

Type of checked buffers shall be passed.

Parameters
[in] type Type of an checked buffers (free or busy).
Return values
True in case of absence of buffers. False otherwise.
bool sys_sa_memory_allocate ( void )

Allocates memory for the queue of free buffers.

This function is used to allocate buffer from heap and put them into the queue

Return values
True in case of success. False otherwise.
void sys_sa_reset ( void )

Resets the SLAB allocator.

Clear allocated the frame pools