fix: kernel接口融合,添加/修改kernel函数

kernel接口融合,添加/修改kernel函数

BREAKING CHANGE:
新增接口:
LOS_TaskResRecycle
LOS_CurrNanosec
LOS_MDelay
接口修改:
LOS_QueueCreate:第一个入参添加const修饰并增加一种异常情况处理
los_memory.c中 OS_ERROR 修改为LOS_NOK,重定义LOS_NOK为(UINT32)-1。
接口位置转移:
LOS_UDelay 由los_task.h/.c 转移到los_tick.h/.c 
宏修改:
LOS_ERRNO_MUX_PEND_INTERR 改名为 LOS_ERRNO_MUX_IN_INTERR
增加宏:

Signed-off-by: LiteOS2021 <dinglu@huawei.com>
This commit is contained in:
LiteOS2021
2022-02-14 11:28:19 +08:00
parent b423d9f7bb
commit cee9714a90
48 changed files with 1306 additions and 88 deletions

View File

@@ -36,6 +36,7 @@
#include "los_swtmr.h"
#include "los_sched.h"
#include "los_debug.h"
#include "stdint.h"
LITE_OS_SEC_BSS STATIC ArchTickTimer *g_sysTickTimer = NULL;
LITE_OS_SEC_BSS UINT32 g_ticksPerSec;
@@ -347,3 +348,58 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpuTick2US(CpuTick *cpuTick, UINT32 *usHi, UINT32
return LOS_OK;
}
/*****************************************************************************
Function : LOS_MS2Tick
Description : get current nanoseconds
Input : None
Output : None
Return : nanoseconds
*****************************************************************************/
UINT64 LOS_CurrNanosec(VOID)
{
UINT64 nanos;
nanos = LOS_SysCycleGet() * (OS_SYS_NS_PER_SECOND / OS_SYS_NS_PER_MS) / (g_sysClock / OS_SYS_NS_PER_MS);
return nanos;
}
/*****************************************************************************
Function : LOS_UDelay
Description : cpu delay function
Input : microseconds ---------- microseconds
Output : None
Return : None
*****************************************************************************/
VOID LOS_UDelay(UINT64 microseconds)
{
UINT64 endTime;
if (microseconds == 0) {
return;
}
endTime = (microseconds / OS_SYS_US_PER_SECOND) * g_sysClock +
(microseconds % OS_SYS_US_PER_SECOND) * g_sysClock / OS_SYS_US_PER_SECOND;
endTime = LOS_SysCycleGet() + endTime;
while (LOS_SysCycleGet() < endTime) {
}
return;
}
/*****************************************************************************
Function : LOS_MDelay
Description : cpu delay function
Input : millisec ---------- milliseconds
Output : None
Return : None
*****************************************************************************/
VOID LOS_MDelay(UINT32 millisec)
{
UINT32 delayUs = (UINT32_MAX / OS_SYS_US_PER_MS) * OS_SYS_US_PER_MS;
while (millisec > UINT32_MAX / OS_SYS_US_PER_MS) {
LOS_UDelay(delayUs);
millisec -= (UINT32_MAX / OS_SYS_US_PER_MS);
}
LOS_UDelay(millisec * OS_SYS_US_PER_MS);
return;
}