fix accuracy of LOS_CurrNanosec

Change-Id: I5612d54d3cb92a119baaec396c723734c27a9d0c
This commit is contained in:
Caoruihong 2021-04-07 22:51:03 +08:00
parent a2e59ba316
commit c2e7879dbc
1 changed files with 2 additions and 4 deletions

View File

@ -65,10 +65,8 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *highCnt, UINT32 *lowCnt)
LITE_OS_SEC_TEXT_MINOR UINT64 LOS_CurrNanosec(VOID)
{
DOUBLE nanos;
nanos = (DOUBLE)HalClockGetCycles() * OS_SYS_NS_PER_SECOND / g_sysClock;
return (UINT64)nanos;
UINT64 cycle = HalClockGetCycles();
return (cycle / g_sysClock) * OS_SYS_NS_PER_SECOND + (cycle % g_sysClock) * OS_SYS_NS_PER_SECOND / g_sysClock;
}
LITE_OS_SEC_TEXT_MINOR VOID LOS_Udelay(UINT32 usecs)