(187) eTaskConfirmSleepModeStatus :
c
//本函数只用于低功耗处理里。返回值是 eAbortSleep 或 eNoTasksWaitingTimeout。
eSleepModeStatus eTaskConfirmSleepModeStatus( void ) // tasks.c 3125
{
/* The idle task exists in addition to the application tasks. */
//空闲任务除了应用程序任务之外还存在。
const UBaseType_t uxNonApplicationTasks = 1;
eSleepModeStatus eReturn = eStandardSleep;
/* This function must be called from a critical section. */
if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0 )
{ //在调度器暂停期间,一个任务已准备就绪。
/* A task was made ready while the scheduler was suspended. */
eReturn = eAbortSleep;
}
else if( xYieldPending != pdFALSE )
{ // 调度器暂停期间,一个yield被挂起。
/* A yield was pended while the scheduler was suspended. */
eReturn = eAbortSleep;
}
else if( xPendedTicks != 0 )
{ //已发生一次tick中断,但由于调度器被挂起而被暂停。
/* A tick interrupt has already occurred but was held pending
* because the scheduler is suspended. */
eReturn = eAbortSleep;
}
else
{
//如果所有任务都在挂起列表中(这可能意味着它们具有无限阻塞时间,而不是实际被挂起),
// 那么可以安全地关闭所有时钟只需等待外部中断。 // 意思是确认所有的自定义任务都挂起了。
if( listCURRENT_LIST_LENGTH( &xSuspendedTaskList )
== ( uxCurrentNumberOfTasks - uxNonApplicationTasks ) )
eReturn = eNoTasksWaitingTimeout;
else
mtCOVERAGE_TEST_MARKER();
}
return eReturn;
}
(188) vTaskStepTick :
c
void vTaskStepTick( const TickType_t xTicksToJump ) // tasks.c 2228
{
/* Correct the tick count value after a period during which the tick
* was suppressed. Note this does *not* call the tick hook function for
* each stepped tick. */
//在抑制计数后的一段时间内,修正计数值。请注意,这不会为每次递增的计数调用tick钩子函数。
configASSERT( ( xTickCount + xTicksToJump ) <= xNextTaskUnblockTime );
xTickCount += xTicksToJump;
traceINCREASE_TICK_COUNT( xTicksToJump );
}
(189)
谢谢