曲径通幽论坛

标题: OSInit|OS_InitMisc()|OS_InitRdyList() [打印本页]

作者: beyes    时间: 2009-4-14 00:19
标题: OSInit|OS_InitMisc()|OS_InitRdyList()
void  OSInit (void)
{
#if OS_VERSION >= 204
    OSInitHookBegin();                                           /* Call port specific initialization code   */
#endif

    OS_InitMisc();                                               /* Initialize miscellaneous variables       */

    OS_InitRdyList();                                            /* Initialize the Ready List                */
    OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs      */
    OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs    */

#if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    OS_FlagInit();                                               /* Initialize the event flag structures     */
#endif

#if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
    OS_MemInit();                                                /* Initialize the memory manager            */
#endif

#if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
    OS_QInit();                                                  /* Initialize the message queue structures  */
#endif

    OS_InitTaskIdle();                                           /* Create the Idle Task                     */
#if OS_TASK_STAT_EN > 0
    OS_InitTaskStat();                                           /* Create the Statistic Task                */
#endif

#if OS_VERSION >= 204
    OSInitHookEnd();                                             /* Call port specific init. code            */
#endif
}
相关函数
OS_InitMisc() 
OS_InitRdyList()
OS_InitTCBList()      


作者: beyes    时间: 2009-4-14 00:21
标题: OS_InitMisc()
[Plain Text] 纯文本查看 复制代码
static  void  OS_InitMisc (void)
{
#if OS_TIME_GET_SET_EN > 0 
    OSTime        = 0L;                                          /* Clear the 32-bit system clock            */
#endif

    OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter      */
    OSLockNesting = 0;                                           /* Clear the scheduling lock counter        */

    OSTaskCtr     = 0;                                           /* Clear the number of tasks                */

    OSRunning     = FALSE;                                       /* Indicate that multitasking not started   */
  
    OSCtxSwCtr    = 0;                                           /* Clear the context switch counter         */
    OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter            */

#if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
    OSIdleCtrRun  = 0L;
    OSIdleCtrMax  = 0L;
    OSStatRdy     = FALSE;                                       /* Statistic task is not ready              */
#endif
}

说明

作者: beyes    时间: 2009-4-14 00:22
标题: OS_InitRdyList
static  void  OS_InitRdyList (void)
{
    INT16U   i;
    INT8U   *prdytbl;


    OSRdyGrp      = 0x00;                                        /*清就绪任务组*/
    prdytbl       = &OSRdyTbl[0];
    for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
        *prdytbl++ = 0x00;                                         /*清就绪任务表*/
    }

    OSPrioCur     = 0;                                             /*当前任务优先级号*/
    OSPrioHighRdy = 0;                                        /*已就绪最高优先级任务号*/

    OSTCBHighRdy  = (OS_TCB *)0;                /*已就绪最高优先级任务TCB指针初始为空*/                
    OSTCBCur      = (OS_TCB *)0;                   /*当前任务TCB指针为空*/
}




欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2