OS_CORE.C(4)

204 阅读1分钟
/*$PAGE*/
/*
*********************************************************************************************************
*                                             INITIALIZATION
*												初始化
* Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
*              creating any uC/OS-II object and, prior to calling OSStart().
*				该功能用来初始化uC/OS-II,必须放在任何一个实体和OSStart()之前
* Arguments  : none
*
* Returns    : none
*********************************************************************************************************
*/

void  OSInit(void)												/*初始化UC/OS-II函数*/
{
	OSInitHookBegin();                                           /* Call port specific initialization code调用用户特定的初始化代码(通过一个接口函数实现用户要求的插件式进入系统中)  */

	OS_InitMisc();                                               /* Initialize miscellaneous variables 初始化各种变量      */

	OS_InitRdyList();                                            /* Initialize the Ready List初始化就绪列表                */

	OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs 初始化OS_TCB空闲列表     */

	OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs 初始化OS_EVENT空闲列表   */

#if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
	OS_FlagInit();                                               /* Initialize the event flag structures初始化事件标志结构     */
#endif

#if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
	OS_MemInit();                                                /* Initialize the memory manager 初始化内存管理           */
#endif

#if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
	OS_QInit();                                                  /* Initialize the message queue structures 初始化消息队列结构 */
#endif

	OS_InitTaskIdle();                                           /* Create the Idle Task 创建空闲任务                    */
#if OS_TASK_STAT_EN > 0u
	OS_InitTaskStat();                                           /* Create the Statistic Task 创建统计任务               */
#endif

#if OS_TMR_EN > 0u
	OSTmr_Init();                                                /* Initialize the Timer Manager 初始化时间管理器            */
#endif

	OSInitHookEnd();                                             /* Call port specific init. code 调用用户特定的初始化代码结束           */

#if OS_DEBUG_EN > 0u
	OSDebugInit();
#endif
}

\