📄 os_core.lst
字号:
886 1 }
887 /*$PAGE*/
888 /*
889 *********************************************************************************************************
C51 COMPILER V7.50 OS_CORE 12/14/2007 08:25:29 PAGE 16
890 * INITIALIZATION
891 * INITIALIZE MISCELLANEOUS VARIABLES
892 *
893 * Description: This function is called by OSInit() to initialize miscellaneous variables.
894 *
895 * Arguments : none
896 *
897 * Returns : none
898 *********************************************************************************************************
899 */
900
901 static void OS_InitMisc (void) reentrant
902 {
903 1 #if OS_TIME_GET_SET_EN > 0
904 1 OSTime = 0L; /* Clear the 32-bit system clock */
905 1 #endif
906 1
907 1 OSIntNesting = 0; /* Clear the interrupt nesting counter */
908 1 OSLockNesting = 0; /* Clear the scheduling lock counter */
909 1
910 1 OSTaskCtr = 0; /* Clear the number of tasks */
911 1
912 1 OSRunning = OS_FALSE; /* Indicate that multitasking not started */
913 1
914 1 OSCtxSwCtr = 0; /* Clear the context switch counter */
915 1 OSIdleCtr = 0L; /* Clear the 32-bit idle counter */
916 1
917 1 #if OS_TASK_STAT_EN > 0
918 1 OSIdleCtrRun = 0L;
919 1 OSIdleCtrMax = 0L;
920 1 OSStatRdy = OS_FALSE; /* Statistic task is not ready */
921 1 #endif
922 1 }
923 /*$PAGE*/
924 /*
925 *********************************************************************************************************
926 * INITIALIZATION
927 * INITIALIZE THE READY LIST
928 *
929 * Description: This function is called by OSInit() to initialize the Ready List.
930 *
931 * Arguments : none
932 *
933 * Returns : none
934 *********************************************************************************************************
935 */
936
937 static void OS_InitRdyList (void) reentrant
938 {
939 1 INT8U i;
940 1 #if OS_LOWEST_PRIO <= 63
941 1 INT8U *prdytbl;
942 1 #else
INT16U *prdytbl;
#endif
945 1
946 1
947 1 OSRdyGrp = 0; /* Clear the ready list */
948 1 prdytbl = &OSRdyTbl[0];
949 1 for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
950 2 *prdytbl++ = 0;
951 2 }
C51 COMPILER V7.50 OS_CORE 12/14/2007 08:25:29 PAGE 17
952 1
953 1 OSPrioCur = 0;
954 1 OSPrioHighRdy = 0;
955 1
956 1 OSTCBHighRdy = (OS_TCB *)0;
957 1 OSTCBCur = (OS_TCB *)0;
958 1 }
959
960 /*$PAGE*/
961 /*
962 *********************************************************************************************************
963 * INITIALIZATION
964 * CREATING THE IDLE TASK
965 *
966 * Description: This function creates the Idle Task.
967 *
968 * Arguments : none
969 *
970 * Returns : none
971 *********************************************************************************************************
972 */
973
974 static void OS_InitTaskIdle (void) reentrant
975 {
976 1 #if OS_TASK_NAME_SIZE > 7
977 1 INT8U err;
978 1 #endif
979 1
980 1
981 1 #if OS_TASK_CREATE_EXT_EN > 0
982 1 #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_TASK_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
993 1 (void)OSTaskCreateExt(OS_TaskIdle,
994 1 (void *)0, /* No arguments passed to OS_TaskIdle
-() */
995 1 &OSTaskIdleStk[0], /* Set Top-Of-Stack
- */
996 1 OS_TASK_IDLE_PRIO, /* Lowest priority level
- */
997 1 OS_TASK_IDLE_ID,
998 1 &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack
- */
999 1 OS_TASK_IDLE_STK_SIZE,
1000 1 (void *)0, /* No TCB extension
- */
1001 1 OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stac
-k */
C51 COMPILER V7.50 OS_CORE 12/14/2007 08:25:29 PAGE 18
1002 1 #endif
1003 1 #else
#if OS_STK_GROWTH == 1
(void)OSTaskCreate(OS_TaskIdle,
(void *)0,
&OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
OS_TASK_IDLE_PRIO);
#else
(void)OSTaskCreate(OS_TaskIdle,
(void *)0,
&OSTaskIdleStk[0],
OS_TASK_IDLE_PRIO);
#endif
#endif
1016 1
1017 1 #if OS_TASK_NAME_SIZE > 14
1018 1 OSTaskNameSet(OS_TASK_IDLE_PRIO, (INT8U *)"uC/OS-II Idle", &err);
1019 1 #else
#if OS_TASK_NAME_SIZE > 7
OSTaskNameSet(OS_TASK_IDLE_PRIO, (INT8U *)"OS-Idle", &err);
#endif
#endif
1024 1 }
1025 /*$PAGE*/
1026 /*
1027 *********************************************************************************************************
1028 * INITIALIZATION
1029 * CREATING THE STATISTIC TASK
1030 *
1031 * Description: This function creates the Statistic Task.
1032 *
1033 * Arguments : none
1034 *
1035 * Returns : none
1036 *********************************************************************************************************
1037 */
1038
1039 #if OS_TASK_STAT_EN > 0
1040 static void OS_InitTaskStat (void) reentrant
1041 {
1042 1 #if OS_TASK_NAME_SIZE > 7
1043 1 INT8U err;
1044 1 #endif
1045 1
1046 1
1047 1 #if OS_TASK_CREATE_EXT_EN > 0
1048 1 #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_TASK_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 *
-/
C51 COMPILER V7.50 OS_CORE 12/14/2007 08:25:29 PAGE 19
#else
1059 1 (void)OSTaskCreateExt(OS_TaskStat,
1060 1 (void *)0, /* No args passed to OS_TaskStat()*
-/
1061 1 &OSTaskStatStk[0], /* Set Top-Of-Stack *
-/
1062 1 OS_TASK_STAT_PRIO, /* One higher than the idle task *
-/
1063 1 OS_TASK_STAT_ID,
1064 1 &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Bottom-Of-Stack *
-/
1065 1 OS_TASK_STAT_STK_SIZE,
1066 1 (void *)0, /* No TCB extension *
-/
1067 1 OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear *
-/
1068 1 #endif
1069 1 #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_TASK_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_TASK_STAT_PRIO); /* One higher than the idle task *
-/
#endif
#endif
1082 1
1083 1 #if OS_TASK_NAME_SIZE > 14
1084 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -