fix:Provide a CPU delay interface

Close #I3NT3Y

Change-Id: I30c984a95a77cbddabdae2900ab8fcf9d7eac1ac
This commit is contained in:
zhushengle 2021-04-23 14:50:27 +08:00
parent 18aa697589
commit 583d177de0
2 changed files with 15 additions and 1 deletions

View File

@ -639,7 +639,7 @@ osStatus_t osDelay(uint32_t ticks)
return osOK; return osOK;
} }
if (osKernelGetState() != osKernelRunning) { if (osKernelGetState() != osKernelRunning) {
HalDelay(ticks); LOS_SysDelay(ticks);
} else { } else {
uwRet = LOS_TaskDelay(ticks); uwRet = LOS_TaskDelay(ticks);
} }

View File

@ -1296,3 +1296,17 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Msleep(UINT32 mSecs)
(VOID)LOS_TaskDelay(interval); (VOID)LOS_TaskDelay(interval);
} }
VOID LOS_SysDelay(UINT32 ticks)
{
UINT64 endTime;
if (ticks == 0) {
return;
}
endTime = LOS_SysCycleGet() + ticks * OS_CYCLE_PER_TICK;
while (LOS_SysCycleGet() < endTime) {
}
return;
}