feat: KT mBMS 펌웨어 3종(HW1/2/3) 및 통합 빌드 환경 초기 커밋 (V4.0.0.1)
This commit is contained in:
78
APP_R3221/App/Hardware/malloc.h
Normal file
78
APP_R3221/App/Hardware/malloc.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file malloc.h
|
||||
* @author AMG Energy Solution Team
|
||||
* @version V1.0.0
|
||||
* @date 07-Feb-2022
|
||||
* @brief This file provides code for the configuration of
|
||||
* the memory heap instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2022 AMG</center></h2>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __malloc_H
|
||||
#define __malloc_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "hc32_ddl.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
// Define three memory pools
|
||||
#define MEM_BLOCK_SIZE 32 // Block size is 32 bytes
|
||||
#define MEM_MAX_SIZE (20 * 1024) // Maximum memory management 20k
|
||||
#define MEM_ALLOC_TABLE_SIZE (MEM_MAX_SIZE / MEM_BLOCK_SIZE) // Memory table size
|
||||
|
||||
//Memory management controller
|
||||
struct _m_mallco_dev
|
||||
{
|
||||
void (*init)(void); // Initialize
|
||||
uint8_t (*perused)(void); // Memory usage
|
||||
uint8_t *membase; // Memory pool management SRAMBANK a region of memory
|
||||
uint16_t *memmap; // Memory status table
|
||||
uint8_t memrdy; // Memory management is ready to
|
||||
};
|
||||
extern struct _m_mallco_dev mallco_dev; //Defined in malloc.c
|
||||
|
||||
void mymemset(void *s,uint8_t c,uint32_t count); // Setting memory
|
||||
void mymemcpy(void *des,void *src,uint32_t n); // Copy memory
|
||||
void mymem_init(void); // Memory initialization function (external/internal calls)
|
||||
uint8_t mem_perused(void); // For memory usage (external/internal calls)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//Users call a function
|
||||
void myfree(void *ptr); // Memory release (external call)
|
||||
void *mymalloc(uint32_t size); // Memory allocation (external call)
|
||||
void *myrealloc(void *ptr, uint32_t size); // Reallocating memory (external call)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__ brtc_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*******************(C)COPYRIGHT 2022 AMG ********************END OF FILE******/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user