📄 memalloc.h
字号:
/* Description : head for memory alloc functions.
*
* $Author: 王琢玉
* $Date: 2007/02/23
* $Name: memalloc.h
*/
#ifndef MEMALLOC_H
#define MEMALLOC_H
#include "pub_def.h"
#ifdef MEMALLOC_GLOBALS
#define MEMALLOC_EXT
#else
#define MEMALLOC_EXT extern
#endif
/********************************************
Defines
********************************************/
#define MEM_SIZE 1
/********************************************
Typedefs
********************************************/
typedef struct
{
void *pNext;
void *pPro;
}BIDIR_LINK; //双向链表
/********************************************
Globals
********************************************/
MEMALLOC_EXT UINT8 Memory[MEM_SIZE][1024];
MEMALLOC_EXT void *pFreeMem[7];
/************************************************************
Function: void MemoryInit(void)
Parameter:
Return:
Description: Init the memory
************************************************************/
void MemoryInit(void);
/************************************************************
Function: UINT8* MemoryAlloc(UINT16 size)
Parameter: size the size of memory want to alloc
Return: UINT* the pointer to the memory
Description: Apply for allocing memory if fail,return NULL,
else ruturn the memory pointer
************************************************************/
UINT8* MemoryAlloc(UINT16 size);
/************************************************************
Function: void FreeMemory(UINT8 *pfree)
Parameter: *pfree the pointer to the memory which wanted to free
Return:
Description: free the memory that alloced before
************************************************************/
void FreeMemory(UINT8 *pfree);
#define MemoryFree(p) FreeMemory(p); p = NULL;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -