WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_membox.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2019. All rights reserved.
3 * Description: LiteOS memory Module HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2013-01-01
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
34#ifndef _LOS_MEMBOX_H
35#define _LOS_MEMBOX_H
36
37#include "los_config.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42
62#define LOS_MEMBOX_ALLIGNED(memAddr) (((UINTPTR)(memAddr) + sizeof(UINTPTR) - 1) & (~(sizeof(UINTPTR) - 1)))
63
64#ifdef LOSCFG_KERNEL_MEMBOX_STATIC
69#define OS_MEMBOX_NEXT(addr, blkSize) (LOS_MEMBOX_NODE *)(VOID *)((UINT8 *)(addr) + (blkSize))
70
75#ifdef LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK
76#define OS_MEMBOX_NODE_HEAD_SIZE sizeof(LOS_MEMBOX_NODE)
77#else
78#define OS_MEMBOX_NODE_HEAD_SIZE 0
79#endif
80
101#define LOS_MEMBOX_SIZE(blkSize, blkNum) \
102 (sizeof(LOS_MEMBOX_INFO) + (LOS_MEMBOX_ALLIGNED((blkSize) + OS_MEMBOX_NODE_HEAD_SIZE) * (blkNum)))
103
108typedef struct tagMEMBOX_NODE {
109 struct tagMEMBOX_NODE *pstNext;
110} LOS_MEMBOX_NODE;
111#endif
112
117typedef struct {
121#ifdef LOSCFG_KERNEL_MEMBOX_STATIC
122 LOS_MEMBOX_NODE stFreeList;
125#endif
127
129
157extern UINT32 LOS_MemboxInit(VOID *pool, UINT32 poolSize, UINT32 blkSize);
158
179extern VOID *LOS_MemboxAlloc(VOID *pool);
180
206extern UINT32 LOS_MemboxFree(VOID *pool, VOID *box);
207
230extern VOID LOS_MemboxClr(VOID *pool, VOID *box);
231
253extern VOID LOS_ShowBox(VOID *pool);
254
281extern UINT32 LOS_MemboxStatisticsGet(const VOID *boxMem, UINT32 *maxBlk, UINT32 *blkCnt, UINT32 *blkSize);
282
283#ifdef __cplusplus
284}
285#endif /* __cplusplus */
286
287#endif /* _LOS_MEMBOX_H */
UINT32 LOS_MemboxStatisticsGet(const void *boxMem, UINT32 *maxBlk, UINT32 *blkCnt, UINT32 *blkSize)
Obtain the static memory pool information.
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_ShowBox(void *pool)
show static memory pool information.
void LOS_MemboxClr(void *pool, void *box)
Clear a static memory block.
LOS_MEMBOX_INFO OS_MEMBOX_S
Definition los_membox.h:128
#define VOID
Definition los_typedef.h:88
unsigned int UINT32
Definition los_typedef.h:52
Definition los_membox.h:117
UINT32 uwBlkSize
Definition los_membox.h:118
UINT32 uwBlkNum
Definition los_membox.h:119
UINT32 uwBlkCnt
Definition los_membox.h:120