提交 adaf6cf7 编写于 作者: 星e雨's avatar 星e雨

fix:Change the interface to LOS_UDelay and change the input parameter to microsecond.

Close #I3NT3Y

Change-Id: Iae33e0aff59480342b07bb4fd2e66969a09affb3
上级 9656d852
......@@ -639,7 +639,7 @@ osStatus_t osDelay(uint32_t ticks)
return osOK;
}
if (osKernelGetState() != osKernelRunning) {
LOS_SysDelay(ticks);
LOS_UDelay(ticks * OS_US_PER_TICK);
} else {
uwRet = LOS_TaskDelay(ticks);
}
......
......@@ -67,9 +67,7 @@ VOID HalClearSysSleepFlag(VOID);
VOID HalEnterSleep(LOS_SysSleepEnum sleep);
VOID HalDelay(UINT32 ticks);
/**
/**
* @ingroup los_timer
* @brief Get systick cycle.
*
......
......@@ -1098,14 +1098,14 @@ extern CHAR* LOS_TaskNameGet(UINT32 taskID);
* @attention:
* <ul><li>None.</li></ul>
*
* @param ticks [IN] delay times.
* @param UINT64 [IN] delay times, microseconds.
*
* @retval: None.
* @par Dependency:
* <ul><li>los_task.h: the header file that contains the API declaration.</li></ul>
* @see None.
*/
extern VOID LOS_SysDelay(UINT32 ticks);
extern VOID LOS_UDelay(UINT64 microseconds);
/**
* @ingroup los_cpup
......
......@@ -1296,15 +1296,17 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Msleep(UINT32 mSecs)
(VOID)LOS_TaskDelay(interval);
}
VOID LOS_SysDelay(UINT32 ticks)
VOID LOS_UDelay(UINT64 microseconds)
{
UINT64 endTime;
if (ticks == 0) {
if (microseconds == 0) {
return;
}
endTime = LOS_SysCycleGet() + ticks * OS_CYCLE_PER_TICK;
endTime = (microseconds / OS_SYS_US_PER_SECOND) * OS_SYS_CLOCK +
(microseconds % OS_SYS_US_PER_SECOND) * OS_SYS_CLOCK / OS_SYS_US_PER_SECOND;
endTime = LOS_SysCycleGet() + endTime;
while (LOS_SysCycleGet() < endTime) {
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册