📄 os_core.lst
字号:
298 OSIntNesting++; /* Increment ISR nesting level */
\ 00000012 .... LDR R0,??DataTable29 ;; OSIntNesting
\ 00000014 .... LDR R1,??DataTable29 ;; 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,??DataTable51 ;; OSRunning
\ 00000004 0078 LDRB R0,[R0, #+0]
\ 00000006 0128 CMP R0,#+1
\ 00000008 3FD1 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,??DataTable29 ;; OSIntNesting
\ 00000012 0078 LDRB R0,[R0, #+0]
\ 00000014 0028 CMP R0,#+0
\ 00000016 04D0 BEQ ??OSIntExit_1
332 OSIntNesting--;
\ 00000018 .... LDR R0,??DataTable29 ;; OSIntNesting
\ 0000001A .... LDR R1,??DataTable29 ;; 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,??DataTable29 ;; OSIntNesting
\ 00000024 0078 LDRB R0,[R0, #+0]
\ 00000026 0028 CMP R0,#+0
\ 00000028 2CD1 BNE ??OSIntExit_2
335 if (OSLockNesting == 0) { /* ... and not locked. */
\ 0000002A .... LDR R0,??DataTable28 ;; OSLockNesting
\ 0000002C 0078 LDRB R0,[R0, #+0]
\ 0000002E 0028 CMP R0,#+0
\ 00000030 28D1 BNE ??OSIntExit_2
336 OSIntExitY = OSUnMapTbl[OSRdyGrp];
\ 00000032 1748 LDR R0,??OSIntExit_3 ;; OSIntExitY
\ 00000034 .... LDR R1,??DataTable54 ;; OSRdyGrp
\ 00000036 0978 LDRB R1,[R1, #+0]
\ 00000038 .... LDR R2,??DataTable59 ;; OSUnMapTbl
\ 0000003A 515C LDRB R1,[R2, R1]
\ 0000003C 0170 STRB R1,[R0, #+0]
337 OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
\ 0000003E .... LDR R0,??DataTable41 ;; OSPrioHighRdy
\ 00000040 1349 LDR R1,??OSIntExit_3 ;; OSIntExitY
\ 00000042 0978 LDRB R1,[R1, #+0]
\ 00000044 C900 LSLS R1,R1,#+3
\ 00000046 124A LDR R2,??OSIntExit_3 ;; OSIntExitY
\ 00000048 1278 LDRB R2,[R2, #+0]
\ 0000004A .... LDR R3,??DataTable65 ;; OSRdyTbl
\ 0000004C 9A5C LDRB R2,[R3, R2]
\ 0000004E .... LDR R3,??DataTable59 ;; 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 0078 LDRB R0,[R0, #+0]
\ 00000058 .... LDR R1,??DataTable38 ;; OSPrioCur
\ 0000005A 0978 LDRB R1,[R1, #+0]
\ 0000005C 8842 CMP R0,R1
\ 0000005E 11D0 BEQ ??OSIntExit_2
339 OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
\ 00000060 .... LDR R0,??DataTable44 ;; OSTCBHighRdy
\ 00000062 .... LDR R1,??DataTable41 ;; OSPrioHighRdy
\ 00000064 0978 LDRB R1,[R1, #+0]
\ 00000066 8900 LSLS R1,R1,#+2
\ 00000068 .... LDR R2,??DataTable61 ;; OSTCBPrioTbl
\ 0000006A 5158 LDR R1,[R2, R1]
\ 0000006C 0160 STR R1,[R0, #+0]
340 #if OS_TASK_PROFILE_EN > 0
341 OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */
\ 0000006E 0800 MOVS R0,R1
\ 00000070 416B LDR R1,[R0, #+52]
\ 00000072 491C ADDS R1,R1,#+1
\ 00000074 4163 STR R1,[R0, #+52]
342 #endif
343 OSCtxSwCtr++; /* Keep track of the number of ctx switches */
\ 00000076 .... LDR R0,??DataTable20 ;; OSCtxSwCtr
\ 00000078 .... LDR R1,??DataTable20 ;; OSCtxSwCtr
\ 0000007A 0968 LDR R1,[R1, #+0]
\ 0000007C 491C ADDS R1,R1,#+1
\ 0000007E 0160 STR R1,[R0, #+0]
344 OSIntCtxSw(); /* Perform interrupt level ctx switch */
\ 00000080 ........ _BLF OSIntCtxSw,??OSIntCtxSw??rT
345 }
346 }
347 }
348 OS_EXIT_CRITICAL();
\ ??OSIntExit_2:
\ 00000084 2000 MOVS R0,R4
\ 00000086 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
349 }
350 }
\ ??OSIntExit_0:
\ 0000008A 10BC POP {R4}
\ 0000008C 01BC POP {R0}
\ 0000008E 0047 BX R0 ;; return
\ ??OSIntExit_3:
\ 00000090 ........ 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,??DataTable51 ;; 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,??DataTable28 ;; 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,??DataTable28 ;; OSLockNesting
\ 00000018 .... LDR R2,??DataTable28 ;; 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 *
393 * Arguments : none
394 *
395 * Returns : none
396 *
397 * Notes : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair. In other words, for every
398 * call to OSSchedLock() you MUST have a call to OSSchedUnlock().
399 *********************************************************************************************************
400 */
401
402 #if OS_SCHED_LOCK_EN > 0
\ In segment CODE, align 4, keep-with-next
403 void OSSchedUnlock (void)
404 {
\ OSSchedUnlock:
\ 00000000 00B5 PUSH {LR}
405 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
406 OS_CPU_SR cpu_sr;
407 #endif
408
409
410 if (OSRunning == TRUE) { /* Make sure multitasking is running */
\ 00000002 .... LDR R0,??DataTable51 ;; OSRunning
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -