|
WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
|

结构体 | |
| struct | LOS_MEM_POOL_STATUS |
宏定义 | |
| #define | OS_SYS_MEM_ADDR (&__heap_start) |
| #define | OS_SYS_MEM_SIZE |
| #define | MEM_MODULE_MAX 0x20 |
| #define | LOS_MEM_INIT_ATTR_SLAB_POS 0U |
| #define | LOS_MEM_CHECK_LEVEL_LOW 0 |
| #define | LOS_MEM_CHECK_LEVEL_HIGH 1 |
| #define | LOS_MEM_CHECK_LEVEL_DISABLE 0xff |
| #define | LOS_MEM_CHECK_LEVEL_DEFAULT LOS_MEM_CHECK_LEVEL_DISABLE |
| #define | LOS_ERRNO_MEMCHECK_PARA_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x1) |
| #define | LOS_ERRNO_MEMCHECK_OUTSIDE LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x2) |
| #define | LOS_ERRNO_MEMCHECK_NO_HEAD LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x3) |
| #define | LOS_ERRNO_MEMCHECK_WRONG_LEVEL LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x4) |
| #define | LOS_ERRNO_MEMCHECK_DISABLED LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x5) |
类型定义 | |
| typedef void(* | MALLOC_HOOK) (void) |
| Define the type of the customized tuning function when calling the API LOS_MemAlloc to allocate memory. | |
函数 | |
| void * | LOS_MemMalloc (void *pool, UINT32 size, UINT32 moduleId) |
| Allocate dynamic memory. | |
| void * | LOS_MemMallocAlign (void *pool, UINT32 size, UINT32 boundary, UINT32 moduleId) |
| Allocate aligned memory. | |
| UINT32 | LOS_MemMfree (void *pool, void *ptr, UINT32 moduleId) |
| Free dynamic memory. | |
| void * | LOS_MemMrealloc (void *pool, void *ptr, UINT32 size, UINT32 moduleId) |
| Re-allocate a memory block. | |
| UINT32 | LOS_MemMusedGet (UINT32 moduleId) |
| get the used memory size of the specified module. | |
| UINT32 | LOS_MemDeInit (void *pool) |
| Deinitialize dynamic memory. | |
| UINT32 | LOS_MemPoolList (void) |
| Print information about all pools. | |
| UINT32 | LOS_MemPoolInit (void *pool, UINT32 size, UINT32 attr) |
| Initialize dynamic memory. | |
| UINT32 | LOS_MemInit (void *pool, UINT32 size) |
| Initialize dynamic memory. | |
| void * | LOS_MemAlloc (void *pool, UINT32 size) |
| Allocate dynamic memory. | |
| UINT32 | LOS_MemFree (void *pool, void *ptr) |
| Free dynamic memory. | |
| void * | LOS_MemRealloc (void *pool, void *ptr, UINT32 size) |
| Re-allocate a memory block. | |
| void * | LOS_MemAllocAlign (void *pool, UINT32 size, UINT32 boundary) |
| Allocate aligned memory. | |
| UINT32 | LOS_MemPoolSizeGet (const void *pool) |
| Get the size of memory pool's size. | |
| UINT32 | LOS_MemTotalUsedGet (void *pool) |
| Get the size of memory totally used. | |
| UINT32 | LOS_MemFreeBlksGet (void *pool) |
| Get the number of free memory nodes. | |
| UINT32 | LOS_MemUsedBlksGet (void *pool) |
| Get the number of used memory nodes. | |
| UINT32 | LOS_MemTaskIdGet (const void *ptr) |
| Get the task ID of a used memory node. | |
| UINTPTR | LOS_MemLastUsedGet (void *pool) |
| Get the address of the next byte of the last used byte. | |
| UINT32 | LOS_MemInfoGet (void *pool, LOS_MEM_POOL_STATUS *poolStatus) |
| Get the information of memory pool. | |
| UINT32 | LOS_MemFreeNodeShow (void *pool) |
| Get the number of free node in every size. | |
| UINT32 | LOS_MemIntegrityCheck (const void *pool) |
| Check the memory pool integrity. | |
变量 | |
| MALLOC_HOOK | g_MALLOC_HOOK |
| UINT8 * | m_aucSysMem0 |
| UINT8 * | m_aucSysMem1 |
| #define LOS_ERRNO_MEMCHECK_DISABLED LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x5) |
memcheck error code: memcheck function is not enable.
Value: 0x02000105.
Solution: enable memcheck by the function "LOS_MemCheckLevelSet".
| #define LOS_ERRNO_MEMCHECK_NO_HEAD LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x3) |
memcheck error code: can't find the control node.
Value: 0x02000103.
Solution: check if the node which the pointer points to has been freed or not been allocated.
| #define LOS_ERRNO_MEMCHECK_OUTSIDE LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x2) |
memcheck error code: the pointer address is not in the suitable range.
Value: 0x02000102.
Solution: check pointer and comfirm it is in stack.
| #define LOS_ERRNO_MEMCHECK_PARA_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x1) |
memcheck error code: the pointer or pool is NULL.
Value: 0x02000101.
Solution: don't give a NULL parameter.
| #define LOS_ERRNO_MEMCHECK_WRONG_LEVEL LOS_ERRNO_OS_ERROR(LOS_MOD_MEM, 0x4) |
memcheck error code: the memcheck level is wrong.
Value: 0x02000104.
Solution: check the memcheck level by the function "LOS_MemCheckLevelGet".
| #define LOS_MEM_CHECK_LEVEL_DEFAULT LOS_MEM_CHECK_LEVEL_DISABLE |
Define a mem size check intensity.
default intensity set mem check.
| #define LOS_MEM_CHECK_LEVEL_DISABLE 0xff |
Define a mem size check intensity
disable mem check.
| #define LOS_MEM_CHECK_LEVEL_HIGH 1 |
Define a mem size check intensity
Highest mem check.
| #define LOS_MEM_CHECK_LEVEL_LOW 0 |
Define a mem size check intensity
Lowest mem check.
| #define LOS_MEM_INIT_ATTR_SLAB_POS 0U |
The attributes to config memory pool. Bit 0 is used to config the memory pool containing slab. The other 31 bits are reserved now.
| #define MEM_MODULE_MAX 0x20 |
The memory usage statistics depend on module, this is the max module number 0x20. Note that this macro is defined only when LOSCFG_MEM_MUL_MODULE is defined.
| #define OS_SYS_MEM_ADDR (&__heap_start) |
Starting address of the system memory
| #define OS_SYS_MEM_SIZE |
Memory size
| typedef void(* MALLOC_HOOK) (void) |
Define the type of the customized tuning function when calling the API LOS_MemAlloc to allocate memory.
| None. |
| None. |
|
extern |
Allocate dynamic memory.
| pool | [IN] Pointer to the memory pool that contains the memory block to be allocated. |
| size | [IN] Size of the memory block to be allocated (unit: byte). |
| NULL | The memory fails to be allocated. |
| #VOID* | The memory is successfully allocated, and the API returns the pointer to the allocated memory block. |
Allocate aligned memory.
| pool | [IN] Pointer to the memory pool that contains the memory blocks to be allocated. |
| size | [IN] Size of the memory to be allocated. |
| boundary | [IN] Boundary on which the memory is aligned. |
| NULL | The memory fails to be allocated. |
| #VOID* | The memory is successfully allocated, and the API returns the pointer to the allocated memory. |
|
extern |
Deinitialize dynamic memory.
| pool | [IN] Starting address of memory. |
| LOS_NOK | The dynamic memory fails to be deinitialized. |
| LOS_OK | The dynamic memory is successfully deinitialized. |
|
extern |
Free dynamic memory.
| pool | [IN] Pointer to the memory pool that contains the dynamic memory block to be freed. |
| ptr | [IN] Starting address of the memory block to be freed. |
| LOS_NOK | The memory block fails to be freed because the starting address of the memory block is invalid, or the memory overwriting occurs. |
| LOS_OK | The memory block is successfully freed. |
|
extern |
Get the number of free memory nodes.
| pool | [IN] A pointer pointed to the memory pool. |
|
extern |
Get the number of free node in every size.
| pool | [IN] A pointer pointed to the memory pool. |
| LOS_NOK | The input parameter pool is NULL. |
| LOS_OK | Print the number of free node in every size successfully. |
|
extern |
Get the information of memory pool.
| pool | [IN] A pointer pointed to the memory pool. |
| poolStatus | [OUT] A pointer for storage the pool status |
Initialize dynamic memory.
| pool | [IN] Starting address of memory. |
| size | [IN] Memory size. |
| LOS_NOK | The dynamic memory fails to be initialized. |
| LOS_OK | The dynamic memory is successfully initialized. |
|
extern |
Check the memory pool integrity.
| pool | [IN] A pointer to the memory pool. |
|
extern |
Get the address of the next byte of the last used byte.
| pool | [IN] A pointer pointed to the memory pool. |
| LOS_NOK | The input parameter pool is NULL. |
| UINTPTR | The pointer to the next byte of the last used byte. |
Allocate dynamic memory.
| pool | [IN] Pointer to the memory pool that contains the memory block to be allocated. |
| size | [IN] Size of the memory block to be allocated (unit: byte). |
| moduleId | [IN] module ID (0~MODULE_MAX). |
| NULL | The memory fails to be allocated. |
| #VOID* | The memory is successfully allocated, and the API returns the pointer to the allocated memory block. |
Allocate aligned memory.
| pool | [IN] Pointer to the memory pool that contains the memory blocks to be allocated. |
| size | [IN] Size of the memory to be allocated. |
| boundary | [IN] Boundary on which the memory is aligned. |
| moduleId | [IN] module ID (0~MODULE_MAX). |
| NULL | The memory fails to be allocated. |
| #VOID* | The memory is successfully allocated, and the API returns the pointer to the allocated memory. |
Free dynamic memory.
| pool | [IN] Pointer to the memory pool that contains the dynamic memory block to be freed. |
| ptr | [IN] Starting address of the memory block to be freed. |
| moduleId | [IN] module ID (0~MODULE_MAX). |
| LOS_NOK | The memory block fails to be freed because the starting address of the memory block is invalid, or the memory overwriting occurs. |
| LOS_OK | The memory block is freed successfully. |
Re-allocate a memory block.
| pool | [IN] Pointer to the memory pool that contains the original and new memory blocks. |
| ptr | [IN] Address of the original memory block. |
| size | [IN] Size of the new memory block. |
| moduleId | [IN] module ID (0~MODULE_MAX). |
| NULL | The memory fails to be re-allocated. |
| #VOID* | The memory is successfully re-allocated, and the API returns the pointer to the new memory block. |
get the used memory size of the specified module.
| moduleId | [IN] module ID (0~MODULE_MAX). |
| UINT32 | The size of the specified module's consumed memory. |
| OS_NULL_INT | The input module id is illegal. |
Initialize dynamic memory.
| pool | [IN] Starting address of memory. |
| size | [IN] Memory size. |
| attr | [IN] Attributes to config memory pool, see LOS_MEM_INIT_ATTR_SLAB_MSK above. |
| LOS_NOK | The dynamic memory fails to be initialized. |
| LOS_OK | The dynamic memory is successfully initialized. |
|
extern |
Print information about all pools.
| None. |
| UINT32 | The pool number. |
|
extern |
Get the size of memory pool's size.
| pool | [IN] A pointer pointed to the memory pool. |
|
extern |
Re-allocate a memory block.
| pool | [IN] Pointer to the memory pool that contains the original and new memory blocks. |
| ptr | [IN] Address of the original memory block. |
| size | [IN] Size of the new memory block. |
| NULL | The memory fails to be re-allocated. |
| #VOID* | The memory is successfully re-allocated, and the API returns the pointer to the new memory block. |
|
extern |
Get the task ID of a used memory node.
| ptr | [IN] A used memory node. |
| OS_INVALID | The input parameter ptr is illegal. |
| UINT32 | The task ID of used memory node ptr. |
|
extern |
Get the size of memory totally used.
| pool | [IN] A pointer pointed to the memory pool. |
|
extern |
Get the number of used memory nodes.
| pool | [IN] A pointer pointed to the memory pool. |
| OS_INVALID | The input parameter pool is NULL. |
| UINT32 | The number of used memory nodes. |
|
extern |
Customized tuning function when calling the API LOS_MemAlloc to allocate memory.
|
extern |
The start address of exception interaction dynamic memory pool address, when the exception interaction feature not support, m_aucSysMem0 equals to m_aucSysMem1.
|
extern |
The start address of system dynamic memory pool address.