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... | |
Module for declaring the SLAB Allocator API.
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.
[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
[in] | type | Type of a gotten buffer (free or busy). |
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.
[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.
[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.
[in] | type | Type of an checked buffers (free or busy). |
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
True | in case of success. False otherwise. |
void sys_sa_reset | ( | void | ) |
Resets the SLAB allocator.
Clear allocated the frame pools