📄 os_core.lst
字号:
651 * Returns : none
652 *********************************************************************************************************
653 */
654
655 static void OS_InitMisc (void)
656 {
657 1 #if OS_TIME_GET_SET_EN > 0
OSTime = 0L; /* Clear the 32-bit system clock
- */
#endif
660 1
C51 COMPILER V9.01 OS_CORE 10/31/2012 17:19:07 PAGE 12
661 1 OSIntNesting = 0; /* Clear the interrupt nesting counter
- */
662 1 OSLockNesting = 0; /* Clear the scheduling lock counter
- */
663 1
664 1 OSTaskCtr = 0; /* Clear the number of tasks
- */
665 1
666 1 OSRunning = FALSE; /* Indicate that multitasking not started
- */
667 1
668 1 OSCtxSwCtr = 0; /* Clear the context switch counter
- */
669 1 OSIdleCtr = 0L; /* Clear the 32-bit idle counter
- */
670 1
671 1 #if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
OSIdleCtrRun = 0L;
OSIdleCtrMax = 0L;
OSStatRdy = FALSE; /* Statistic task is not ready
- */
#endif
676 1 }
677 /*$PAGE*/
678 /*
679 *********************************************************************************************************
680 * INITIALIZATION
681 * INITIALIZE THE READY LIST
682 *
683 * Description: This function is called by OSInit() to initialize the Ready List.
684 *
685 * Arguments : none
686 *
687 * Returns : none
688 *********************************************************************************************************
689 */
690
691 static void OS_InitRdyList (void)
692 {
693 1 INT16U i;
694 1 INT8U *prdytbl;
695 1
696 1
697 1 OSRdyGrp = 0x00; /* Clear the ready list
- */
698 1 prdytbl = &OSRdyTbl[0];
699 1 for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
700 2 *prdytbl++ = 0x00;
701 2 }
702 1
703 1 OSPrioCur = 0;
704 1 OSPrioHighRdy = 0;
705 1
706 1 OSTCBHighRdy = (OS_TCB *)0;
707 1 OSTCBCur = (OS_TCB *)0;
708 1 }
709
710 /*$PAGE*/
711 /*
712 *********************************************************************************************************
713 * INITIALIZATION
714 * CREATING THE IDLE TASK
C51 COMPILER V9.01 OS_CORE 10/31/2012 17:19:07 PAGE 13
715 *
716 * Description: This function creates the Idle Task.
717 *
718 * Arguments : none
719 *
720 * Returns : none
721 *********************************************************************************************************
722 */
723
724 static void OS_InitTaskIdle (void)
725 {
726 1 #if OS_TASK_CREATE_EXT_EN > 0
#if OS_STK_GROWTH == 1
(void)OSTaskCreateExt(OS_TaskIdle,
(void *)0, /* No arguments passed to OS_TaskIdle
-() */
&OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack
- */
OS_IDLE_PRIO, /* Lowest priority level
- */
OS_TASK_IDLE_ID,
&OSTaskIdleStk[0], /* Set Bottom-Of-Stack
- */
OS_TASK_IDLE_STK_SIZE,
(void *)0, /* No TCB extension
- */
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stac
-k */
#else
(void)OSTaskCreateExt(OS_TaskIdle,
(void *)0, /* No arguments passed to OS_TaskIdle
-() */
&OSTaskIdleStk[0], /* Set Top-Of-Stack
- */
OS_IDLE_PRIO, /* Lowest priority level
- */
OS_TASK_IDLE_ID,
&OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack
- */
OS_TASK_IDLE_STK_SIZE,
(void *)0, /* No TCB extension
- */
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stac
-k */
#endif
#else
749 1 #if OS_STK_GROWTH == 1
(void)OSTaskCreate(OS_TaskIdle,
(void *)0,
&OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
OS_IDLE_PRIO);
#else
755 1 (void)OSTaskCreate(OS_TaskIdle,
756 1 (void *)0,
757 1 &OSTaskIdleStk[0],
758 1 OS_IDLE_PRIO);
759 1 #endif
760 1 #endif
761 1 }
762 /*$PAGE*/
763 /*
764 *********************************************************************************************************
C51 COMPILER V9.01 OS_CORE 10/31/2012 17:19:07 PAGE 14
765 * INITIALIZATION
766 * CREATING THE STATISTIC TASK
767 *
768 * Description: This function creates the Statistic Task.
769 *
770 * Arguments : none
771 *
772 * Returns : none
773 *********************************************************************************************************
774 */
775
776 #if OS_TASK_STAT_EN > 0
static void OS_InitTaskStat (void)
{
#if OS_TASK_CREATE_EXT_EN > 0
#if OS_STK_GROWTH == 1
(void)OSTaskCreateExt(OS_TaskStat,
(void *)0, /* No args passed to OS_TaskStat()*
-/
&OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Top-Of-Stack *
-/
OS_STAT_PRIO, /* One higher than the idle task *
-/
OS_TASK_STAT_ID,
&OSTaskStatStk[0], /* Set Bottom-Of-Stack *
-/
OS_TASK_STAT_STK_SIZE,
(void *)0, /* No TCB extension *
-/
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear *
-/
#else
(void)OSTaskCreateExt(OS_TaskStat,
(void *)0, /* No args passed to OS_TaskStat()*
-/
&OSTaskStatStk[0], /* Set Top-Of-Stack *
-/
OS_STAT_PRIO, /* One higher than the idle task *
-/
OS_TASK_STAT_ID,
&OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Bottom-Of-Stack *
-/
OS_TASK_STAT_STK_SIZE,
(void *)0, /* No TCB extension *
-/
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear *
-/
#endif
#else
#if OS_STK_GROWTH == 1
(void)OSTaskCreate(OS_TaskStat,
(void *)0, /* No args passed to OS_TaskStat()*
-/
&OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Top-Of-Stack *
-/
OS_STAT_PRIO); /* One higher than the idle task *
-/
#else
(void)OSTaskCreate(OS_TaskStat,
(void *)0, /* No args passed to OS_TaskStat()*
-/
&OSTaskStatStk[0], /* Set Top-Of-Stack *
C51 COMPILER V9.01 OS_CORE 10/31/2012 17:19:07 PAGE 15
-/
OS_STAT_PRIO); /* One higher than the idle task *
-/
#endif
#endif
}
#endif
816 /*$PAGE*/
817 /*
818 *********************************************************************************************************
819 * INITIALIZATION
820 * INITIALIZE THE FREE LIST OF TASK CONTROL BLOCKS
821 *
822 * Description: This function is called by OSInit() to initialize the free list of OS_TCBs.
823 *
824 * Arguments : none
825 *
826 * Returns : none
827 *********************************************************************************************************
828 */
829
830 static void OS_InitTCBList (void)
831 {
832 1 INT8U i;
833 1 OS_TCB *ptcb1;
834 1 OS_TCB *ptcb2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -