Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Memory Blocks Allocator. More...
#include <stddef.h>
#include <stdint.h>
#include <zephyr/kernel.h>
#include <zephyr/math/ilog2.h>
#include <zephyr/sys/bitarray.h>
#include <zephyr/sys/mem_stats.h>
Go to the source code of this file.
Macros | |
#define | MAX_MULTI_ALLOCATORS 8 |
#define | SYS_MEM_BLOCKS_DEFINE(name, blk_sz, num_blks, buf_align) _SYS_MEM_BLOCKS_DEFINE(name, blk_sz, num_blks, buf_align,) |
Create a memory block object with a new backing buffer. | |
#define | SYS_MEM_BLOCKS_DEFINE_STATIC(name, blk_sz, num_blks, buf_align) _SYS_MEM_BLOCKS_DEFINE(name, blk_sz, num_blks, buf_align, static) |
Create a static memory block object with a new backing buffer. | |
#define | SYS_MEM_BLOCKS_DEFINE_WITH_EXT_BUF(name, blk_sz, num_blks, buf) _SYS_MEM_BLOCKS_DEFINE_WITH_EXT_BUF(name, blk_sz, num_blks, buf,) |
Create a memory block object with a providing backing buffer. | |
#define | SYS_MEM_BLOCKS_DEFINE_STATIC_WITH_EXT_BUF(name, blk_sz, num_blks, buf) _SYS_MEM_BLOCKS_DEFINE_WITH_EXT_BUF(name, blk_sz, num_blks, buf, static) |
Create a static memory block object with a providing backing buffer. | |
Typedefs | |
typedef struct sys_mem_blocks | sys_mem_blocks_t |
Memory Blocks Allocator. | |
typedef struct sys_multi_mem_blocks | sys_multi_mem_blocks_t |
Multi Memory Blocks Allocator. | |
typedef sys_mem_blocks_t *(* | sys_multi_mem_blocks_choice_fn_t) (struct sys_multi_mem_blocks *group, void *cfg) |
Multi memory blocks allocator choice function. | |
Functions | |
int | sys_mem_blocks_alloc (sys_mem_blocks_t *mem_block, size_t count, void **out_blocks) |
Allocate multiple memory blocks. | |
int | sys_mem_blocks_alloc_contiguous (sys_mem_blocks_t *mem_block, size_t count, void **out_block) |
Allocate a contiguous set of memory blocks. | |
int | sys_mem_blocks_get (sys_mem_blocks_t *mem_block, void *in_block, size_t count) |
Force allocation of a specified blocks in a memory block object. | |
int | sys_mem_blocks_is_region_free (sys_mem_blocks_t *mem_block, void *in_block, size_t count) |
check if the region is free | |
int | sys_mem_blocks_free (sys_mem_blocks_t *mem_block, size_t count, void **in_blocks) |
Free multiple memory blocks. | |
int | sys_mem_blocks_free_contiguous (sys_mem_blocks_t *mem_block, void *block, size_t count) |
Free contiguous multiple memory blocks. | |
void | sys_multi_mem_blocks_init (sys_multi_mem_blocks_t *group, sys_multi_mem_blocks_choice_fn_t choice_fn) |
Initialize multi memory blocks allocator group. | |
void | sys_multi_mem_blocks_add_allocator (sys_multi_mem_blocks_t *group, sys_mem_blocks_t *alloc) |
Add an allocator to an allocator group. | |
int | sys_multi_mem_blocks_alloc (sys_multi_mem_blocks_t *group, void *cfg, size_t count, void **out_blocks, size_t *blk_size) |
Allocate memory from multi memory blocks allocator group. | |
int | sys_multi_mem_blocks_free (sys_multi_mem_blocks_t *group, size_t count, void **in_blocks) |
Free memory allocated from multi memory blocks allocator group. | |
Memory Blocks Allocator.
#define MAX_MULTI_ALLOCATORS 8 |