idleTASK,分析。

static portTASK_FUNCTION( prvIdleTask, pvParameters )

{

    /* Stop warnings. */

    ( void ) pvParameters;

    /** THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE

    SCHEDULER IS STARTED. **/

    for( ;; )

    {

        /* See if any tasks have deleted themselves - if so then the idle task

        is responsible for freeing the deleted task's TCB and stack. */

主要作用是清除已被删除的任务的申请的空间。

//这里删除的任务必须是动态分配的才会被删除。静态的不会被删除

        prvCheckTasksWaitingTermination();

        #if ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) )

        {

            /* When using preemption tasks of equal priority will be

            timesliced.  If a task that is sharing the idle priority is ready

            to run then the idle task should yield before the end of the

            timeslice.

            A critical region is not required here as we are just reading from

            the list, and an occasional incorrect value will not matter.  If

            the ready list at the idle priority contains more than one task

            then a task other than the idle task is ready to execute. */

            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )

            {

                taskYIELD();空闲任务仅执行一会,从这里进行任务调度。解析一

            }

            else

            {

                mtCOVERAGE_TEST_MARKER();

            }

        }

解析一:

taskYIELD();=portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;    

宏展开:

->( * ( ( volatile uint32_t * ) 0xe000ed04 ) )=(1UL << 28UL )

   在M3编程手册中,0xe000ed04是寄存器

       

   

触发PENDSV中断。

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值