曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 10312|回复: 2
打印 上一主题 下一主题

OSInit|OS_InitMisc()|OS_InitRdyList()

[复制链接]

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34387
跳转到指定楼层
楼主
发表于 2009-4-14 00:19:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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()      

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34387
沙发
 楼主| 发表于 2009-4-14 00:21:51 | 只看该作者

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
 }

说明
      OSTime:32 位系统时钟
      OSIntNesting:中断嵌套层数
      OSLockNesting:任务上锁层数
      OSTaskCtr :任务数
      OSRunning:多任务是否启动标志,True 为启动,False 为不启动
      OSCtxSwCtr:任务切换计数器
      OSIdleCtr:32 位空闲任务计数器
      OSIdleCtrRun:保存上一秒空闲任务计数器 OSIdleCtr 的值
      OSIdleCtrMax:1s 内空闲计数器能达到的最大值

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34387
板凳
 楼主| 发表于 2009-4-14 00:22:45 | 只看该作者

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指针为空*/
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-5-19 10:39 , Processed in 0.081657 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表