鞍山网上制作网站,如何知道网站什么时候做的,wordpress详情页选择模板,做网站在国外发图片目录 内核#xff1a;调度#xff08;oc_core.c文件的函数#xff09;OS_TCB#xff08;任务控制块#xff09;初始化任务控制块列表(ucos_ii.h文件的函数)系统调用#xff0c;主动让渡CPU发生中断#xff0c;强制当前任务让渡CPU就绪表(ucos_ii.h文件的函数)设置任务进… 目录 内核调度oc_core.c文件的函数OS_TCB任务控制块初始化任务控制块列表(ucos_ii.h文件的函数)系统调用主动让渡CPU发生中断强制当前任务让渡CPU就绪表(ucos_ii.h文件的函数)设置任务进入就绪态设置任务脱离就绪态在就绪表中找到优先级最高(数最小)的任务 内核调度oc_core.c文件的函数
OS_TCB任务控制块初始化
INT8U OS_TCBInit (INT8U prio,OS_STK *ptos,OS_STK *pbos,INT16U id,INT32U stk_size,void *pext,INT16U opt);任务控制块列表(ucos_ii.h文件的函数)
OS_EXT OS_TCB OSTCBTbl[OS_MAX_TASKS OS_N_SYS_TASKS];系统调用主动让渡CPU
void OS_Sched (void)
{#if OS_CRITICAL_METHOD 3u /* Allocate storage for CPU status register */OS_CPU_SR cpu_sr 0u;#endifOS_ENTER_CRITICAL();if (OSIntNesting 0u) /* Schedule only if all ISRs done and ... */{if (OSLockNesting 0u) /* ... scheduler is not locked */{OS_SchedNew();OSTCBHighRdy OSTCBPrioTbl[OSPrioHighRdy];if (OSPrioHighRdy ! OSPrioCur) /* No Ctx Sw if current task is highest rdy */{#if OS_TASK_PROFILE_EN 0uOSTCBHighRdy-OSTCBCtxSwCtr; /* Inc. # of context switches to this task */#endifOSCtxSwCtr; /* Increment context switch counter */OS_TASK_SW(); /* Perform a context switch */}}}OS_EXIT_CRITICAL();
}发生中断强制当前任务让渡CPU
void OSIntExit (void)
{#if OS_CRITICAL_METHOD 3u /* Allocate storage for CPU status register */OS_CPU_SR cpu_sr 0u;#endifif (OSRunning OS_TRUE){OS_ENTER_CRITICAL();if (OSIntNesting 0u) /* Prevent OSIntNesting from wrapping */{OSIntNesting--;}if (OSIntNesting 0u) /* Reschedule only if all ISRs complete ... */{if (OSLockNesting 0u) /* ... and not locked. */{OS_SchedNew();OSTCBHighRdy OSTCBPrioTbl[OSPrioHighRdy];if (OSPrioHighRdy ! OSPrioCur) /* No Ctx Sw if current task is highest rdy */{#if OS_TASK_PROFILE_EN 0uOSTCBHighRdy-OSTCBCtxSwCtr; /* Inc. # of context switches to this task */#endifOSCtxSwCtr; /* Keep track of the number of ctx switches */OSIntCtxSw(); /* Perform interrupt level ctx switch */}}}OS_EXIT_CRITICAL();}
}就绪表(ucos_ii.h文件的函数)
OS_EXT OS_PRIO OSRdyTbl[OS_RDY_TBL_SIZE]; /* Table of tasks which are ready to run */设置任务进入就绪态
设置任务脱离就绪态
在就绪表中找到优先级最高(数最小)的任务