📄 os_core.lst
字号:
272 #if OS_VERSION >= 204
273 OSInitHookEnd(); /* Call port specific init. code */
\ 00000030 ........ _BLF OSInitHookEnd,??OSInitHookEnd??rA
274 #endif
275
276 #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
277 OSDebugInit();
\ 00000034 ........ _BLF OSDebugInit,??OSDebugInit??rA
278 #endif
279 }
\ 00000038 0080BDE8 POP {PC} ;; return
280 /*$PAGE*/
281 /*
282 *********************************************************************************************************
283 * ENTER ISR
284 *
285 * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
286 * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
287 * only perform rescheduling at the last nested ISR.
288 *
289 * Arguments : none
290 *
291 * Returns : none
292 *
293 * Notes : 1) This function should be called ith interrupts already disabled
294 * 2) Your ISR can directly increment OSIntNesting without calling this function because
295 * OSIntNesting has been declared 'global'.
296 * 3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
297 * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
298 * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
299 * end of the ISR.
300 * 5) You are allowed to nest interrupts up to 255 levels deep.
301 * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
302 * OSIntEnter() is always called with interrupts disabled.
303 *********************************************************************************************************
304 */
305
\ In segment CODE, align 4, keep-with-next
306 void OSIntEnter (void)
307 {
308 if (OSRunning == OS_TRUE) {
\ OSIntEnter:
\ 00000000 ........ LDR R0,??DataTable80 ;; OSRunning
\ 00000004 0000D0E5 LDRB R0,[R0, #+0]
\ 00000008 010050E3 CMP R0,#+1
\ 0000000C 0800001A BNE ??OSIntEnter_0
309 if (OSIntNesting < 255u) {
\ 00000010 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000014 0000D0E5 LDRB R0,[R0, #+0]
\ 00000018 FF0050E3 CMP R0,#+255
\ 0000001C 0400000A BEQ ??OSIntEnter_0
310 OSIntNesting++; /* Increment ISR nesting level */
\ 00000020 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000024 ........ LDR R1,??DataTable95 ;; OSIntNesting
\ 00000028 0010D1E5 LDRB R1,[R1, #+0]
\ 0000002C 011091E2 ADDS R1,R1,#+1
\ 00000030 0010C0E5 STRB R1,[R0, #+0]
311 }
312 }
313 }
\ ??OSIntEnter_0:
\ 00000034 0EF0A0E1 MOV PC,LR ;; return
314 /*$PAGE*/
315 /*
316 *********************************************************************************************************
317 * EXIT ISR
318 *
319 * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
320 * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
321 * a new, high-priority task, is ready to run.
322 *
323 * Arguments : none
324 *
325 * Returns : none
326 *
327 * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
328 * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
329 * end of the ISR.
330 * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
331 *********************************************************************************************************
332 */
333
\ In segment CODE, align 4, keep-with-next
334 void OSIntExit (void)
335 {
\ OSIntExit:
\ 00000000 10402DE9 PUSH {R4,LR}
336 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
337 OS_CPU_SR cpu_sr = 0;
\ 00000004 0000A0E3 MOV R0,#+0
\ 00000008 0040B0E1 MOVS R4,R0
338 #endif
339
340
341
342 if (OSRunning == OS_TRUE) {
\ 0000000C ........ LDR R0,??DataTable80 ;; OSRunning
\ 00000010 0000D0E5 LDRB R0,[R0, #+0]
\ 00000014 010050E3 CMP R0,#+1
\ 00000018 3000001A BNE ??OSIntExit_0
343 OS_ENTER_CRITICAL();
\ 0000001C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 00000020 0040B0E1 MOVS R4,R0
344 if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
\ 00000024 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000028 0000D0E5 LDRB R0,[R0, #+0]
\ 0000002C 010050E3 CMP R0,#+1
\ 00000030 0400003A BCC ??OSIntExit_1
345 OSIntNesting--;
\ 00000034 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000038 ........ LDR R1,??DataTable95 ;; OSIntNesting
\ 0000003C 0010D1E5 LDRB R1,[R1, #+0]
\ 00000040 011051E2 SUBS R1,R1,#+1
\ 00000044 0010C0E5 STRB R1,[R0, #+0]
346 }
347 if (OSIntNesting == 0) { /* Reschedule only if all ISRs complete ... */
\ ??OSIntExit_1:
\ 00000048 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 0000004C 0000D0E5 LDRB R0,[R0, #+0]
\ 00000050 000050E3 CMP R0,#+0
\ 00000054 1F00001A BNE ??OSIntExit_2
348 if (OSLockNesting == 0) { /* ... and not locked. */
\ 00000058 ........ LDR R0,??DataTable96 ;; OSLockNesting
\ 0000005C 0000D0E5 LDRB R0,[R0, #+0]
\ 00000060 000050E3 CMP R0,#+0
\ 00000064 1B00001A BNE ??OSIntExit_2
349 OS_SchedNew();
\ 00000068 ........ BL OS_SchedNew
350 if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
\ 0000006C ........ LDR R0,??DataTable108 ;; OSPrioHighRdy
\ 00000070 0000D0E5 LDRB R0,[R0, #+0]
\ 00000074 ........ LDR R1,??DataTable98 ;; OSPrioCur
\ 00000078 0010D1E5 LDRB R1,[R1, #+0]
\ 0000007C 010050E1 CMP R0,R1
\ 00000080 1400000A BEQ ??OSIntExit_2
351 OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
\ 00000084 ........ LDR R0,??DataTable103 ;; OSTCBHighRdy
\ 00000088 ........ LDR R1,??DataTable108 ;; OSPrioHighRdy
\ 0000008C 0010D1E5 LDRB R1,[R1, #+0]
\ 00000090 0420A0E3 MOV R2,#+4
\ 00000094 ........ LDR R3,??DataTable120 ;; OSTCBPrioTbl
\ 00000098 923121E0 MLA R1,R2,R1,R3
\ 0000009C 001091E5 LDR R1,[R1, #+0]
\ 000000A0 001080E5 STR R1,[R0, #+0]
352 #if OS_TASK_PROFILE_EN > 0
353 OSTCBHighRdy->OSTCBCtxSwCtr++; /* Inc. # of context switches to this task */
\ 000000A4 ........ LDR R0,??DataTable103 ;; OSTCBHighRdy
\ 000000A8 000090E5 LDR R0,[R0, #+0]
\ 000000AC ........ LDR R1,??DataTable103 ;; OSTCBHighRdy
\ 000000B0 001091E5 LDR R1,[R1, #+0]
\ 000000B4 341091E5 LDR R1,[R1, #+52]
\ 000000B8 011091E2 ADDS R1,R1,#+1
\ 000000BC 341080E5 STR R1,[R0, #+52]
354 #endif
355 OSCtxSwCtr++; /* Keep track of the number of ctx switches */
\ 000000C0 ........ LDR R0,??DataTable105 ;; OSCtxSwCtr
\ 000000C4 ........ LDR R1,??DataTable105 ;; OSCtxSwCtr
\ 000000C8 001091E5 LDR R1,[R1, #+0]
\ 000000CC 011091E2 ADDS R1,R1,#+1
\ 000000D0 001080E5 STR R1,[R0, #+0]
356 OSIntCtxSw(); /* Perform interrupt level ctx switch */
\ 000000D4 ........ _BLF OSIntCtxSw,??OSIntCtxSw??rA
357 }
358 }
359 }
360 OS_EXIT_CRITICAL();
\ ??OSIntExit_2:
\ 000000D8 0400B0E1 MOVS R0,R4
\ 000000DC ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
361 }
362 }
\ ??OSIntExit_0:
\ 000000E0 1080BDE8 POP {R4,PC} ;; return
363 /*$PAGE*/
364 /*
365 *********************************************************************************************************
366 * PREVENT SCHEDULING
367 *
368 * Description: This function is used to prevent rescheduling to take place. This allows your application
369 * to prevent context switches until you are ready to permit context switching.
370 *
371 * Arguments : none
372 *
373 * Returns : none
374 *
375 * Notes : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair. In other words, for every
376 * call to OSSchedLock() you MUST have a call to OSSchedUnlock().
377 *********************************************************************************************************
378 */
379
380 #if OS_SCHED_LOCK_EN > 0
\ In segment CODE, align 4, keep-with-next
381 void OSSchedLock (void)
382 {
\ OSSchedLock:
\ 00000000 10402DE9 PUSH {R4,LR}
383 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
384 OS_CPU_SR cpu_sr = 0;
\ 00000004 0000A0E3 MOV R0,#+0
\ 00000008 0040B0E1 MOVS R4,R0
385 #endif
386
387
388
389 if (OSRunning == OS_TRUE) { /* Make sure multitasking is running */
\ 0000000C ........ LDR R0,??DataTable80 ;; OSRunning
\ 00000010 0000D0E5 LDRB R0,[R0, #+0]
\ 00000014 010050E3 CMP R0,#+1
\ 00000018 1000001A BNE ??OSSchedLock_0
390 OS_ENTER_CRITICAL();
\ 0000001C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 00000020 0040B0E1 MOVS R4,R0
391 if (OSIntNesting == 0) { /* Can't call from an ISR */
\ 00000024 ........ LDR R0,??DataTable95 ;; OSIntNesting
\ 00000028 0000D0E5 LDRB R0,[R0, #+0]
\ 0000002C 000050E3 CMP R0,#+0
\ 00000030 0800001A BNE ??OSSchedLock_1
392 if (OSLockNesting < 255u) { /* Prevent OSLockNesting from wrapping back to 0 */
\ 00000034 ........ LDR R0,??DataTable96 ;; OSLockNesting
\ 00000038 0000D0E5 LDRB R0,[R0, #+0]
\ 0000003C FF0050E3 CMP R0,#+255
\ 00000040 0400000A BEQ ??OSSchedLock_1
393 OSLockNesting++; /* Increment lock nesting level */
\ 00000044 ........ LDR R0,??DataTable96 ;; OSLockNesting
\ 00000048 ........ LDR R1,??DataTable96 ;; OSLockNesting
\ 0000004C 0010D1E5 LDRB R1,[R1, #+0]
\ 00000050 011091E2 ADDS R1,R1,#+1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -