Description: Sync liteos_m to OpenHarmony.

Reviewed-by: likailong
This commit is contained in:
huangjieliang
2021-01-29 11:02:40 +08:00
parent b030e0e8e2
commit 25b432927c
66 changed files with 7645 additions and 959 deletions

86
kernel/include/los_config.h Normal file → Executable file
View File

@@ -120,7 +120,7 @@ extern "C" {
* If LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT is set to 0, vector base address will not be
* modified by system. In arm, it should be noted that PendSV_Handler and SysTick_Handler should
* be redefined to HalPendSV and OsTickHandler respectly in this case, because system depends on
* these interrupt handlers to run normally. What's more, LOS_HwiCreate will not register handlers.
* these interrupt handlers to run normally. What's more, LOS_HwiCreate will not register handler.
*/
#ifndef LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT
#define LOSCFG_USE_SYSTEM_DEFINED_INTERRUPT 1
@@ -348,14 +348,6 @@ extern "C" {
#endif
#endif
/**
* @ingroup los_config
* Max number of software timers ID
*/
#ifndef OS_SWTMR_MAX_TIMERID
#define OS_SWTMR_MAX_TIMERID ((65535 / LOSCFG_BASE_CORE_SWTMR_LIMIT) * LOSCFG_BASE_CORE_SWTMR_LIMIT)
#endif
/**
* @ingroup los_config
* Maximum size of a software timer queue
@@ -382,12 +374,20 @@ extern "C" {
============================================================================= */
extern UINT8 *m_aucSysMem0;
/**
* @ingroup los_config
* Configure whether the kernel uses external heap memory
*/
#ifndef LOSCFG_SYS_EXTERNAL_HEAP
#define LOSCFG_SYS_EXTERNAL_HEAP 0
#endif
/**
* @ingroup los_config
* Starting address of the memory
*/
#ifndef OS_SYS_MEM_ADDR
#define OS_SYS_MEM_ADDR (&m_aucSysMem0[0])
#ifndef LOSCFG_SYS_HEAP_ADDR
#define LOSCFG_SYS_HEAP_ADDR (&m_aucSysMem0[0])
#endif
/**
@@ -395,25 +395,15 @@ extern UINT8 *m_aucSysMem0;
* Starting address of the task stack
*/
#ifndef OS_TASK_STACK_ADDR
#define OS_TASK_STACK_ADDR OS_SYS_MEM_ADDR
#define OS_TASK_STACK_ADDR LOSCFG_SYS_HEAP_ADDR
#endif
/**
* @ingroup los_config
* Ending address of the memory
*/
extern UINT32 g_sysMemAddrEnd;
/**
* @ingroup los_config
* Memory size
*/
#ifndef OS_SYS_MEM_SIZE
#define OS_SYS_MEM_SIZE 0x10000UL
#endif
#ifndef LOSCFG_MEMORY_BESTFIT
#define LOSCFG_MEMORY_BESTFIT 1
#ifndef LOSCFG_SYS_HEAP_SIZE
#define LOSCFG_SYS_HEAP_SIZE 0x10000UL
#endif
/**
@@ -424,6 +414,14 @@ extern UINT32 g_sysMemAddrEnd;
#define LOSCFG_MEM_MUL_POOL 1
#endif
/**
* @ingroup los_config
* Configuration module tailoring of memory released by task id
*/
#ifndef LOSCFG_MEM_FREE_BY_TASKID
#define LOSCFG_MEM_FREE_BY_TASKID 0
#endif
/**
* @ingroup los_config
* Configuration module tailoring of mem node integrity checking
@@ -434,18 +432,26 @@ extern UINT32 g_sysMemAddrEnd;
/**
* @ingroup los_config
* Configuration module tailoring of mem node size checking
* Configuration memory leak detection
*/
#ifndef LOSCFG_BASE_MEM_NODE_SIZE_CHECK
#define LOSCFG_BASE_MEM_NODE_SIZE_CHECK 0
#ifndef LOSCFG_MEM_LEAKCHECK
#define LOSCFG_MEM_LEAKCHECK 0
#endif
/**
* @ingroup los_config
* Configuration of memory statistics
* Configuration memory leak recorded num
*/
#ifndef LOSCFG_KERNEL_MEM_STATISTICS
#define LOSCFG_KERNEL_MEM_STATISTICS 0
#ifndef LOSCFG_MEM_LEAKCHECK_RECORD_MAX_NUM
#define LOSCFG_MEM_LEAKCHECK_RECORD_MAX_NUM 1024
#endif
/**
* @ingroup los_config
* Configuration of memory pool record memory consumption waterline
*/
#ifndef LOSCFG_MEM_WATERLINE
#define LOSCFG_MEM_WATERLINE 1
#endif
/**
@@ -456,14 +462,6 @@ extern UINT32 g_sysMemAddrEnd;
#define OS_SYS_MEM_NUM 20
#endif
/**
* @ingroup los_config
* Configuration heap memory peak statistics
*/
#ifndef LOSCFG_HEAP_MEMORY_PEAK_STATISTICS
#define LOSCFG_HEAP_MEMORY_PEAK_STATISTICS 1
#endif
/**
* @ingroup los_config
* Size of unaligned memory
@@ -523,7 +521,7 @@ extern UINT32 g_sysMemAddrEnd;
* Configuration CMSIS_OS_VER
*/
#ifndef CMSIS_OS_VER
#define CMSIS_OS_VER 1
#define CMSIS_OS_VER 2
#endif
/* =============================================================================
@@ -537,6 +535,16 @@ extern UINT32 g_sysMemAddrEnd;
#define LOSCFG_KERNEL_TRACE 0
#endif
/* =============================================================================
printf configuration
============================================================================= */
/**
* @ingroup los_config
* Configuration liteos printf
*/
#ifndef LOSCFG_KERNEL_PRINTF
#define LOSCFG_KERNEL_PRINTF 1
#endif
#ifdef __cplusplus
#if __cplusplus

154
kernel/include/los_membox.h Normal file → Executable file
View File

@@ -29,39 +29,67 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @defgroup los_membox Static memory
* @ingroup kernel
*/
#ifndef _LOS_MEMBOX_H
#define _LOS_MEMBOX_H
#if (LOSCFG_PLATFORM_EXC == 1)
#include "los_memory.h"
#endif
#include "los_config.h"
#include "los_debug.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define OS_MEMBOX_NEXT(addr, blkSize) (LOS_MEMBOX_NODE *)(VOID *)((UINT8 *)(addr) + (blkSize))
#define OS_MEMBOX_NODE_HEAD_SIZE sizeof(LOS_MEMBOX_NODE)
#define BOX_ALIGN_8 0x80000000
/* ----------------------------------------------------------------------------
* Global Functions
* --------------------------------------------------------------------------- */
/**
* @ingroup los_membox
* Define whether to check the address validity
* Structure of a free node in a memory pool
*/
#if (LOSCFG_PLATFORM_EXC == 0)
#define LOS_MEMBOX_CHECK
extern UINT8 g_memMang[];
typedef struct tagMEMBOX_NODE {
struct tagMEMBOX_NODE *pstNext; /**< Free node's pointer to the next node in a memory pool */
} LOS_MEMBOX_NODE;
/**
* @ingroup los_membox
* Memory pool information structure
*/
typedef struct LOS_MEMBOX_INFO {
UINT32 uwBlkSize; /**< Block size */
UINT32 uwBlkNum; /**< Block number */
UINT32 uwBlkCnt; /**< The number of allocated blocks */
#if (LOSCFG_PLATFORM_EXC == 1)
struct LOS_MEMBOX_INFO *nextMemBox; /**< Point to the next membox */
#endif
LOS_MEMBOX_NODE stFreeList; /**< Free list */
} LOS_MEMBOX_INFO;
typedef LOS_MEMBOX_INFO OS_MEMBOX_S;
#if (LOSCFG_PLATFORM_EXC == 1)
UINT32 OsMemboxExcInfoGet(UINT32 memNumMax, MemInfoCB *memExcInfo);
#endif
typedef struct tagMemBoxCB {
UINT32 uwMaxBlk;
UINT32 uwBlkCnt;
UINT32 uwBlkSize; /* Memory block size */
}OS_MEMBOX_S;
/**
* @ingroup los_membox
* Memory pool alignment
*/
#define LOS_MEMBOX_ALLIGNED(memAddr) (((UINTPTR)(memAddr) + sizeof(UINTPTR) - 1) & (~(sizeof(UINTPTR) - 1)))
typedef OS_MEMBOX_S *OS_MEMBOX_S_P;
#ifdef LOS_MEMBOX_CHECK
#define LOS_MEMBOX_MAGIC_SIZE 4
#else
#define LOS_MEMBOX_MAGIC_SIZE 0
#endif
/**
* @ingroup los_membox
* Memory pool size
*/
#define LOS_MEMBOX_SIZE(blkSize, blkNum) \
(sizeof(LOS_MEMBOX_INFO) + (LOS_MEMBOX_ALLIGNED((blkSize) + OS_MEMBOX_NODE_HEAD_SIZE) * (blkNum)))
/**
* @ingroup los_membox
@@ -73,13 +101,14 @@ typedef OS_MEMBOX_S *OS_MEMBOX_S_P;
* </ul>
* @attention
* <ul>
* <li>The boxSize parameter value should match the following two conditions :</li>
* <li>1) Be less than or equal to the Memory pool size; 2) Be greater than the size of LOS_MEMBOX_INFO.</li>
* <li>The poolSize parameter value should match the following two conditions :
* 1) Be less than or equal to the Memory pool size;
* 2) Be greater than the size of LOS_MEMBOX_INFO.</li>
* </ul>
*
* @param boxMem [IN] Memory pool address.
* @param boxSize [IN] Memory pool size.
* @param blkSize [IN] Memory block size.
* @param pool [IN] Memory pool address.
* @param poolSize [IN] Memory pool size.
* @param blkSize [IN] Memory block size.
*
* @retval #LOS_NOK The memory pool fails to be initialized.
* @retval #LOS_OK The memory pool is successfully initialized.
@@ -89,7 +118,7 @@ typedef OS_MEMBOX_S *OS_MEMBOX_S_P;
* </ul>
* @see None.
*/
extern UINT32 LOS_MemboxInit(VOID *boxMem, UINT32 boxSize, UINT32 blkSize);
extern UINT32 LOS_MemboxInit(VOID *pool, UINT32 poolSize, UINT32 blkSize);
/**
* @ingroup los_membox
@@ -104,7 +133,7 @@ extern UINT32 LOS_MemboxInit(VOID *boxMem, UINT32 boxSize, UINT32 blkSize);
* <li>The input pool parameter must be initialized via func LOS_MemboxInit.</li>
* </ul>
*
* @param boxMem [IN] Memory pool address.
* @param pool [IN] Memory pool address.
*
* @retval #VOID* The request is accepted, and return a memory block address.
* @retval #NULL The request fails.
@@ -114,7 +143,7 @@ extern UINT32 LOS_MemboxInit(VOID *boxMem, UINT32 boxSize, UINT32 blkSize);
* </ul>
* @see LOS_MemboxFree
*/
extern VOID *LOS_MemboxAlloc(VOID *boxMem);
extern VOID *LOS_MemboxAlloc(VOID *pool);
/**
* @ingroup los_membox
@@ -127,11 +156,11 @@ extern VOID *LOS_MemboxAlloc(VOID *boxMem);
* @attention
* <ul>
* <li>The input pool parameter must be initialized via func LOS_MemboxInit.</li>
* <li>The input pBox parameter must be allocated by LOS_MemboxAlloc.</li>
* <li>The input box parameter must be allocated by LOS_MemboxAlloc.</li>
* </ul>
*
* @param boxMem [IN] Memory pool address.
* @param box [IN] Memory block address.
* @param pool [IN] Memory pool address.
* @param box [IN] Memory block address.
*
* @retval #LOS_NOK This memory block fails to be freed.
* @retval #LOS_OK This memory block is successfully freed.
@@ -141,7 +170,7 @@ extern VOID *LOS_MemboxAlloc(VOID *boxMem);
* </ul>
* @see LOS_MemboxAlloc
*/
extern UINT32 LOS_MemboxFree(const VOID *boxMem, VOID *box);
extern UINT32 LOS_MemboxFree(VOID *pool, VOID *box);
/**
* @ingroup los_membox
@@ -154,11 +183,11 @@ extern UINT32 LOS_MemboxFree(const VOID *boxMem, VOID *box);
* @attention
* <ul>
* <li>The input pool parameter must be initialized via func LOS_MemboxInit.</li>
* <li>The input pBox parameter must be allocated by LOS_MemboxAlloc.</li>
* <li>The input box parameter must be allocated by LOS_MemboxAlloc.</li>
* </ul>
*
* @param boxMem [IN] Memory pool address.
* @param box [IN] Memory block address.
* @param pool [IN] Memory pool address.
* @param box [IN] Memory block address.
*
* @retval VOID
* @par Dependency:
@@ -167,8 +196,31 @@ extern UINT32 LOS_MemboxFree(const VOID *boxMem, VOID *box);
* </ul>
* @see None.
*/
extern VOID LOS_MemboxClr(const VOID *boxMem, VOID *box);
extern VOID LOS_MemboxClr(VOID *pool, VOID *box);
/**
* @ingroup los_membox
* @brief show membox info.
*
* @par Description:
* <ul>
* <li>This API is used to show the memory pool info.</li>
* </ul>
* @attention
* <ul>
* <li>The input pool parameter must be initialized via func LOS_MemboxInit.</li>
* </ul>
*
* @param pool [IN] Memory pool address.
*
* @retval VOID
* @par Dependency:
* <ul>
* <li>los_membox.h: the header file that contains the API declaration.</li>
* </ul>
* @see None.
*/
extern VOID LOS_ShowBox(VOID *pool);
/**
* @ingroup los_membox
@@ -180,8 +232,8 @@ extern VOID LOS_MemboxClr(const VOID *boxMem, VOID *box);
* </ul>
* @attention
* <ul>
* <li>One parameter of this interface is a pointer, it should be a correct value, otherwise, the system may be
* abnormal.</li>
* <li>One parameter of this interface is a pointer, it should be a correct value, otherwise, the system may
* be abnormal.</li>
* </ul>
*
* @param boxMem [IN] Type #VOID* Pointer to the calculate membox.
@@ -197,18 +249,10 @@ extern VOID LOS_MemboxClr(const VOID *boxMem, VOID *box);
*/
extern UINT32 LOS_MemboxStatisticsGet(const VOID *boxMem, UINT32 *maxBlk, UINT32 *blkCnt, UINT32 *blkSize);
#define OS_MEMBOX_NEXT(addr, blkSize) (LOS_MEMBOX_NODE *)((UINT8 *)(addr) + (blkSize))
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef LOS_MEMBOX_CHECK
#define OS_MEMBOX_MAGIC 0xa55a5aa5
#define OS_MEMBOX_SET_MAGIC(addr) (*((UINT32 *)(addr)) = OS_MEMBOX_MAGIC)
#define OS_MEMBOX_CHECK_MAGIC(addr) ((*((UINT32 *)(addr)) == OS_MEMBOX_MAGIC) ? LOS_OK : LOS_NOK)
#else
#define OS_MEMBOX_SET_MAGIC(addr)
#define OS_MEMBOX_CHECK_MAGIC(addr) LOS_OK
#endif
#define OS_MEMBOX_USER_ADDR(addr) ((VOID *)((UINT8 *)(addr) + LOS_MEMBOX_MAGIC_SIZE))
#define OS_MEMBOX_NODE_ADDR(addr) ((LOS_MEMBOX_NODE *)((UINT8 *)(addr) - LOS_MEMBOX_MAGIC_SIZE))
#endif
#endif /* _LOS_MEMBOX_H */

94
kernel/include/los_memory.h Normal file → Executable file
View File

@@ -39,6 +39,7 @@
#include "los_config.h"
#include "los_list.h"
#include "los_debug.h"
#ifdef __cplusplus
#if __cplusplus
@@ -46,33 +47,53 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef LOSCFG_MEM_LEAKCHECK
/**
* @ingroup los_memory
* The omit layers of function call from call kernel memory interfaces
* such as LOS_MemAlloc/LOS_MemAllocAlign/LOS_MemRealloc/LOS_MemFree.
*/
#define LOS_OMIT_LR_CNT 2
/**
* @ingroup los_memory
* The recored layes of function call.
*/
#define LOS_RECORD_LR_CNT 3
#if (LOSCFG_PLATFORM_EXC == 1)
UINT32 OsMemExcInfoGet(UINT32 memNumMax, MemInfoCB *memExcInfo);
#endif
/**
* @ingroup los_memory
* The memory Maximum memory usage statistics.
* @attention
* <ul> <li>If running as debug mode, it will affect the performance of memory malloc and free.</li>
* <li> OS_MEM_WATERLINE=YES: open the function for Maximum memory usage statistics </li>
* <li> OS_MEM_WATERLINE=NO: close the function for Maximum memory usage statistics, it set to NO as usual </li>
* </ul>
* Starting address of the memory.
*/
#ifdef LOSCFG_MEM_WATERLINE
#define OS_MEM_WATERLINE NO
#define OS_SYS_MEM_ADDR LOSCFG_SYS_HEAP_ADDR
#if (LOSCFG_MEM_LEAKCHECK == 1)
/**
* @ingroup los_memory
* The default is 5, which means that the function call stack is recorded from the kernel interface,</li>
* such as LOS_MemAlloc/LOS_MemAllocAlign/LOS_MemRealloc/LOS_MemFree. If you want to further ignore</li>
* the number of function call layers, you can increase this value appropriately.
*
*/
#define LOS_OMIT_LR_CNT 5
/**
* @ingroup los_memory
* The record number of layers of the function call relationship starting from the number of</li>
* ignored layers(LOS_OMIT_LR_CNT).
*/
#define LOS_RECORD_LR_CNT 3
/**
* @ingroup los_memory
* @brief Print function call stack information of all used nodes.
*
* @par Description:
* <ul>
* <li>This API is used to print function call stack information of all used nodes.</li>
* </ul>
*
* @param pool [IN] Starting address of memory.
*
* @retval none.
* @par Dependency:
* <ul>
* <li>los_memory.h: the header file that contains the API declaration.</li>
* </ul>
* @see None.
*/
extern VOID LOS_MemUsedNodeShow(VOID *pool);
#endif
#if (LOSCFG_MEM_MUL_POOL == 1)
@@ -126,7 +147,7 @@ typedef struct {
UINT32 maxFreeNodeSize;
UINT32 usedNodeNum;
UINT32 freeNodeNum;
#if defined(OS_MEM_WATERLINE) && (OS_MEM_WATERLINE == YES)
#if (LOSCFG_MEM_WATERLINE == 1)
UINT32 usageWaterLine;
#endif
} LOS_MEM_POOL_STATUS;
@@ -396,6 +417,33 @@ extern UINT32 LOS_MemFreeNodeShow(VOID *pool);
*/
extern UINT32 LOS_MemIntegrityCheck(const VOID *pool);
/**
* @ingroup los_memory
* @brief Enable memory pool to support no internal lock during using interfaces.
*
* @par Description:
* <ul>
* <li>This API is used to enable memory pool to support no internal lock during using interfaces,</li>
* <li>such as LOS_MemAlloc/LOS_MemAllocAlign/LOS_MemRealloc/LOS_MemFree and so on.
* </ul>
* @attention
* <ul>
* <li>The memory pool does not support multi-threaded concurrent application scenarios.
* <li>If you want to use this function, you need to call this interface before the memory
* pool is used, it cannot be called during the trial period.</li>
* </ul>
*
* @param pool [IN] Starting address of memory.
*
* @retval node.
* @par Dependency:
* <ul>
* <li>los_memory.h: the header file that contains the API declaration.</li>
* </ul>
* @see None.
*/
extern VOID LOS_MemUnlockEnable(VOID *pool);
extern UINT32 OsMemSystemInit(VOID);
#ifdef __cplusplus

26
kernel/include/los_swtmr.h Normal file → Executable file
View File

@@ -273,7 +273,7 @@ typedef struct tagSwTmrCtrl {
UINT8 ucRouses; /* wake up enable */
UINT8 ucSensitive; /* align enable */
#endif
UINT16 usTimerID; /* Software timer ID */
UINT32 usTimerID; /* Software timer ID */
UINT32 uwCount; /* Times that a software timer works */
UINT32 uwInterval; /* Timeout interval of a periodic software timer */
UINT32 uwArg; /* Parameter passed in when the callback function
@@ -293,8 +293,7 @@ typedef struct tagSwTmrCtrl {
* <li>The specific timer must be created first</li>
* </ul>
*
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in
* [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1].
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate.
*
* @retval #LOS_ERRNO_SWTMR_ID_INVALID Invalid software timer ID.
* @retval #LOS_ERRNO_SWTMR_NOT_CREATED The software timer is not created.
@@ -304,7 +303,7 @@ typedef struct tagSwTmrCtrl {
* <ul><li>los_swtmr.h: the header file that contains the API declaration.</li></ul>
* @see LOS_SwtmrStop | LOS_SwtmrCreate
*/
extern UINT32 LOS_SwtmrStart(UINT16 swtmrID);
extern UINT32 LOS_SwtmrStart(UINT32 swtmrID);
/**
* @ingroup los_swtmr
@@ -317,8 +316,7 @@ extern UINT32 LOS_SwtmrStart(UINT16 swtmrID);
* <li>The specific timer should be created and started firstly.</li>
* </ul>
*
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in
* [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1].
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate.
*
* @retval #LOS_ERRNO_SWTMR_ID_INVALID Invalid software timer ID.
* @retval #LOS_ERRNO_SWTMR_NOT_CREATED The software timer is not created.
@@ -329,7 +327,7 @@ extern UINT32 LOS_SwtmrStart(UINT16 swtmrID);
* <ul><li>los_swtmr.h: the header file that contains the API declaration.</li></ul>
* @see LOS_SwtmrStart | LOS_SwtmrCreate
*/
extern UINT32 LOS_SwtmrStop(UINT16 swtmrID);
extern UINT32 LOS_SwtmrStop(UINT32 swtmrID);
/**
* @ingroup los_swtmr
@@ -343,8 +341,7 @@ extern UINT32 LOS_SwtmrStop(UINT16 swtmrID);
* <li>The specific timer should be created and started successfully, error happends otherwise.</li>
* </ul>
*
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in
* [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1].
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate.
* @param tick [OUT] Number of remaining Ticks configured on the software timer.
*
* @retval #LOS_ERRNO_SWTMR_ID_INVALID Invalid software timer ID.
@@ -356,7 +353,7 @@ extern UINT32 LOS_SwtmrStop(UINT16 swtmrID);
* <ul><li>los_swtmr.h: the header file that contains the API declaration.</li></ul>
* @see LOS_SwtmrCreate
*/
extern UINT32 LOS_SwtmrTimeGet(UINT16 swtmrID, UINT32 *tick);
extern UINT32 LOS_SwtmrTimeGet(UINT32 swtmrID, UINT32 *tick);
/**
* @ingroup los_swtmr
@@ -395,7 +392,7 @@ extern UINT32 LOS_SwtmrTimeGet(UINT16 swtmrID, UINT32 *tick);
extern UINT32 LOS_SwtmrCreate(UINT32 interval,
UINT8 mode,
SWTMR_PROC_FUNC handler,
UINT16 *swtmrID,
UINT32 *swtmrID,
UINT32 arg,
UINT8 rouses,
UINT8 sensitive);
@@ -403,7 +400,7 @@ extern UINT32 LOS_SwtmrCreate(UINT32 interval,
extern UINT32 LOS_SwtmrCreate(UINT32 interval,
UINT8 mode,
SWTMR_PROC_FUNC handler,
UINT16 *swtmrID,
UINT32 *swtmrID,
UINT32 arg);
#endif
@@ -418,8 +415,7 @@ extern UINT32 LOS_SwtmrCreate(UINT32 interval,
* <li>The specific timer should be created and then stopped firstly.</li>
* </ul>
*
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in
* [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1].
* @param swtmrID [IN] Software timer ID created by LOS_SwtmrCreate.
*
* @retval #LOS_ERRNO_SWTMR_ID_INVALID Invalid software timer ID.
* @retval #LOS_ERRNO_SWTMR_NOT_CREATED The software timer is not created.
@@ -429,7 +425,7 @@ extern UINT32 LOS_SwtmrCreate(UINT32 interval,
* <ul><li>los_swtmr.h: the header file that contains the API declaration.</li></ul>
* @see LOS_SwtmrCreate
*/
extern UINT32 LOS_SwtmrDelete(UINT16 swtmrID);
extern UINT32 LOS_SwtmrDelete(UINT32 swtmrID);
/**
* @ingroup los_swtmr

43
kernel/include/los_task.h Normal file → Executable file
View File

@@ -1517,6 +1517,24 @@ extern UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E mode, UINT32 ta
*/
#define OS_TSK_SORTLINK_LEN 32
/**
* @ingroup los_task
* @brief the num of high-order bit
*/
#define OS_TSK_HIGH_BITS 5U
/**
* @ingroup los_task
* @brief the num of low-order bit
*/
#define OS_TSK_LOW_BITS (32U - OS_TSK_HIGH_BITS)
/**
* @ingroup los_task
* @brief the max num of roll
*/
#define OS_TSK_MAX_ROLLNUM (0xFFFFFFFFU - OS_TSK_SORTLINK_LEN)
/**
* @ingroup los_task
* @brief the bit width occupied by the delayed ticks of task
@@ -1527,7 +1545,19 @@ extern UINT32 LOS_CpupUsageMonitor(CPUP_TYPE_E type, CPUP_MODE_E mode, UINT32 ta
* @ingroup los_task
* @brief the mask of delayed tasks bucket id.
*/
#define OS_TSK_SORTLINK_MASK (OS_TSK_SORTLINK_LEN - 1)
#define OS_TSK_SORTLINK_MASK (OS_TSK_SORTLINK_LEN - 1U)
/**
* @ingroup los_task
* @brief the high-order mask of roll num.
*/
#define OS_TSK_HIGH_BITS_MASK (OS_TSK_SORTLINK_MASK << OS_TSK_LOW_BITS)
/**
* @ingroup los_task
* @brief the low-order mask of roll num.
*/
#define OS_TSK_LOW_BITS_MASK (~OS_TSK_HIGH_BITS_MASK)
/**
* @ingroup los_task
@@ -1620,9 +1650,9 @@ typedef struct {
} LosTask;
typedef struct {
LOS_DL_LIST *sortLink;
UINT16 cursor;
UINT16 unused;
LOS_DL_LIST *sortLink;
UINT16 cursor;
UINT16 reserved;
} TaskSortLinkAttr;
/**
@@ -1650,8 +1680,11 @@ typedef struct {
TaskCountInfo cntInfo;
UINT16 pid[OS_TASK_SWITCH_INFO_COUNT];
CHAR name[OS_TASK_SWITCH_INFO_COUNT][LOS_TASK_NAMELEN];
}TaskSwitchInfo;
} TaskSwitchInfo;
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
extern TaskSwitchInfo g_taskSwitchInfo;
#endif
extern LosTask g_losTask;