From 6fdacf89c753ed60ea652d8ccb27dc79a25da55c Mon Sep 17 00:00:00 2001 From: tree <1913915946@qq.com> Date: Thu, 28 Dec 2023 00:09:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86task.c=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/用例_oujiashu.docx | Bin 14253 -> 0 bytes src/kernel/base/los_task.c | 62 ++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 25 deletions(-) delete mode 100644 doc/用例_oujiashu.docx diff --git a/doc/用例_oujiashu.docx b/doc/用例_oujiashu.docx deleted file mode 100644 index 80b0ece3233084e8e246b655c5949b1cb04eb7eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14253 zcmeIZ1y^0kwl=(h;O-V&65J(taCaxTySuwP8+U@cy9al7cSvy8m+sU3b)P=xet+QJ zHAbzm*Q$EvDvGH!XUR%{eLw?10H6Q>01;s0`?Q5R2mn9`4gjD6pg=VQtgRdjtsJx! zU2P2QHECTeEeLZzfPT&ffWD9azw3YT3e+WxSoP2&3Ecr75n~&b^bT`NC_%${5^3a* zAhFy*m0#ip+Fmtr?*GWC$S2wK@Fu<%y2as@9*W;wo2$N4ORs#~yjIF5t9x9g5u^i& z9bZk&EmzH1%Y6F`Sr7@*#wE0~f`>>EyNLtfJdh4Rm*lM!z8Gmk{hqrTnvB!LC2YP1 z9cu!X<9a)>zqp(p_I=#;8pJejhqr&d(xQCabQ8dEG~=zACOU6C0eNGY&4)L*zw%^x z4+a3dy@3H_|4k(EV{sbK-uX=WUE*NhMN-?&(88XM_P6{0iQ@la`TN_SUKZDF)=Lk^ zcjo`%Kh-X`+>MndO{YJ(g0%z*r6DGXy0U1t@cP2FxCp9wq$@HqJrh6aW}hzXxS61N zj+3YaAJz^%|De^Y@zmx500y?@Gq}v#Y{RAP-x|F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Ym~7GFdynxX;2Mq6JMcrO<9#qdmB2sv=~CfpPR-SyY+F=;#;=pcNqSBd2xJ0k|%4 zbpc1v>YRnp{fXr{-&rpaj{5Q$$s9XasLCi-Ceb&UqbhBnqwJ19TlwUih93ItmWdpf zQ>X)sv0y%b5Ms*io}`hp1D*d5Wve1U5?%Pt^k5(aEFn;xhle-M2+PNQ3vw zVOylXp|HupS=9~#LR)M0{MbuAE%^D$<8^4K{0?gs>X`fBKzW{Ztw7V7dKVZ0%n>mc zC0$W>SJ+9jRW57daT&+*A|E?lJeAe!vG!6|R=3;v%w z{mtMlQO@tYI`Yn|NPp*5T^pO<^xprm>ie?2U+MBAzp-i?$pxa^>8vR%xRM5mVgUPj zTxw#ip*0HZK!b(nUPxgHyqXB`7*&c`-crG9oa9dwB9^c?pwPUIYj|n}lep&HV#rABbZeNKf zhje*CskY9;O4wNxiJs9|c^+A{N_j*-lZy~(JDRa-iPq3-e~a3Q;;16RKz|^hhWoHO z1N<;^G*ebChd1$T=>WTWV;z5LC_i~uUri#?94yky`_7X8Vpb4Pns=Azzn^RR*T3ek z`+qs*BrEan1pfUL#$V8P+yAc1|8^$hpTK{Xr~d`5eRmrEqgef)@PDsO`U?yI+#vk{ z{~s!q{z>Vd^(ueSqC)*2s#pF=;-Bfgzew=n{6XUH$-aNW|GAg_7d)2WPx$}0v;9x- zKV99wz?D>gfdAq6{*%H#owdIx(9!%s;on@hf8zh$JpY9T06ggcfd4So|Aha$#{4^+ eg7I(gKlG=p1o%69{C4687SR2!W9ONFd-{JI*t>!N diff --git a/src/kernel/base/los_task.c b/src/kernel/base/los_task.c index c771be6..31de5b0 100644 --- a/src/kernel/base/los_task.c +++ b/src/kernel/base/los_task.c @@ -25,7 +25,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * --------------------------------------------------------------------------- */ - +/*关于LiteOS中任务管理模块的部分实现,包括任务控制块的初始化、任务创建、任务删除等功能*/ #include "los_task_pri.h" #include "los_priqueue_pri.h" #include "los_sem_pri.h" @@ -282,7 +282,7 @@ LITE_OS_SEC_TEXT VOID OsTaskScan(VOID) LOS_Schedule(); } } - +//OsTaskInit用于初始化任务管理模块,包括任务控制块数组、空闲任务列表、任务回收列表等数据结构的初始化 LITE_OS_SEC_TEXT_INIT UINT32 OsTaskInit(VOID) { UINT32 index; @@ -335,7 +335,7 @@ UINT32 OsGetIdleTaskId(VOID) Percpu *perCpu = OsPercpuGet(); return perCpu->idleTaskId; } - +//创建空闲任务(Idle Task) LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID) { UINT32 ret; @@ -363,6 +363,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsIdleTaskCreate(VOID) * Description : get id of current running task. * Return : task id */ +//读取任务ID LITE_OS_SEC_TEXT UINT32 LOS_CurTaskIDGet(VOID) { LosTaskCB *runTask = OsCurrTaskGet(); @@ -372,7 +373,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_CurTaskIDGet(VOID) } return runTask->taskId; } - +//获取当前正在运行的任务的任务名称 LITE_OS_SEC_TEXT CHAR *OsCurTaskNameGet(VOID) { LosTaskCB *runTask = OsCurrTaskGet(); @@ -428,12 +429,12 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_LowpowerHookReg(LOWPOWERIDLEHOOK hook) g_lowPowerHook = hook; } #endif - +//注册空闲任务钩子函数,即在系统空闲时执行的函数 LITE_OS_SEC_TEXT_MINOR VOID LOS_IdleHandlerHookReg(IDLEHANDLERHOOK hook) { g_idleHandlerHook = hook; } - +//检查任务是否分离(detached) STATIC BOOL OsTaskDeleteCheckDetached(const LosTaskCB *taskCB) { #if LOSCFG_COMPAT_POSIX @@ -442,7 +443,7 @@ STATIC BOOL OsTaskDeleteCheckDetached(const LosTaskCB *taskCB) return TRUE; #endif } - +//删除已分离的任务 STATIC VOID OsTaskDeleteDetached(const LosTaskCB *taskCB) { UINT32 intSave; @@ -451,7 +452,7 @@ STATIC VOID OsTaskDeleteDetached(const LosTaskCB *taskCB) LOS_IntRestore(intSave); (VOID)LOS_TaskDelete(taskCB->taskId); } - +//删除已加入的任务 STATIC VOID OsTaskDeleteJoined(LosTaskCB *taskCB, VOID *ret) { #ifdef LOSCFG_COMPAT_POSIX @@ -481,6 +482,8 @@ STATIC VOID OsTaskDeleteJoined(LosTaskCB *taskCB, VOID *ret) * Description : All task entry * Input : taskId --- The ID of the task to be run */ +//执行任务的实际代码,并根据任务的属性判断是否需要删除任务 +//如果任务是分离的,则直接删除任务;如果任务是加入的,则将任务加入的其他任务唤醒,并重新调度任务 LITE_OS_SEC_TEXT_INIT VOID OsTaskEntry(UINT32 taskId) { LosTaskCB *taskCB = NULL; @@ -511,7 +514,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsTaskEntry(UINT32 taskId) OsTaskDeleteJoined(taskCB, ret); } } - +//对任务初始化参数进行检查,确保任务参数的合法性 STATIC UINT32 OsTaskInitParamCheck(const TSK_INIT_PARAM_S *initParam) { if (initParam == NULL) { @@ -566,7 +569,7 @@ STATIC UINT32 OsTaskCreateParamCheckStatic(const UINT32 *taskId, return LOS_OK; } #endif - +//对任务创建参数进行检查,确保参数的合法性。如果参数不合法,则返回相应的错误码;否则返回成功 LITE_OS_SEC_TEXT_INIT STATIC UINT32 OsTaskCreateParamCheck(const UINT32 *taskId, TSK_INIT_PARAM_S *initParam, VOID **pool) { @@ -776,6 +779,7 @@ LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskDelAction(LosTaskCB *taskCB, BOOL useUsr * 3. Do the deletion in hard-irq * then LOS_TaskDelete will directly return with 'ret' value. */ +//OsTaskDeleteCheckOnRun函数用来检查是否需要在任务运行时进行删除操作 LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskDeleteCheckOnRun(LosTaskCB *taskCB, UINT32 *ret) { /* init default out return value */ @@ -813,7 +817,7 @@ LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskDeleteCheckOnRun(LosTaskCB *taskCB, UINT return TRUE; } - +//OsTaskCBInit函数用于初始化任务控制块,设置任务的各种属性和状态 LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskCBInit(LosTaskCB *taskCB, const TSK_INIT_PARAM_S *initParam, VOID *stackPtr, const VOID *topStack, BOOL useUsrStack) { @@ -869,7 +873,7 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsTaskCBInit(LosTaskCB *taskCB, const TSK_INIT (VOID)memset_s(&taskCB->schedStat, sizeof(SchedStat), 0, sizeof(SchedStat)); #endif } - +//OsTaskGetFreeTaskCB函数用于获取一个空闲的任务控制块 STATIC UINT32 OsTaskGetFreeTaskCB(LosTaskCB **taskCB) { if (LOS_ListEmpty(&g_losFreeTask)) { @@ -883,7 +887,7 @@ STATIC UINT32 OsTaskGetFreeTaskCB(LosTaskCB **taskCB) LOS_ListDelete(LOS_DL_LIST_FIRST(&g_losFreeTask)); return LOS_OK; } - +//OsTaskCreateOnly函数用于创建一个新的任务,其中会对参数进行合法性检查 STATIC UINT32 OsTaskCreateOnly(UINT32 *taskId, TSK_INIT_PARAM_S *initParam, VOID *topStack, BOOL useUsrStack) { UINT32 intSave, errRet; @@ -947,7 +951,7 @@ LOS_ERREND: SCHEDULER_UNLOCK(intSave); return errRet; } - +//OsTaskResume函数用于恢复一个被挂起的任务 STATIC VOID OsTaskResume(const UINT32 *taskId) { UINT32 intSave; @@ -998,7 +1002,8 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskId, TSK_INIT_PARAM_S { return OsTaskCreateOnly(taskId, initParam, NULL, FALSE); } - +//LOS_TaskCreate该函数用于创建一个新的任务,包括任务的名称、优先级、栈大小等参数的设置 +//在创建任务时,需要进行一些参数的合法性检查,例如是否超出最大任务数量、是否有足够的堆栈空间等 LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreate(UINT32 *taskId, TSK_INIT_PARAM_S *initParam) { UINT32 ret; @@ -1012,7 +1017,8 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreate(UINT32 *taskId, TSK_INIT_PARAM_S *in return LOS_OK; } - +//LOS_TaskDelete用于删除一个已经存在的任务 +//在删除任务时,需要对任务的状态进行判断。如果任务正在运行,则将其标记为删除状态并放入回收列表;否则直接释放任务占用的资源 LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskId) { LosTaskCB *taskCB = NULL; @@ -1072,7 +1078,7 @@ LOS_RETURN: SCHEDULER_UNLOCK(intSave); return errRet; } - +//LOS_TaskResume函数用于恢复一个挂起的任务 LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskResume(UINT32 taskId) { UINT32 intSave; @@ -1136,6 +1142,7 @@ LOS_ERREND: * 3. Do the suspension in hard-irq * then LOS_TaskSuspend will directly return with 'ret' value. */ +//OsTaskSuspendCheckOnRun:检查当前任务是否需要挂起的函数,根据条件判断是否需要进行任务挂起操作 LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskSuspendCheckOnRun(LosTaskCB *taskCB, UINT32 *ret) { /* init default out return value */ @@ -1164,7 +1171,8 @@ LITE_OS_SEC_TEXT_INIT STATIC BOOL OsTaskSuspendCheckOnRun(LosTaskCB *taskCB, UIN return TRUE; } - +//LOS_TaskSuspend:挂起指定任务的函数 +//如果任务已经处于挂起状态或者正在运行,并且不满足挂起条件,则直接返回错误码;否则执行挂起操作 LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskSuspend(UINT32 taskId) { UINT32 intSave; @@ -1218,7 +1226,7 @@ LOS_RETURN: SCHEDULER_UNLOCK(intSave); return errRet; } - +//LOS_TaskDelay该函数用于让任务进入延时状态,在指定的时间后重新被调度执行 LITE_OS_SEC_TEXT UINT32 LOS_TaskDelay(UINT32 tick) { UINT32 intSave; @@ -1250,7 +1258,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_TaskDelay(UINT32 tick) return LOS_OK; } - +//LOS_TaskDelay:将任务进入延时状态,在指定的时间后重新被调度执行,如果当前在中断中或者不可抢占,则返回相应的错误码 LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskPriGet(UINT32 taskId) { UINT32 intSave; @@ -1273,7 +1281,7 @@ LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskPriGet(UINT32 taskId) SCHEDULER_UNLOCK(intSave); return priority; } - +//LOS_TaskPriGet:获取指定任务的优先级 LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskPriSet(UINT32 taskId, UINT16 taskPrio) { BOOL isReady = FALSE; @@ -1325,7 +1333,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskPriSet(UINT32 taskId, UINT16 taskPrio) } return LOS_OK; } - +//LOS_TaskPriSet:设置指定任务的优先级,根据任务当前状态选择不同的处理方式 LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CurTaskPriSet(UINT16 taskPrio) { return LOS_TaskPriSet(OsCurrTaskGet()->taskId, taskPrio); @@ -1337,6 +1345,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_CurTaskPriSet(UINT16 taskPrio) * taskStatus --- task status * timeOut --- Expiry time * Return : LOS_OK on success or LOS_NOK on failure + * OsTaskWait和OsTaskWake:任务等待和唤醒的辅助函数 */ VOID OsTaskWait(LOS_DL_LIST *list, UINT16 taskStatus, UINT32 timeout) { @@ -1373,7 +1382,7 @@ VOID OsTaskWake(LosTaskCB *resumedTask, UINT16 taskStatus) OsPriQueueEnqueue(&resumedTask->pendList, resumedTask->priority); } } - +//LOS_TaskYield用于使当前任务主动放弃 CPU 控制权,让出 CPU 给其他高优先级任务执行 LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskYield(VOID) { UINT32 tskCount; @@ -1412,6 +1421,8 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskYield(VOID) return LOS_OK; } +//LOS_TaskLock和LOS_TaskUnlock:任务锁定和解锁函数,用于保护临界区 + LITE_OS_SEC_TEXT_MINOR VOID LOS_TaskLock(VOID) { UINT32 intSave; @@ -1446,7 +1457,7 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_TaskUnlock(VOID) LOS_IntRestore(intSave); } - +//LOS_TaskInfoGet:获取指定任务的信息,包括任务名、栈大小、堆栈使用情况等 LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskId, TSK_INFO_S *taskInfo) { UINT32 intSave; @@ -1503,7 +1514,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskId, TSK_INFO_S *taskInf return LOS_OK; } - +//LOS_TaskCpuAffiSet和LOS_TaskCpuAffiGet:设置和获取任务的 CPU 亲和性,仅在支持多核的情况下有效 LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskCpuAffiSet(UINT32 taskId, UINT16 cpuAffiMask) { #ifdef LOSCFG_KERNEL_SMP @@ -1580,6 +1591,7 @@ LITE_OS_SEC_TEXT_MINOR UINT16 LOS_TaskCpuAffiGet(UINT32 taskId) /* * Description : Process pending signals tagged by others cores + *OsTaskProcSignal:处理挂起、删除任务等信号 */ LITE_OS_SEC_TEXT_MINOR UINT32 OsTaskProcSignal(VOID) {