📄 os_core.lst
字号:
\ In segment CODE, align 4, keep-with-next
294 void OSIntEnter (void)
295 {
\ OSIntEnter:
\ 00000000 00B5 PUSH {LR}
296 if (OSRunning == TRUE) {
\ 00000002 .... LDR R0,??DataTable34 ;; OSRunning
\ 00000004 0078 LDRB R0,[R0, #+0]
\ 00000006 0128 CMP R0,#+1
\ 00000008 08D1 BNE ??OSIntEnter_0
297 if (OSIntNesting < 255u) {
\ 0000000A .... LDR R0,??DataTable33 ;; OSIntNesting
\ 0000000C 0078 LDRB R0,[R0, #+0]
\ 0000000E FF28 CMP R0,#+255
\ 00000010 04D0 BEQ ??OSIntEnter_0
298 OSIntNesting++; /* Increment ISR nesting level */
\ 00000012 .... LDR R0,??DataTable33 ;; OSIntNesting
\ 00000014 .... LDR R1,??DataTable33 ;; OSIntNesting
\ 00000016 0978 LDRB R1,[R1, #+0]
\ 00000018 491C ADDS R1,R1,#+1
\ 0000001A 0170 STRB R1,[R0, #+0]
299 }
300 }
301 }
\ ??OSIntEnter_0:
\ 0000001C 01BC POP {R0}
\ 0000001E 0047 BX R0 ;; return
302 /*$PAGE*/
303 /*
304 *********************************************************************************************************
305 * EXIT ISR
306 *
307 * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
308 * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
309 * a new, high-priority task, is ready to run.
310 *
311 * Arguments : none
312 *
313 * Returns : none
314 *
315 * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
316 * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
317 * end of the ISR.
318 * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
319 *********************************************************************************************************
320 */
321
\ In segment CODE, align 4, keep-with-next
322 void OSIntExit (void)
323 {
\ OSIntExit:
\ 00000000 10B5 PUSH {R4,LR}
324 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
325 OS_CPU_SR cpu_sr;
326 #endif
327
328
329 if (OSRunning == TRUE) {
\ 00000002 .... LDR R0,??DataTable34 ;; OSRunning
\ 00000004 0078 LDRB R0,[R0, #+0]
\ 00000006 0128 CMP R0,#+1
\ 00000008 44D1 BNE ??OSIntExit_0
330 OS_ENTER_CRITICAL();
\ 0000000A ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 0000000E 0400 MOVS R4,R0
331 if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
\ 00000010 .... LDR R0,??DataTable33 ;; OSIntNesting
\ 00000012 0078 LDRB R0,[R0, #+0]
\ 00000014 0128 CMP R0,#+1
\ 00000016 04D3 BCC ??OSIntExit_1
332 OSIntNesting--;
\ 00000018 .... LDR R0,??DataTable33 ;; OSIntNesting
\ 0000001A .... LDR R1,??DataTable33 ;; OSIntNesting
\ 0000001C 0978 LDRB R1,[R1, #+0]
\ 0000001E 491E SUBS R1,R1,#+1
\ 00000020 0170 STRB R1,[R0, #+0]
333 }
334 if (OSIntNesting == 0) { /* Reschedule only if all ISRs complete ... */
\ ??OSIntExit_1:
\ 00000022 .... LDR R0,??DataTable33 ;; OSIntNesting
\ 00000024 0078 LDRB R0,[R0, #+0]
\ 00000026 0028 CMP R0,#+0
\ 00000028 31D1 BNE ??OSIntExit_2
335 if (OSLockNesting == 0) { /* ... and not locked. */
\ 0000002A .... LDR R0,??DataTable32 ;; OSLockNesting
\ 0000002C 0078 LDRB R0,[R0, #+0]
\ 0000002E 0028 CMP R0,#+0
\ 00000030 2DD1 BNE ??OSIntExit_2
336 OSIntExitY = OSUnMapTbl[OSRdyGrp];
\ 00000032 1A48 LDR R0,??OSIntExit_3 ;; OSIntExitY
\ 00000034 .... LDR R1,??DataTable56 ;; OSRdyGrp
\ 00000036 0978 LDRB R1,[R1, #+0]
\ 00000038 .... LDR R2,??DataTable38 ;; OSUnMapTbl
\ 0000003A 515C LDRB R1,[R2, R1]
\ 0000003C 0170 STRB R1,[R0, #+0]
337 OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
\ 0000003E .... LDR R0,??DataTable43 ;; OSPrioHighRdy
\ 00000040 1649 LDR R1,??OSIntExit_3 ;; OSIntExitY
\ 00000042 0978 LDRB R1,[R1, #+0]
\ 00000044 C900 LSLS R1,R1,#+3
\ 00000046 154A LDR R2,??OSIntExit_3 ;; OSIntExitY
\ 00000048 1278 LDRB R2,[R2, #+0]
\ 0000004A .... LDR R3,??DataTable58 ;; OSRdyTbl
\ 0000004C 9A5C LDRB R2,[R3, R2]
\ 0000004E .... LDR R3,??DataTable38 ;; OSUnMapTbl
\ 00000050 9A5C LDRB R2,[R3, R2]
\ 00000052 8918 ADDS R1,R1,R2
\ 00000054 0170 STRB R1,[R0, #+0]
338 if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
\ 00000056 .... LDR R0,??DataTable43 ;; OSPrioHighRdy
\ 00000058 0078 LDRB R0,[R0, #+0]
\ 0000005A .... LDR R1,??DataTable40 ;; OSPrioCur
\ 0000005C 0978 LDRB R1,[R1, #+0]
\ 0000005E 8842 CMP R0,R1
\ 00000060 15D0 BEQ ??OSIntExit_2
339 OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
\ 00000062 .... LDR R0,??DataTable46 ;; OSTCBHighRdy
\ 00000064 .... LDR R1,??DataTable43 ;; OSPrioHighRdy
\ 00000066 0978 LDRB R1,[R1, #+0]
\ 00000068 0422 MOVS R2,#+4
\ 0000006A 5143 MULS R1,R2,R1
\ 0000006C .... LDR R2,??DataTable44 ;; OSTCBPrioTbl
\ 0000006E 5158 LDR R1,[R2, R1]
\ 00000070 0160 STR R1,[R0, #+0]
340 #if OS_TASK_PROFILE_EN > 0
341 OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */
\ 00000072 .... LDR R0,??DataTable46 ;; OSTCBHighRdy
\ 00000074 0068 LDR R0,[R0, #+0]
\ 00000076 .... LDR R1,??DataTable46 ;; OSTCBHighRdy
\ 00000078 0968 LDR R1,[R1, #+0]
\ 0000007A 496B LDR R1,[R1, #+52]
\ 0000007C 491C ADDS R1,R1,#+1
\ 0000007E 4163 STR R1,[R0, #+52]
342 #endif
343 OSCtxSwCtr++; /* Keep track of the number of ctx switches */
\ 00000080 .... LDR R0,??DataTable23 ;; OSCtxSwCtr
\ 00000082 .... LDR R1,??DataTable23 ;; OSCtxSwCtr
\ 00000084 0968 LDR R1,[R1, #+0]
\ 00000086 491C ADDS R1,R1,#+1
\ 00000088 0160 STR R1,[R0, #+0]
344 OSIntCtxSw(); /* Perform interrupt level ctx switch */
\ 0000008A ........ _BLF OSIntCtxSw,??OSIntCtxSw??rT
345 }
346 }
347 }
348 OS_EXIT_CRITICAL();
\ ??OSIntExit_2:
\ 0000008E 2000 MOVS R0,R4
\ 00000090 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
349 }
350 }
\ ??OSIntExit_0:
\ 00000094 10BC POP {R4}
\ 00000096 01BC POP {R0}
\ 00000098 0047 BX R0 ;; return
\ 0000009A C046 Nop
\ ??OSIntExit_3:
\ 0000009C ........ DC32 OSIntExitY
351 /*$PAGE*/
352 /*
353 *********************************************************************************************************
354 * PREVENT SCHEDULING
355 *
356 * Description: This function is used to prevent rescheduling to take place. This allows your application
357 * to prevent context switches until you are ready to permit context switching.
358 *
359 * Arguments : none
360 *
361 * Returns : none
362 *
363 * Notes : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair. In other words, for every
364 * call to OSSchedLock() you MUST have a call to OSSchedUnlock().
365 *********************************************************************************************************
366 */
367
368 #if OS_SCHED_LOCK_EN > 0
\ In segment CODE, align 4, keep-with-next
369 void OSSchedLock (void)
370 {
\ OSSchedLock:
\ 00000000 00B5 PUSH {LR}
371 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
372 OS_CPU_SR cpu_sr;
373 #endif
374
375
376 if (OSRunning == TRUE) { /* Make sure multitasking is running */
\ 00000002 .... LDR R0,??DataTable34 ;; OSRunning
\ 00000004 0078 LDRB R0,[R0, #+0]
\ 00000006 0128 CMP R0,#+1
\ 00000008 0CD1 BNE ??OSSchedLock_0
377 OS_ENTER_CRITICAL();
\ 0000000A ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
378 if (OSLockNesting < 255u) { /* Prevent OSLockNesting from wrapping back to 0 */
\ 0000000E .... LDR R1,??DataTable32 ;; OSLockNesting
\ 00000010 0978 LDRB R1,[R1, #+0]
\ 00000012 FF29 CMP R1,#+255
\ 00000014 04D0 BEQ ??OSSchedLock_1
379 OSLockNesting++; /* Increment lock nesting level */
\ 00000016 .... LDR R1,??DataTable32 ;; OSLockNesting
\ 00000018 .... LDR R2,??DataTable32 ;; OSLockNesting
\ 0000001A 1278 LDRB R2,[R2, #+0]
\ 0000001C 521C ADDS R2,R2,#+1
\ 0000001E 0A70 STRB R2,[R1, #+0]
380 }
381 OS_EXIT_CRITICAL();
\ ??OSSchedLock_1:
\ 00000020 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
382 }
383 }
\ ??OSSchedLock_0:
\ 00000024 01BC POP {R0}
\ 00000026 0047 BX R0 ;; return
384 #endif
385
386 /*$PAGE*/
387 /*
388 *********************************************************************************************************
389 * ENABLE SCHEDULING
390 *
391 * Description: This function is used to re-allow rescheduling.
392 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -