fix: 低功耗tick timer休眠时间计算有误
Signed-off-by: zhushengle <zhushengle@huawei.com> Change-Id: I3dfa2a8ec7562a1182dae74cc706c7a660ae867a
This commit is contained in:
parent
f29973e995
commit
8550117b01
|
@ -101,7 +101,7 @@ STATIC VOID OsPmTickTimerStart(LosPmCB *pm)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
||||||
if (tickTimer->timerStop != NULL) {
|
if ((tickTimer->timerStop != NULL) && (pm->enterSleepTime != 0)) {
|
||||||
/* Restore the main CPU frequency */
|
/* Restore the main CPU frequency */
|
||||||
sleepTime = tickTimer->timerCycleGet();
|
sleepTime = tickTimer->timerCycleGet();
|
||||||
tickTimer->timerStop();
|
tickTimer->timerStop();
|
||||||
|
@ -123,8 +123,9 @@ STATIC VOID OsPmTickTimerStart(LosPmCB *pm)
|
||||||
STATIC BOOL OsPmTickTimerStop(LosPmCB *pm)
|
STATIC BOOL OsPmTickTimerStop(LosPmCB *pm)
|
||||||
{
|
{
|
||||||
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
||||||
UINT64 sleepCycle;
|
UINT64 sleepCycle, realSleepTime;
|
||||||
UINT64 realSleepTime = OsSchedGetNextExpireTime(OsGetCurrSchedTimeCycle());
|
UINT64 currTime = OsGetCurrSchedTimeCycle();
|
||||||
|
UINT64 expireTime = OsSchedGetNextExpireTime(currTime);
|
||||||
#endif
|
#endif
|
||||||
LosPmTickTimer *tickTimer = pm->tickTimer;
|
LosPmTickTimer *tickTimer = pm->tickTimer;
|
||||||
|
|
||||||
|
@ -134,10 +135,9 @@ STATIC BOOL OsPmTickTimerStop(LosPmCB *pm)
|
||||||
|
|
||||||
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
#if (LOSCFG_BASE_CORE_TICK_WTIMER == 0)
|
||||||
if (tickTimer->timerStart != NULL) {
|
if (tickTimer->timerStart != NULL) {
|
||||||
if (realSleepTime == 0) {
|
LOS_ASSERT(expireTime > currTime);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
realSleepTime = expireTime - currTime;
|
||||||
sleepCycle = OS_SYS_CYCLE_TO_NS(realSleepTime, g_sysClock);
|
sleepCycle = OS_SYS_CYCLE_TO_NS(realSleepTime, g_sysClock);
|
||||||
sleepCycle = OS_SYS_NS_TO_CYCLE(sleepCycle, tickTimer->freq);
|
sleepCycle = OS_SYS_NS_TO_CYCLE(sleepCycle, tickTimer->freq);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue