!314 fix: risc-v 低功耗下存在功能问题

Merge pull request !314 from zhushengle/list
This commit is contained in:
openharmony_ci 2021-09-18 06:14:40 +00:00 committed by Gitee
commit 25441ec1b5
5 changed files with 20 additions and 10 deletions

View File

@ -255,7 +255,7 @@ STATIC UINT32 OsPmSuspendSleep(LosPmCB *pm)
if (!tickTimerStop) { if (!tickTimerStop) {
currTime = OsGetCurrSchedTimeCycle(); currTime = OsGetCurrSchedTimeCycle();
OsSchedResetSchedResponseTime(0); OsSchedResetSchedResponseTime(0);
OsSchedSetNextExpireTime(currTime, OS_INVALID, OS_SCHED_MAX_RESPONSE_TIME, TRUE); OsSchedUpdateExpireTime(currTime, TRUE);
} }
sysSuspend = OsPmCpuSuspend(pm); sysSuspend = OsPmCpuSuspend(pm);
@ -685,8 +685,10 @@ VOID OsPmUnfreezeTaskUnsafe(UINT32 taskID)
} }
SET_SORTLIST_VALUE(&taskCB->sortList, OS_SORT_LINK_INVALID_TIME); SET_SORTLIST_VALUE(&taskCB->sortList, OS_SORT_LINK_INVALID_TIME);
if (taskCB->taskStatus & OS_TASK_STATUS_PEND) {
LOS_ListDelete(&taskCB->pendList); LOS_ListDelete(&taskCB->pendList);
taskCB->taskStatus &= ~(OS_TASK_STATUS_DELAY | OS_TASK_STATUS_PEND_TIME); }
taskCB->taskStatus &= ~(OS_TASK_STATUS_DELAY | OS_TASK_STATUS_PEND_TIME | OS_TASK_STATUS_PEND);
return; return;
} }

View File

@ -458,7 +458,6 @@ UINT32 LOS_PmReadLock(VOID);
*/ */
UINT32 LOS_PmSuspend(UINT32 wakeCount); UINT32 LOS_PmSuspend(UINT32 wakeCount);
#if (LOSCFG_KERNEL_PM_DEBUG == 1)
/** /**
* @ingroup los_pm * @ingroup los_pm
* @brief Output the locking information of the pm lock. * @brief Output the locking information of the pm lock.
@ -477,4 +476,3 @@ UINT32 LOS_PmSuspend(UINT32 wakeCount);
*/ */
VOID LOS_PmLockInfoShow(VOID); VOID LOS_PmLockInfoShow(VOID);
#endif #endif
#endif

View File

@ -52,12 +52,17 @@ WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler)
WEAK VOID HalSysTickReload(UINT64 nextResponseTime) WEAK VOID HalSysTickReload(UINT64 nextResponseTime)
{ {
UINT64 timeMax = (UINT64)LOSCFG_BASE_CORE_TICK_RESPONSE_MAX - 1;
UINT64 timer; UINT64 timer;
UINT32 timerL, timerH; UINT32 timerL, timerH;
READ_UINT32(timerL, MTIMER); READ_UINT32(timerL, MTIMER);
READ_UINT32(timerH, MTIMER + MTIMER_HI_OFFSET); READ_UINT32(timerH, MTIMER + MTIMER_HI_OFFSET);
timer = OS_COMBINED_64(timerH, timerL); timer = OS_COMBINED_64(timerH, timerL);
if ((timeMax - nextResponseTime) > timer) {
timer += nextResponseTime; timer += nextResponseTime;
} else {
timer = timeMax;
}
HalIrqDisable(RISCV_MACH_TIMER_IRQ); HalIrqDisable(RISCV_MACH_TIMER_IRQ);
WRITE_UINT32(0xffffffff, MTIMERCMP + MTIMER_HI_OFFSET); WRITE_UINT32(0xffffffff, MTIMERCMP + MTIMER_HI_OFFSET);

View File

@ -61,8 +61,6 @@ VOID OsSchedSetIdleTaskSchedParam(LosTaskCB *idleTask);
UINT32 OsSchedSwtmrScanRegister(SchedScan func); UINT32 OsSchedSwtmrScanRegister(SchedScan func);
VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEndTime, BOOL timeUpdate);
VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate); VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate);
VOID OsSchedTaskDeQueue(LosTaskCB *taskCB); VOID OsSchedTaskDeQueue(LosTaskCB *taskCB);

View File

@ -34,6 +34,9 @@
#include "los_tick.h" #include "los_tick.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_hook.h" #include "los_hook.h"
#if (LOSCFG_KERNEL_PM == 1)
#include "los_pm.h"
#endif
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
@ -179,7 +182,7 @@ STATIC INLINE VOID OsSchedTickReload(UINT64 nextResponseTime, UINT32 responseID,
HalSysTickReload(nextResponseTime); HalSysTickReload(nextResponseTime);
} }
VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEndTime, BOOL timeUpdate) STATIC INLINE VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEndTime, BOOL timeUpdate)
{ {
UINT64 nextExpireTime; UINT64 nextExpireTime;
UINT64 nextResponseTime = 0; UINT64 nextResponseTime = 0;
@ -216,6 +219,7 @@ VOID OsSchedSetNextExpireTime(UINT64 startTime, UINT32 responseID, UINT64 taskEn
VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate) VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate)
{ {
BOOL isPmMode = FALSE;
UINT64 endTime; UINT64 endTime;
LosTaskCB *runTask = g_losTask.runTask; LosTaskCB *runTask = g_losTask.runTask;
@ -223,7 +227,10 @@ VOID OsSchedUpdateExpireTime(UINT64 startTime, BOOL timeUpdate)
return; return;
} }
if (runTask->taskID != g_idleTaskID) { #if (LOSCFG_KERNEL_PM == 1)
isPmMode = OsIsPmMode();
#endif
if ((runTask->taskID != g_idleTaskID) && !isPmMode) {
INT32 timeSlice = (runTask->timeSlice <= OS_TIME_SLICE_MIN) ? OS_SCHED_TIME_SLICES : runTask->timeSlice; INT32 timeSlice = (runTask->timeSlice <= OS_TIME_SLICE_MIN) ? OS_SCHED_TIME_SLICES : runTask->timeSlice;
endTime = startTime + timeSlice; endTime = startTime + timeSlice;
} else { } else {