📄 cxheap.h
字号:
#ifndef HFILE_CxHeapMem
#define HFILE_CxHeapMem
#include "cxheapdef.h"
#define CFG_ArgChkLv 2
#define CFG_CxHeapMT 1
#define CFG_CxHeapCnt 2
typedef unsigned int TYP_PAGECNT;
typedef unsigned int TYP_PAGESIZE;
typedef struct _DS_HeapControlBlock
{
U8 isInuse;
TYP_PAGECNT pageCnt; //Counts of pages in this heap
TYP_PAGESIZE pageSize; //Size of page in this heap
U8 pageSizeIn2Pow;
U8* pHeap; //Pointer to this heap
U8* pHpSt; //Pointer to the usage state of this heap
U16 fstFreePage;
U32 allocCnt;
U32 allocPageCnt;
#if CFG_CxHeapMT!=0
void *mtx;
#endif
}DS_HCB;
#define CAP_MaxHeapPageIn2Pow 15
#define CAP_MinHeapPageIn2Pow 3
#define ERR_HeapPageTooLarge 0xfe
#define CFG_ArgChkLv 2
U8 CxHeapInits(DS_HCB *pHCB);
DS_HCB* CxHeapCreate(U16 heapSize, U16 pageSizeIn2Pow, U8 *pHeapMem);
U8 *CxHeapAlloc(U8 pageCnt, DS_HCB *pHCB);
U8 *CxHeapAllocBytes(U32 byteCnt, DS_HCB *pHCB);
U8 CxHeapFree(U8 *pHeap, DS_HCB *pHCB);
void CxHeapInitMutex(DS_HCB *pHcb);
void CxHeapUnlock(DS_HCB *pHcb);
void CxHeapLock(DS_HCB *pHcb);
void CxHeapEnterCritical(void);
void CxHeapExitCritical(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -