更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_idle.c 文件参考

浏览源代码.

函数

STATIC VOID IdleDequeue (SchedRunqueue *rq, LosTaskCB *taskCB)
 
STATIC VOID IdleEnqueue (SchedRunqueue *rq, LosTaskCB *taskCB)
 
STATIC UINT32 IdleWait (LosTaskCB *runTask, LOS_DL_LIST *list, UINT32 ticks)
 
STATIC VOID IdleWake (LosTaskCB *resumedTask)
 
STATIC UINT32 IdleSchedParamGet (const LosTaskCB *taskCB, SchedParam *param)
 
STATIC VOID IdleYield (LosTaskCB *runTask)
 
STATIC VOID IdleStartToRun (SchedRunqueue *rq, LosTaskCB *taskCB)
 
STATIC UINT32 IdleResume (LosTaskCB *taskCB, BOOL *needSched)
 
STATIC UINT64 IdleTimeSliceGet (const LosTaskCB *taskCB)
 
STATIC VOID IdleTimeSliceUpdate (SchedRunqueue *rq, LosTaskCB *taskCB, UINT64 currTime)
 
STATIC INT32 IdleParamCompare (const SchedPolicy *sp1, const SchedPolicy *sp2)
 
STATIC VOID IdlePriorityInheritance (LosTaskCB *owner, const SchedParam *param)
 
STATIC VOID IdlePriorityRestore (LosTaskCB *owner, const LOS_DL_LIST *list, const SchedParam *param)
 
VOID IdleTaskSchedParamInit (LosTaskCB *taskCB)
 

变量

const STATIC SchedOps g_idleOps
 

函数说明

◆ IdleDequeue()

STATIC VOID IdleDequeue ( SchedRunqueue rq,
LosTaskCB taskCB 
)

在文件 los_idle.c89 行定义.

90{
91 (VOID)rq;
92
93 taskCB->taskStatus &= ~OS_TASK_STATUS_READY;
94}
UINT16 taskStatus
这是这个函数的调用关系图:

◆ IdleEnqueue()

STATIC VOID IdleEnqueue ( SchedRunqueue rq,
LosTaskCB taskCB 
)

在文件 los_idle.c81 行定义.

82{
83 (VOID)rq;
84
85 taskCB->taskStatus &= ~OS_TASK_STATUS_BLOCKED;
86 taskCB->taskStatus |= OS_TASK_STATUS_READY;
87}

◆ IdleParamCompare()

STATIC INT32 IdleParamCompare ( const SchedPolicy sp1,
const SchedPolicy sp2 
)

在文件 los_idle.c157 行定义.

158{
159 return 0;
160}

◆ IdlePriorityInheritance()

STATIC VOID IdlePriorityInheritance ( LosTaskCB owner,
const SchedParam param 
)

在文件 los_idle.c162 行定义.

163{
164 (VOID)owner;
165 (VOID)param;
166 return;
167}

◆ IdlePriorityRestore()

STATIC VOID IdlePriorityRestore ( LosTaskCB owner,
const LOS_DL_LIST list,
const SchedParam param 
)

在文件 los_idle.c169 行定义.

170{
171 (VOID)owner;
172 (VOID)list;
173 (VOID)param;
174 return;
175}

◆ IdleResume()

STATIC UINT32 IdleResume ( LosTaskCB taskCB,
BOOL needSched 
)

在文件 los_idle.c135 行定义.

136{
137 *needSched = FALSE;
138
139 taskCB->taskStatus &= ~OS_TASK_STATUS_SUSPENDED;
140 if (!OsTaskIsBlocked(taskCB)) {
141 taskCB->ops->enqueue(OsSchedRunqueue(), taskCB);
142 *needSched = TRUE;
143 }
144 return LOS_OK;
145}
STATIC INLINE SchedRunqueue * OsSchedRunqueue(VOID)
STATIC INLINE BOOL OsTaskIsBlocked(const LosTaskCB *taskCB)
VOID(* enqueue)(SchedRunqueue *rq, LosTaskCB *taskCB)
入队列
const SchedOps * ops
函数调用图:

◆ IdleSchedParamGet()

STATIC UINT32 IdleSchedParamGet ( const LosTaskCB taskCB,
SchedParam param 
)

在文件 los_idle.c147 行定义.

148{
149 SchedHPF *sched = (SchedHPF *)&taskCB->sp;
150 param->policy = sched->policy;
151 param->basePrio = sched->basePrio;
152 param->priority = sched->priority;
153 param->timeSlice = 0;
154 return LOS_OK;
155}
UINT16 priority
当前优先级
UINT16 policy
UINT16 basePrio
起始优先级
UINT16 basePrio
UINT16 policy
UINT16 priority
UINT32 timeSlice
SchedPolicy sp

◆ IdleStartToRun()

STATIC VOID IdleStartToRun ( SchedRunqueue rq,
LosTaskCB taskCB 
)

在文件 los_idle.c96 行定义.

97{
98 IdleDequeue(rq, taskCB);
99}
STATIC VOID IdleDequeue(SchedRunqueue *rq, LosTaskCB *taskCB)
Definition: los_idle.c:89
函数调用图:

◆ IdleTaskSchedParamInit()

VOID IdleTaskSchedParamInit ( LosTaskCB taskCB)

在文件 los_idle.c177 行定义.

