📄 os_core.txt
字号:
0005e8 00000000 DCD OSTCBFreeList
ENDP
OS_InitRdyList PROC
;;;942
;;;943 OSRdyGrp = 0; /* Clear the ready list */
0005ec e3a02000 MOV r2,#0
0005f0 e59f3a28 LDR r3,|L1.4128|
0005f4 e5c32000 STRB r2,[r3,#0] ; OSRdyGrp
;;;944 prdytbl = &OSRdyTbl[0];
0005f8 e59f0a24 LDR r0,|L1.4132|
;;;945 for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
0005fc e3a01000 MOV r1,#0
000600 ea000003 B |L1.1556|
|L1.1540|
;;;946 *prdytbl++ = 0;
000604 e3a02000 MOV r2,#0
000608 e4c02001 STRB r2,[r0],#1
00060c e2812001 ADD r2,r1,#1
000610 e20210ff AND r1,r2,#0xff
|L1.1556|
000614 e3510004 CMP r1,#4
000618 bafffff9 BLT |L1.1540|
;;;947 }
;;;948
;;;949 OSPrioCur = 0;
00061c e3a02000 MOV r2,#0
000620 e59f3a00 LDR r3,|L1.4136|
000624 e5c32000 STRB r2,[r3,#0] ; OSPrioCur
;;;950 OSPrioHighRdy = 0;
000628 e59f39fc LDR r3,|L1.4140|
00062c e5c32000 STRB r2,[r3,#0] ; OSPrioHighRdy
;;;951
;;;952 OSTCBHighRdy = (OS_TCB *)0;
000630 e59f39f8 LDR r3,|L1.4144|
000634 e5832000 STR r2,[r3,#0] ; OSTCBHighRdy
;;;953 OSTCBCur = (OS_TCB *)0;
000638 e59f39f4 LDR r3,|L1.4148|
00063c e5832000 STR r2,[r3,#0] ; OSTCBCur
;;;954 }
000640 e12fff1e BX lr
ENDP
OS_InitMisc PROC
;;;899 #if OS_TIME_GET_SET_EN > 0
;;;900 OSTime = 0L; /* Clear the 32-bit system clock */
000644 e3a00000 MOV r0,#0
000648 e59f19e8 LDR r1,|L1.4152|
00064c e5810000 STR r0,[r1,#0] ; OSTime
;;;901 #endif
;;;902
;;;903 OSIntNesting = 0; /* Clear the interrupt nesting counter */
000650 e59f19e4 LDR r1,|L1.4156|
000654 e5c10000 STRB r0,[r1,#0] ; OSIntNesting
;;;904 OSLockNesting = 0; /* Clear the scheduling lock counter */
000658 e59f19e0 LDR r1,|L1.4160|
00065c e5c10000 STRB r0,[r1,#0] ; OSLockNesting
;;;905
;;;906 OSTaskCtr = 0; /* Clear the number of tasks */
000660 e59f19dc LDR r1,|L1.4164|
000664 e5c10000 STRB r0,[r1,#0] ; OSTaskCtr
;;;907
;;;908 OSRunning = OS_FALSE; /* Indicate that multitasking not started */
000668 e59f19d8 LDR r1,|L1.4168|
00066c e5c10000 STRB r0,[r1,#0] ; OSRunning
;;;909
;;;910 OSCtxSwCtr = 0; /* Clear the context switch counter */
000670 e59f19d4 LDR r1,|L1.4172|
000674 e5810000 STR r0,[r1,#0] ; OSCtxSwCtr
;;;911 OSIdleCtr = 0L; /* Clear the 32-bit idle counter */
000678 e51f10e4 LDR r1,|L1.1436|
00067c e5810000 STR r0,[r1,#0] ; OSIdleCtr
;;;912
;;;913 #if OS_TASK_STAT_EN > 0
;;;914 OSIdleCtrRun = 0L;
000680 e51f10e8 LDR r1,|L1.1440|
000684 e5810000 STR r0,[r1,#0] ; OSIdleCtrRun
;;;915 OSIdleCtrMax = 0L;
000688 e51f10f8 LDR r1,|L1.1432|
00068c e5810000 STR r0,[r1,#0] ; OSIdleCtrMax
;;;916 OSStatRdy = OS_FALSE; /* Statistic task is not ready */
000690 e51f1104 LDR r1,|L1.1428|
000694 e5c10000 STRB r0,[r1,#0] ; OSStatRdy
;;;917 #endif
;;;918 }
000698 e12fff1e BX lr
ENDP
OSInit PROC
;;;237 void OSInit (void)
;;;238 {
00069c e92d4010 PUSH {r4,lr}
;;;239 #if OS_VERSION >= 204
;;;240 OSInitHookBegin(); /* Call port specific initialization code */
0006a0 ebfffffe BL OSInitHookBegin
;;;241 #endif
;;;242
;;;243 OS_InitMisc(); /* Initialize miscellaneous variables */
0006a4 ebfffffe BL OS_InitMisc
;;;244
;;;245 OS_InitRdyList(); /* Initialize the Ready List */
0006a8 ebfffffe BL OS_InitRdyList
;;;246
;;;247 OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
0006ac ebfffffe BL OS_InitTCBList
;;;248
;;;249 OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
0006b0 ebfffffe BL OS_InitEventList
;;;250
;;;251 #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
;;;252 OS_FlagInit(); /* Initialize the event flag structures */
0006b4 ebfffffe BL OS_FlagInit
;;;253 #endif
;;;254
;;;255 #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
;;;256 OS_MemInit(); /* Initialize the memory manager */
0006b8 ebfffffe BL OS_MemInit
;;;257 #endif
;;;258
;;;259 #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
;;;260 OS_QInit(); /* Initialize the message queue structures */
0006bc ebfffffe BL OS_QInit
;;;261 #endif
;;;262
;;;263 OS_InitTaskIdle(); /* Create the Idle Task */
0006c0 ebfffffe BL OS_InitTaskIdle
;;;264 #if OS_TASK_STAT_EN > 0
;;;265 OS_InitTaskStat(); /* Create the Statistic Task */
0006c4 ebfffffe BL OS_InitTaskStat
;;;266 #endif
;;;267
;;;268 #if OS_TMR_EN > 0
;;;269 OSTmr_Init(); /* Initialize the Timer Manager */
0006c8 ebfffffe BL OSTmr_Init
;;;270 #endif
;;;271
;;;272 #if OS_VERSION >= 204
;;;273 OSInitHookEnd(); /* Call port specific init. code */
0006cc ebfffffe BL OSInitHookEnd
;;;274 #endif
;;;275
;;;276 #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
;;;277 OSDebugInit();
0006d0 ebfffffe BL OSDebugInit
;;;278 #endif
;;;279 }
0006d4 e8bd4010 POP {r4,lr}
0006d8 e12fff1e BX lr
ENDP
OSIntEnter PROC
;;;307 {
;;;308 if (OSRunning == OS_TRUE) {
0006dc e59f0964 LDR r0,|L1.4168|
0006e0 e5d00000 LDRB r0,[r0,#0] ; OSRunning
0006e4 e3500001 CMP r0,#1
0006e8 1a000008 BNE |L1.1808|
;;;309 if (OSIntNesting < 255u) {
0006ec e59f0948 LDR r0,|L1.4156|
0006f0 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
0006f4 e35000ff CMP r0,#0xff
0006f8 2a000004 BCS |L1.1808|
;;;310 OSIntNesting++; /* Increment ISR nesting level */
0006fc e59f0938 LDR r0,|L1.4156|
000700 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
000704 e2800001 ADD r0,r0,#1
000708 e59f192c LDR r1,|L1.4156|
00070c e5c10000 STRB r0,[r1,#0] ; OSIntNesting
|L1.1808|
;;;311 }
;;;312 }
;;;313 }
000710 e12fff1e BX lr
ENDP
OS_SchedNew PROC
;;;1255
;;;1256 y = OSUnMapTbl[OSRdyGrp];
000714 e59f1934 LDR r1,|L1.4176|
000718 e59f2900 LDR r2,|L1.4128|
00071c e5d22000 LDRB r2,[r2,#0] ; OSRdyGrp
000720 e7d10002 LDRB r0,[r1,r2]
;;;1257 OSPrioHighRdy = (INT8U)((y << 3) + OSUnMapTbl[OSRdyTbl[y]]);
000724 e59f18f8 LDR r1,|L1.4132|
000728 e7d11000 LDRB r1,[r1,r0]
00072c e59f291c LDR r2,|L1.4176|
000730 e7d21001 LDRB r1,[r2,r1]
000734 e0811180 ADD r1,r1,r0,LSL #3
000738 e59f28ec LDR r2,|L1.4140|
00073c e5c21000 STRB r1,[r2,#0] ; OSPrioHighRdy
;;;1258 #else /* We support up to 256 tasks */
;;;1259 INT8U y;
;;;1260 INT16U *ptbl;
;;;1261
;;;1262
;;;1263 if ((OSRdyGrp & 0xFF) != 0) {
;;;1264 y = OSUnMapTbl[OSRdyGrp & 0xFF];
;;;1265 } else {
;;;1266 y = OSUnMapTbl[(OSRdyGrp >> 8) & 0xFF] + 8;
;;;1267 }
;;;1268 ptbl = &OSRdyTbl[y];
;;;1269 if ((*ptbl & 0xFF) != 0) {
;;;1270 OSPrioHighRdy = (INT8U)((y << 4) + OSUnMapTbl[(*ptbl & 0xFF)]);
;;;1271 } else {
;;;1272 OSPrioHighRdy = (INT8U)((y << 4) + OSUnMapTbl[(*ptbl >> 8) & 0xFF] + 8);
;;;1273 }
;;;1274 #endif
;;;1275 }
000740 e12fff1e BX lr
ENDP
OSIntExit PROC
;;;334 void OSIntExit (void)
;;;335 {
000744 e92d4010 PUSH {r4,lr}
;;;336 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
;;;337 OS_CPU_SR cpu_sr = 0;
000748 e3a04000 MOV r4,#0
;;;338 #endif
;;;339
;;;340
;;;341
;;;342 if (OSRunning == OS_TRUE) {
00074c e59f08f4 LDR r0,|L1.4168|
000750 e5d00000 LDRB r0,[r0,#0] ; OSRunning
000754 e3500001 CMP r0,#1
000758 1a00002d BNE |L1.2068|
;;;343 OS_ENTER_CRITICAL();
00075c ebfffffe BL OS_CPU_SR_Save
000760 e1a04000 MOV r4,r0
;;;344 if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
000764 e59f08d0 LDR r0,|L1.4156|
000768 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
00076c e3500000 CMP r0,#0
000770 da000004 BLE |L1.1928|
;;;345 OSIntNesting--;
000774 e59f08c0 LDR r0,|L1.4156|
000778 e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
00077c e2400001 SUB r0,r0,#1
000780 e59f18b4 LDR r1,|L1.4156|
000784 e5c10000 STRB r0,[r1,#0] ; OSIntNesting
|L1.1928|
;;;346 }
;;;347 if (OSIntNesting == 0) { /* Reschedule only if all ISRs complete ... */
000788 e59f08ac LDR r0,|L1.4156|
00078c e5d00000 LDRB r0,[r0,#0] ; OSIntNesting
000790 e3500000 CMP r0,#0
000794 1a00001c BNE |L1.2060|
;;;348 if (OSLockNesting == 0) { /* ... and not locked. */
000798 e59f08a0 LDR r0,|L1.4160|
00079c e5d00000 LDRB r0,[r0,#0] ; OSLockNesting
0007a0 e3500000 CMP r0,#0
0007a4 1a000018 BNE |L1.2060|
;;;349 OS_SchedNew();
0007a8 ebfffffe BL OS_SchedNew
;;;350 if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
0007ac e59f0878 LDR r0,|L1.4140|
0007b0 e5d00000 LDRB r0,[r0,#0] ; OSPrioHighRdy
0007b4 e59f186c LDR r1,|L1.4136|
0007b8 e5d11000 LDRB r1,[r1,#0] ; OSPrioCur
0007bc e1500001 CMP r0,r1
0007c0 0a000011 BEQ |L1.2060|
;;;351 OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
0007c4 e51f023c LDR r0,|L1.1424|
0007c8 e59f185c LDR r1,|L1.4140|
0007cc e5d11000 LDRB r1,[r1,#0] ; OSPrioHighRdy
0007d0 e7900101 LDR r0,[r0,r1,LSL #2]
0007d4 e59f1854 LDR r1,|L1.4144|
0007d8 e5810000 STR r0,[r1,#0] ; OSTCBHighRdy
;;;352 #if OS_TASK_PROFILE_EN > 0
;;;353 OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */
0007dc e2810000 ADD r0,r1,#0
0007e0 e5900000 LDR r0,[r0,#0] ; OSTCBHighRdy
0007e4 e5900034 LDR r0,[r0,#0x34]
0007e8 e2800001 ADD r0,r0,#1
0007ec e5911000 LDR r1,[r1,#0] ; OSTCBHighRdy
0007f0 e5810034 STR r0,[r1,#0x34]
;;;354 #endif
;;;355 OSCtxSwCtr++; /* Keep track of the number of ctx switches */
0007f4 e59f0850 LDR r0,|L1.4172|
0007f8 e5900000 LDR r0,[r0,#0] ; OSCtxSwCtr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -