134 #ifndef INC_KERNEL_OC_MEMMAN_H_ 135 #define INC_KERNEL_OC_MEMMAN_H_ 138 #include <oc_errors.h> 140 #include <oc_stdlib.h> 147 #define _________________________________________TYPES_SECTION_____________________________________________________________________________ 172 const char * Function;
173 oC_UInt_t LineNumber;
177 #undef _________________________________________TYPES_SECTION_____________________________________________________________________________ 185 #define _________________________________________INTERFACE_SECTION__________________________________________________________________________ 197 extern void *
oC_MemMan_RawAllocate ( oC_HeapMap_t Map , oC_UInt_t Size ,
const char * Function, uint32_t LineNumber , AllocationFlags_t Flags);
198 extern bool oC_MemMan_RawFree ( oC_HeapMap_t Map ,
void * Address , oC_UInt_t Size );
199 extern void *
oC_MemMan_Allocate ( oC_UInt_t Size ,
Allocator_t Allocator ,
const char * Function, uint32_t LineNumber , AllocationFlags_t Flags , oC_UInt_t Alignment );
200 extern bool oC_MemMan_Free (
void * Address , AllocationFlags_t Flags);
240 #undef _________________________________________INTERFACE_SECTION__________________________________________________________________________ bool oC_MemMan_IsAllocatorCorrect(Allocator_t Allocator)
checks if allocator is correct
bool oC_MemMan_FreeHeapMap(oC_HeapMap_t *Map, AllocationFlags_t Flags)
release heap map
void(* oC_MemMan_DumpFunction_t)(oC_UInt_t Data)
stores pointer to function for dumping data
void * oC_MemMan_AlignAddressTo(const void *Address, oC_UInt_t Alignment)
returns address aligned to the given alignment.
oC_ErrorCode_t oC_MemMan_TurnOff(void)
turns off the module
float oC_MemMan_GetPanicMemoryExhaustedLimit(void)
oC_UInt_t oC_MemMan_GetFreeFlashSize(void)
returns size of the machine not used flash
bool oC_MemMan_IsRamAddress(const void *Address)
checks if address is in ram section
identifier for allocations
oC_ErrorCode_t oC_MemMan_UnconfigureExternalHeapMap(void)
unconfigures external heap
oC_UInt_t oC_MemMan_AlignSizeTo(oC_UInt_t Size, oC_UInt_t Alignment)
returns size aligned to the given alignment
oC_UInt_t oC_MemMan_GetMaximumAllocationSize(void)
returns maximum size of allocation
bool oC_MemMan_FreeAllMemoryOfAllocator(Allocator_t Allocator)
release all memory of allocator
void * oC_MemMan_RawAllocate(oC_HeapMap_t Map, oC_UInt_t Size, const char *Function, uint32_t LineNumber, AllocationFlags_t Flags)
allow to allocate memory in heap map
bool oC_MemMan_IsStaticRamAddress(const void *Address)
checks if address is in static used ram section (data section)
oC_UInt_t oC_MemMan_GetSizeOfAllocation(const void *Address)
returns size of allocation
oC_ErrorCode_t oC_MemMan_SetPanicMemoryExhaustedLimit(float LimitPercent)
float oC_MemMan_GetMemoryExhaustedLimit(void)
bool oC_MemMan_RawFree(oC_HeapMap_t Map, void *Address, oC_UInt_t Size)
release memory in heap map
oC_UInt_t oC_MemMan_GetHeapMapSize(oC_HeapMap_t Map)
returns size of heap map
oC_UInt_t oC_MemMan_GetExternalHeapSize(void)
returns size of external ram
The file with LLD interface for the MEM driver.
oC_UInt_t oC_MemMan_GetFreeHeapMapSize(oC_HeapMap_t Map)
returns size of free memory in heap map
oC_ErrorCode_t oC_MemMan_TurnOn(void)
turns on memory manager
oC_ErrorCode_t oC_MemMan_ConfigureExternalHeapMap(void *StartAddress, oC_UInt_t Size)
prepares HeapMap stored in external RAM
void * oC_MemMan_Allocate(oC_UInt_t Size, Allocator_t Allocator, const char *Function, uint32_t LineNumber, AllocationFlags_t Flags, oC_UInt_t Alignment)
allocates memory on heap
oC_UInt_t oC_MemMan_GetAllocationBlockSize(void)
returns size of block needed for allocation
bool oC_MemMan_IsDynamicAllocatedAddress(const void *Address)
checks if address is in dynamic allocated section
bool oC_MemMan_IsAddressCorrect(const void *Address)
checks if address is correct - in RAM or in FLASH
oC_UInt_t oC_MemMan_GetFlashSize(void)
returns size of the machine flash
bool oC_MemMan_IsAddressAlignedTo(const void *Address, oC_UInt_t Alignment)
checks if address is aligned to given alignment
oC_ErrorCode_t oC_MemMan_ReadAllocatorsStats(oC_MemMan_AllocatorsStats_t *outAllocatorsArray, oC_UInt_t *Size)
Reads allocators statistics array.
Allocator_t oC_MemMan_GetAllocatorOfAddress(const void *Address)
returns allocator of address
bool oC_MemMan_IsAddressAligned(const void *Address)
checks if address is aligned
bool oC_MemMan_FindOverflowedAllocation(Allocator_t Allocator, oC_MemMan_AllocationStats_t *outAllocationStat)
searches for a overflowed buffer
void oC_MemMan_CheckMemoryLeak(void)
checks if memory is not leaking
oC_ErrorCode_t oC_MemMan_ReadAllocationsStats(Allocator_t Allocator, oC_MemMan_AllocationStats_t *outAllocationsArray, oC_UInt_t *Size, bool JoinSimilar)
Reads allocations statistics of the allocator.
oC_UInt_t oC_MemMan_GetFreeRamSize(void)
returns size of free ram
oC_UInt_t oC_MemMan_AlignSize(oC_UInt_t Size)
returns size aligned to the machine alignment
oC_UInt_t oC_MemMan_GetMemoryOfAllocatorSize(Allocator_t Allocator)
returns size of allocations per allocator
bool oC_MemMan_Free(void *Address, AllocationFlags_t Flags)
release allocated memory
oC_UInt_t oC_MemMan_GetDmaRamHeapSize(void)
returns size of external ram
oC_ErrorCode_t oC_MemMan_SetMemoryExhaustedLimit(float LimitPercent)
oC_UInt_t oC_MemMan_GetRamSize(void)
returns size of the machine ram
bool oC_MemMan_IsUsedFlashAddress(const void *Address)
checks if address is in used flash section
oC_ErrorCode_t oC_MemMan_TestAndRepairMainHeap(oC_MemMan_DumpFunction_t DumpFunction)
diagnoses main heap
bool oC_MemMan_IsSizeAligned(oC_UInt_t Size)
checks if a size is aligned
void * oC_MemMan_AlignAddress(const void *Address)
returns address aligned to the machine alignment.
static const oC_Allocator_t Allocator
void oC_MemMan_CheckMemoryExhausted(void)
checks if memory exhausted event not occurs.
oC_ErrorCode_t oC_MemMan_SetEventHandler(MemoryEventHandler_t EventHandler)
sets event handler function
oC_HeapMap_t oC_MemMan_AllocateHeapMap(oC_UInt_t Size, Allocator_t Allocator, const char *Function, uint32_t LineNumber, AllocationFlags_t Flags)
allocates memory for new heap map
bool oC_MemMan_IsFlashAddress(const void *Address)
checks if address is placed in the flash section
void oC_MemMan_CheckOverflow(void)
scan each block to check if the overflow event not occurs.