Memory bag allocator.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | membag |
Internal structure used by membag to keep track of memory, with maximum 32 blocks per membag. More... | |
Macros | |
#define | ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0])) |
Functions | |
void * | membag_alloc (const size_t size) |
Allocate a memory block via a block from the Membag pool. More... | |
void | membag_free (const void *ptr) |
Free a previously allocated memory block from the Membag pool. More... | |
size_t | membag_get_largest_free_block_size (void) |
Determine the largest available block size. More... | |
size_t | membag_get_smallest_free_block_size (void) |
Determine the smallest available block size. More... | |
size_t | membag_get_total (void) |
Determine the total memory from all membags. More... | |
size_t | membag_get_total_free (void) |
Determine the total remaining free memory from all membags. More... | |
void | membag_init (void) |
Initialize the membag system. More... | |
Variables | |
static struct membag | membag_list [] |
Array of available membags, provided by the user in the applications conf_membag.h header file. More... | |
static uint8_t | membag_pool [CONF_MEMBAG_POOL_SIZE] |
Static address space which is split up into usable chunks by membag. More... | |
#define ARRAY_LEN | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
Retrieves the number of elements in a statically declared array.
Referenced by membag_alloc(), membag_free(), membag_get_largest_free_block_size(), membag_get_smallest_free_block_size(), membag_get_total(), membag_get_total_free(), and membag_init().
|
static |
Array of available membags, provided by the user in the applications conf_membag.h header file.
Example:
|
static |
Static address space which is split up into usable chunks by membag.
For configuration details, see membag_list.
Referenced by membag_init().