178{
179 SchedHPF *sched = (SchedHPF *)&taskCB->sp;
180 sched->policy = LOS_SCHED_IDLE;
181 sched->basePrio = OS_PROCESS_PRIORITY_LOWEST;
182 sched->priority = OS_TASK_PRIORITY_LOWEST;
183 sched->initTimeSlice = 0;
184 taskCB->timeSlice = sched->initTimeSlice;
185 taskCB->taskStatus = OS_TASK_STATUS_SUSPENDED;
186 taskCB->ops = &g_idleOps;
187}
const STATIC SchedOps g_idleOps
Definition: los_idle.c:48
UINT32 initTimeSlice
初始化时间片
INT32 timeSlice
这是这个函数的调用关系图:

◆ IdleTimeSliceGet()

STATIC UINT64 IdleTimeSliceGet ( const LosTaskCB taskCB)

在文件 los_idle.c75 行定义.

76{
77 (VOID)taskCB;
78 return (OS_SCHED_MAX_RESPONSE_TIME - OS_TICK_RESPONSE_PRECISION);
79}

◆ IdleTimeSliceUpdate()

STATIC VOID IdleTimeSliceUpdate ( SchedRunqueue rq,
LosTaskCB taskCB,
UINT64  currTime 
)

在文件 los_idle.c68 行定义.

69{
70 (VOID)rq;
71
72 taskCB->startTime = currTime;
73}
UINT64 startTime

◆ IdleWait()

STATIC UINT32 IdleWait ( LosTaskCB runTask,
LOS_DL_LIST list,
UINT32  ticks 
)

在文件 los_idle.c107 行定义.

108{
109 (VOID)runTask;
110 (VOID)list;
111 (VOID)ticks;
112
113 return LOS_NOK;
114}

◆ IdleWake()

STATIC VOID IdleWake ( LosTaskCB resumedTask)

在文件 los_idle.c116 行定义.

117{
118 LOS_ListDelete(&resumedTask->pendList);
119 resumedTask->taskStatus &= ~OS_TASK_STATUS_PENDING;
120
121 if (resumedTask->taskStatus & OS_TASK_STATUS_PEND_TIME) {
122 OsSchedTimeoutQueueDelete(resumedTask);
123 resumedTask->taskStatus &= ~OS_TASK_STATUS_PEND_TIME;
124 }
125
126 if (!(resumedTask->taskStatus & OS_TASK_STATUS_SUSPENDED)) {
127#ifdef LOSCFG_SCHED_DEBUG
128 resumedTask->schedStat.pendTime += OsGetCurrSchedTimeCycle() - resumedTask->startTime;
129 resumedTask->schedStat.pendCount++;
130#endif
131 resumedTask->ops->enqueue(OsSchedRunqueue(), resumedTask);
132 }
133}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelete(LOS_DL_LIST *node)
Definition: los_list.h:292
STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
Definition: los_sched_pri.h:75
STATIC INLINE VOID OsSchedTimeoutQueueDelete(LosTaskCB *taskCB)
LOS_DL_LIST pendList
SchedStat schedStat
函数调用图:

◆ IdleYield()

STATIC VOID IdleYield ( LosTaskCB runTask)

在文件 los_idle.c101 行定义.

102{
103 (VOID)runTask;
104 return;
105}

变量说明

◆ g_idleOps

const STATIC SchedOps g_idleOps
初始值:
= {
.dequeue = IdleDequeue,
.enqueue = IdleEnqueue,
.wait = IdleWait,
.wake = IdleWake,
.schedParamModify = NULL,
.schedParamGet = IdleSchedParamGet,
.delay = NULL,
.yield = IdleYield,
.start = IdleStartToRun,
.exit = NULL,
.suspend = NULL,
.resume = IdleResume,
.deadlineGet = IdleTimeSliceGet,
.timeSliceUpdate = IdleTimeSliceUpdate,
.schedParamCompare = IdleParamCompare,
.priorityInheritance = IdlePriorityInheritance,
.priorityRestore = IdlePriorityRestore,
}
STATIC VOID IdlePriorityInheritance(LosTaskCB *owner, const SchedParam *param)
Definition: los_idle.c:162
STATIC INT32 IdleParamCompare(const SchedPolicy *sp1, const SchedPolicy *sp2)
Definition: los_idle.c:157
STATIC VOID IdleTimeSliceUpdate(SchedRunqueue *rq, LosTaskCB *taskCB, UINT64 currTime)
Definition: los_idle.c:68
STATIC VOID IdleWake(LosTaskCB *resumedTask)
Definition: los_idle.c:116
STATIC UINT32 IdleResume(LosTaskCB *taskCB, BOOL *needSched)
Definition: los_idle.c:135
STATIC UINT32 IdleSchedParamGet(const LosTaskCB *taskCB, SchedParam *param)
Definition: los_idle.c:147
STATIC VOID IdleYield(LosTaskCB *runTask)
Definition: los_idle.c:101
STATIC VOID IdleStartToRun(SchedRunqueue *rq, LosTaskCB *taskCB)
Definition: los_idle.c:96
STATIC UINT64 IdleTimeSliceGet(const LosTaskCB *taskCB)
Definition: los_idle.c:75
STATIC UINT32 IdleWait(LosTaskCB *runTask, LOS_DL_LIST *list, UINT32 ticks)
Definition: los_idle.c:107
STATIC VOID IdleEnqueue(SchedRunqueue *rq, LosTaskCB *taskCB)
Definition: los_idle.c:81
STATIC VOID IdlePriorityRestore(LosTaskCB *owner, const LOS_DL_LIST *list, const SchedParam *param)
Definition: los_idle.c:169

在文件 los_idle.c48 行定义.