Memory Buffer handling for MiWi Protocol implementation.
Copyright (c) 2018 - 2019 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | _Block_t |
Macros | |
#define | ALIGN(X) ((((X-1) >> ALIGNMENT_FACTOR) << ALIGNMENT_FACTOR) + BYTE_ALIGNMENT) |
#define | ALIGNMENT_FACTOR 2U |
#define | BYTE_ALIGNMENT 4U |
#define | HEAP_MINIMUM_BLOCK_SIZE (( size_t )( blockMetaDataSize + 4U)) |
#define | HEAP_SIZE (6144UL) |
Typedefs | |
typedef struct _Block_t | Block_t |
Functions | |
void * | MiMem_Alloc (uint8_t size) |
void | MiMem_Free (void *ptr) |
void | MiMem_Init (void) |
uint8_t | MiMem_PercentageOfFreeBuffers (void) |
static void | splitBlock (Block_t *blockTobeSplitted, size_t size) |
Variables | |
static Block_t * | base = NULL |
static const size_t | blockMetaDataSize = ALIGN(sizeof(Block_t)) |
static uint8_t | heapMem [HEAP_SIZE] |
static size_t | totalFreeBytesRemaining |
#define ALIGN | ( | X | ) | ((((X-1) >> ALIGNMENT_FACTOR) << ALIGNMENT_FACTOR) + BYTE_ALIGNMENT) |
Referenced by MiMem_Alloc(), and MiMem_Init().
#define ALIGNMENT_FACTOR 2U |
#define BYTE_ALIGNMENT 4U |
#define HEAP_MINIMUM_BLOCK_SIZE (( size_t )( blockMetaDataSize + 4U)) |
Referenced by MiMem_Alloc().
#define HEAP_SIZE (6144UL) |
Referenced by MiMem_Init(), and MiMem_PercentageOfFreeBuffers().
void* MiMem_Alloc | ( | uint8_t | size | ) |
References ALIGN, base, blockMetaDataSize, _Block_t::free, HEAP_MINIMUM_BLOCK_SIZE, MiMem_Init(), _Block_t::next, NULL, _Block_t::size, splitBlock(), and totalFreeBytesRemaining.
Referenced by appAckWaitDataCallback(), frameParse(), frameTransmit(), macAckOnlyDataCallback(), MiApp_BroadcastConnectionTable(), MiApp_SendData(), otauDataInd(), PHY_DataReq(), removeConnection(), and sendConnectionRequest().
void MiMem_Free | ( | void * | ptr | ) |
References base, blockMetaDataSize, _Block_t::free, _Block_t::next, NULL, _Block_t::prev, _Block_t::size, and totalFreeBytesRemaining.
Referenced by appAckWaitDataCallback(), CommandConfCallback(), connectionRespConfCallback(), connReqConfCallback(), dataConfcb(), dataTimerHandler(), frameParse(), frameTxCallback(), macAckOnlyDataCallback(), miQueueFlush(), otauTask(), PHY_TxHandler(), protocolTimerHandler(), and sendConnectionRequest().
void MiMem_Init | ( | void | ) |
References ALIGN, _Block_t::free, HEAP_SIZE, heapMem, _Block_t::next, NULL, _Block_t::prev, _Block_t::size, and totalFreeBytesRemaining.
Referenced by MiMem_Alloc().
uint8_t MiMem_PercentageOfFreeBuffers | ( | void | ) |
References HEAP_SIZE, and totalFreeBytesRemaining.
Referenced by frameParse(), and MiApp_SendData().
|
static |
References _Block_t::free, _Block_t::next, _Block_t::prev, and _Block_t::size.
Referenced by MiMem_Alloc().
Referenced by MiMem_Alloc(), and MiMem_Free().
Referenced by MiMem_Alloc(), and MiMem_Free().
|
static |
Referenced by MiMem_Init().
|
static |
Referenced by MiMem_Alloc(), MiMem_Free(), MiMem_Init(), and MiMem_PercentageOfFreeBuffers().