MXC-A36_2024.04.17/MXC-Screen_display/examples/common/btdm/btdm_mem.h

87 lines
2.5 KiB
C

/**
****************************************************************************************
*
* @file ke_mem.h
*
* @brief API for the heap management module.
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef _BTDM_MEM_H_
#define _BTDM_MEM_H_
#include <stdint.h> // standard integer
#include <stdbool.h> // standard includes
/**
****************************************************************************************
* @defgroup MEM Memory
* @ingroup KERNEL
* @brief Heap management module.
*
* This module implements heap management functions that allow initializing heap,
* allocating and freeing memory.
*
* @{
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Allocation of a block of memory.
*
* Allocates a memory block whose size is size; if no memory is available return NULL
*
* @param[in] size Size of the memory area that need to be allocated.
* @param[in] type Type of memory block
*
* @return A pointer to the allocated memory area.
*
****************************************************************************************
*/
void *btdm_malloc(uint32_t size);
/**
****************************************************************************************
* @brief Freeing of a block of memory.
*
* Free the memory area pointed by mem_ptr : mark the block as free and insert it in
* the pool of free block.
*
* @param[in] mem_ptr Pointer to the memory area that need to be freed.
*
****************************************************************************************
*/
void btdm_free(void *mem_ptr);
/**
****************************************************************************************
* @brief Retrieve memory usage of selected heap.
*
* @param[in] type Type of memory heap block
*
* @return current memory usage of current heap.
****************************************************************************************
*/
uint16_t btdm_get_mem_usage(uint8_t type);
/**
****************************************************************************************
* @brief Retrieve max memory usage of all heap.
* This command also resets max measured value.
*
* @return max memory usage of all heap.
****************************************************************************************
*/
uint32_t btdm_get_max_mem_usage(void);
///@} MEM
#endif // _btdm_MEM_H_