WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
Static memory
Static memory 的协作图:

结构体

struct  LOS_MEMBOX_INFO
 

宏定义

#define LOS_MEMBOX_ALLIGNED(memAddr)   (((UINTPTR)(memAddr) + sizeof(UINTPTR) - 1) & (~(sizeof(UINTPTR) - 1)))
 Align the input parameter.
 

函数

UINT32 LOS_MemboxInit (void *pool, UINT32 poolSize, UINT32 blkSize)
 Initialize a static memory pool.
 
void * LOS_MemboxAlloc (void *pool)
 Request a static memory block.
 
UINT32 LOS_MemboxFree (void *pool, void *box)
 Free a static memory block.
 
void LOS_MemboxClr (void *pool, void *box)
 Clear a static memory block.
 
void LOS_ShowBox (void *pool)
 show static memory pool information.
 
UINT32 LOS_MemboxStatisticsGet (const void *boxMem, UINT32 *maxBlk, UINT32 *blkCnt, UINT32 *blkSize)
 Obtain the static memory pool information.
 

详细描述

宏定义说明

◆ LOS_MEMBOX_ALLIGNED

#define LOS_MEMBOX_ALLIGNED (   memAddr)    (((UINTPTR)(memAddr) + sizeof(UINTPTR) - 1) & (~(sizeof(UINTPTR) - 1)))

Align the input parameter.

Description:
The macro is used to align memAddr based on UINTPTR. memAddr is the input parameter.
注意
None.
参数
memAddr[IN] The variable that need to be aligned. Usually memAddr is an unsigned integer or an unsigned long integer on 64-bit platform.
返回值
ThememAddr value after alignment.
Dependency:
  • los_membox.h: the header file that contains the API declaration.
自从
Huawei LiteOS V100R001C00

函数说明

◆ LOS_MemboxAlloc()

void * LOS_MemboxAlloc ( void *  pool)
extern

Request a static memory block.

Description:
This API is used to request a static memory block from the static memory pool which has been initialized.
注意
The input pool parameter must be initialized via func LOS_MemboxInit.
参数
pool[IN] Memory pool address.
返回值
#VOID*This API will return a memory block address, if the request is accepted successfully.
NULLThe request fails.
Dependency:
  • los_membox.h: the header file that contains the API declaration.
参见
LOS_MemboxFree
自从
Huawei LiteOS V100R001C00

◆ LOS_MemboxClr()

void LOS_MemboxClr ( void *  pool,
void *  box 
)
extern

Clear a static memory block.

Description:
This API is used to set the memory block value to 0.
注意
参数
pool[IN] Memory pool address. The memory block need to clear is requested from this memory pool.
box[IN] The pointer to the memory block to clear.
返回值
None.
Dependency:
  • los_membox.h: the header file that contains the API declaration.
自从
Huawei LiteOS V100R001C00

◆ LOS_MemboxFree()

UINT32 LOS_MemboxFree ( void *  pool,
void *  box 
)
extern

Free a static memory block.

Description:
This API is used to free a static memory block to the static memory pool.
注意
参数
pool[IN] Memory pool address. The memory block need to release is requested from this memory pool.
box[IN] The pointer to the memory block to be released.
返回值
LOS_NOKThis memory block fails to be freed.
LOS_OKThis memory block is successfully freed.
Dependency:
  • los_membox.h: the header file that contains the API declaration.
参见
LOS_MemboxAlloc
自从
Huawei LiteOS V100R001C00

◆ LOS_MemboxInit()

UINT32 LOS_MemboxInit ( void *  pool,
UINT32  poolSize,
UINT32  blkSize 
)
extern

Initialize a static memory pool.

Description:
This API is used to initialize a static memory pool. The start address of the memory pool is specified by the first parameter. In the API, it will set the memory block size, total block number, allocated block number and the list of free memory block nodes of the static memory pool.
注意
The poolSize parameter value should match the following two conditions:
  • Be less than or equal to the size of the memory pool specified by the pool parameter.
  • Be greater than the size of LOS_MEMBOX_INFO.
参数
pool[IN] Memory pool address.
poolSize[IN] The total size of the static memory pool.
blkSize[IN] The memory block size of the static memory pool.
返回值
LOS_NOKThe memory pool fails to be initialized.
LOS_OKThe memory pool is successfully initialized.
Dependency:
  • los_membox.h: the header file that contains the API declaration.
自从
Huawei LiteOS V100R001C00

◆ LOS_MemboxStatisticsGet()

UINT32 LOS_MemboxStatisticsGet ( const void *  boxMem,
UINT32 maxBlk,
UINT32 blkCnt,
UINT32 blkSize 
)
extern

Obtain the static memory pool information.

Description:
This API is used to obtain the static memory pool information. The information includes the total memory block number, block size and the allocated block number of the static memory pool. The obtained information will be outputted in the last three parameters.
注意
The first parameter boxMem of this interface is a pointer, it should be a correct value. Otherwise the system may be abnormal.
参数
boxMem[IN] Type VOID* Pointer to the static memory pool.
maxBlk[OUT] Type UINT32* The total memory block number is outputted to this parameter.
blkCnt[OUT] Type UINT32* The allocated memory block number is outputted to this parameter.
blkSize[OUT] Type UINT32* The memory block size is outputted to this parameter.
返回值
LOS_OKObtain the static memory pool information successfully.
LOS_NOKFailed to obtain the static memory pool information, check whether the parameters is NULL or not.
Dependency:
  • los_memory.h: the header file that contains the API declaration.
参见
LOS_ShowBox
自从
Huawei LiteOS V100R001C00

◆ LOS_ShowBox()

void LOS_ShowBox ( void *  pool)
extern

show static memory pool information.

Description:
This API is used to print static memory pool information. It can print the memory pool address, the memory block size, the total block number, the list of free memory block node and the total block node list of the static memory pool.
注意
The input pool parameter must be initialized via func LOS_MemboxInit.
参数
pool[IN] Memory pool address.
返回值
None.
Dependency:
  • los_membox.h: the header file that contains the API declaration.
参见
LOS_MemboxStatisticsGet
自从
Huawei LiteOS V100R001C00