![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
| struct | mem_config_t |
| Memory user config. More... | |
Macros | |
| #define | MEM_BLOCK_DATA_BUFFER_DEFINE(name, numberOfBlocks, blockSize, id) |
| Defines the memory buffer. More... | |
| #define | MEM_BLOCK_BUFFER(name) (uint8_t *)&g_poolHeadBuffer##name |
| \ More... | |
Enumerations | |
| enum | mem_status_t |
| Memory status. | |
Functions | |
| mem_status_t | MEM_Init (void) |
| Initialises the Memory Manager. | |
| mem_status_t | MEM_AddBuffer (uint8_t *buffer) |
| Add memory buffer to memory manager buffer list. More... | |
| void * | MEM_BufferAllocWithId (uint32_t numBytes, uint8_t poolId) |
| Allocate a block from the memory pools. More... | |
| mem_status_t | MEM_BufferFree (void *buffer) |
| Memory buffer free . More... | |
| uint16_t | MEM_BufferGetSize (void *buffer) |
| Returns the size of a given buffer. More... | |
| mem_status_t | MEM_BufferFreeAllWithId (uint8_t poolId) |
| Frees all allocated blocks by selected source and in selected pool. More... | |
| void * | MEM_BufferRealloc (void *buffer, uint32_t new_size) |
| Memory buffer realloc. More... | |
| struct mem_config_t |
| #define MEM_BLOCK_DATA_BUFFER_DEFINE | ( | name, | |
| numberOfBlocks, | |||
| blockSize, | |||
| id | |||
| ) |
This macro is used to define the shell memory buffer for memory manager. And then uses the macro MEM_BLOCK_BUFFER to get the memory buffer pointer. The macro should not be used in any function.
This is a example,
| name | The name string of the memory buffer. |
| numberOfBlocks | The number Of Blocks. |
| blockSize | The memory block size. |
| id | The id Of memory buffer. |
| #define MEM_BLOCK_BUFFER | ( | name | ) | (uint8_t *)&g_poolHeadBuffer##name |
Gets the memory buffer pointer \ \ This macro is used to get the memory buffer pointer. The macro should \ not be used before the macro MEM_BLOCK_BUFFER_DEFINE is used. \ \
| name | The memory name string of the buffer. \ |
| mem_status_t MEM_AddBuffer | ( | uint8_t * | buffer | ) |
| buffer | Pointer the memory pool buffer, use MEM_BLOCK_BUFFER Macro as the input parameter. |
| kStatus_MemSuccess | Memory manager add buffer succeed. |
| kStatus_MemUnknownError | Memory manager add buffer error occurred. |
| void* MEM_BufferAllocWithId | ( | uint32_t | numBytes, |
| uint8_t | poolId | ||
| ) |
The function uses the numBytes argument to look up a pool with adequate block sizes.
| numBytes | The number of bytes will be allocated. |
| poolId | The ID of the pool where to search for a free buffer. |
| Memory | buffer address when allocate success, NULL when allocate fail. |
| mem_status_t MEM_BufferFree | ( | void * | buffer | ) |
| buffer | The memory buffer address will be free. |
| kStatus_MemSuccess | Memory free succeed. |
| kStatus_MemFreeError | Memory free error occurred. |
| uint16_t MEM_BufferGetSize | ( | void * | buffer | ) |
| buffer | The memory buffer address will be get size. |
| The | size of a given buffer. |
| mem_status_t MEM_BufferFreeAllWithId | ( | uint8_t | poolId | ) |
| poolId | Selected pool Id (4 LSBs of poolId parameter) and selected source Id (4 MSBs of poolId parameter). |
| kStatus_MemSuccess | Memory free succeed. |
| kStatus_MemFreeError | Memory free error occurred. |
| void* MEM_BufferRealloc | ( | void * | buffer, |
| uint32_t | new_size | ||
| ) |
| buffer | The memory buffer address will be reallocated. |
| new_size | The number of bytes will be reallocated |
| kStatus_MemSuccess | Memory free succeed. |
| kStatus_MemFreeError | Memory free error occurred. |