📄 os_core.lst
字号:
653 1
654 1 OSIntNesting = 0; /* Clear the interrupt nesting counter
- */
655 1 OSLockNesting = 0; /* Clear the scheduling lock counter
- */
656 1
657 1 OSTaskCtr = 0; /* Clear the number of tasks
- */
C51 COMPILER V8.08 OS_CORE 03/02/2009 10:42:35 PAGE 12
658 1
659 1 OSRunning = FALSE; /* Indicate that multitasking not started
- */
660 1
661 1 OSCtxSwCtr = 0; /* Clear the context switch counter
- */
662 1 OSIdleCtr = 0L; /* Clear the 32-bit idle counter
- */
663 1
664 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
669 1 }
670 /*$PAGE*/
671 /*
672 *********************************************************************************************************
673 * INITIALIZATION
674 * INITIALIZE THE READY LIST
675 *
676 * Description: This function is called by OSInit() to initialize the Ready List.
677 *
678 * Arguments : none
679 *
680 * Returns : none
681 *********************************************************************************************************
682 */
683
684 static void OS_InitRdyList (void) reentrant
685 {
686 1 INT16U i;
687 1 INT8U *prdytbl;
688 1
689 1
690 1 OSRdyGrp = 0x00; /* Clear the ready list
- */
691 1 prdytbl = &OSRdyTbl[0];
692 1 for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
693 2 *prdytbl++ = 0x00;
694 2 }
695 1
696 1 OSPrioCur = 0;
697 1 OSPrioHighRdy = 0;
698 1
699 1 OSTCBHighRdy = (OS_TCB *)0;
700 1 OSTCBCur = (OS_TCB *)0;
701 1 }
702
703 /*$PAGE*/
704 /*
705 *********************************************************************************************************
706 * INITIALIZATION
707 * CREATING THE IDLE TASK
708 *
709 * Description: This function creates the Idle Task.
710 *
711 * Arguments : none
712 *
713 * Returns : none
714 *********************************************************************************************************
C51 COMPILER V8.08 OS_CORE 03/02/2009 10:42:35 PAGE 13
715 */
716
717 static void OS_InitTaskIdle (void) reentrant
718 {
719 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
742 1 #if OS_STK_GROWTH == 1
(void)OSTaskCreate(OS_TaskIdle,
(void *)0,
&OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
OS_IDLE_PRIO);
#else
748 1 (void)OSTaskCreate(OS_TaskIdle,
749 1 (void *)0,
750 1 &OSTaskIdleStk[0],
751 1 OS_IDLE_PRIO);
752 1 #endif
753 1 #endif
754 1 }
755 /*$PAGE*/
756 /*
757 *********************************************************************************************************
758 * INITIALIZATION
759 * CREATING THE STATISTIC TASK
760 *
761 * Description: This function creates the Statistic Task.
762 *
763 * Arguments : none
764 *
C51 COMPILER V8.08 OS_CORE 03/02/2009 10:42:35 PAGE 14
765 * Returns : none
766 *********************************************************************************************************
767 */
768
769 #if OS_TASK_STAT_EN > 0
static void OS_InitTaskStat (void) reentrant
{
#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 *
-/
OS_STAT_PRIO); /* One higher than the idle task *
-/
#endif
#endif
}
#endif
C51 COMPILER V8.08 OS_CORE 03/02/2009 10:42:35 PAGE 15
809 /*$PAGE*/
810 /*
811 *********************************************************************************************************
812 * INITIALIZATION
813 * INITIALIZE THE FREE LIST OF TASK CONTROL BLOCKS
814 *
815 * Description: This function is called by OSInit() to initialize the free list of OS_TCBs.
816 *
817 * Arguments : none
818 *
819 * Returns : none
820 *********************************************************************************************************
821 */
822
823 static void OS_InitTCBList (void) reentrant
824 {
825 1 INT8U i;
826 1 OS_TCB *ptcb1;
827 1 OS_TCB *ptcb2;
828 1
829 1
830 1 OSTCBList = (OS_TCB *)0; /* TCB Initialization
- */
831 1 for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) { /* Clear the priority table
- */
832 2 OSTCBPrioTbl[i] = (OS_TCB *)0;
833 2 }
834 1 ptcb1 = &OSTCBTbl[0];
835 1 ptcb2 = &OSTCBTbl[1];
836 1 for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) { /* Init. list of free TCBs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -