📄 os_core.lis
字号:
0010 ; #endif
0010 ;
0010 ; OS_InitTaskIdle(); /* Create the Idle Task */
0010 69D1 xcall _OS_InitTaskIdle
0012 .dbline 115
0012 ; #if OS_TASK_STAT_EN > 0
0012 ; OS_InitTaskStat(); /* Create the Statistic Task */
0012 ; #endif
0012 ;
0012 ; #if OS_VERSION >= 204
0012 ; OSInitHookEnd(); /* Call port specific init. code */
0012 0E940000 xcall _OSInitHookEnd
0016 .dbline -2
0016 L3:
0016 .dbline 0 ; func end
0016 0895 ret
0018 .dbend
0018 .dbfunc e OSIntEnter _OSIntEnter fV
.even
0018 _OSIntEnter::
0018 .dbline -1
0018 .dbline 145
0018 ; #endif
0018 ; }
0018 ;
0018 ; /*
0018 ; *********************************************************************************************************
0018 ; * ENTER ISR
0018 ; *
0018 ; * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
0018 ; * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
0018 ; * only perform rescheduling at the last nested ISR.
0018 ; *
0018 ; * Arguments : none
0018 ; *
0018 ; * Returns : none
0018 ; *
0018 ; * Notes : 1) This function should be called ith interrupts already disabled
0018 ; * 2) Your ISR can directly increment OSIntNesting without calling this function because
0018 ; * OSIntNesting has been declared 'global'.
0018 ; * 3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
0018 ; * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
0018 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
0018 ; * end of the ISR.
0018 ; * 5) You are allowed to nest interrupts up to 255 levels deep.
0018 ; * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
0018 ; * OSIntEnter() is always called with interrupts disabled.
0018 ; *********************************************************************************************************
0018 ; */
0018 ;
0018 ; void OSIntEnter (void)
0018 ; {
0018 .dbline 146
0018 ; if (OSRunning == TRUE) {
0018 80912301 lds R24,_OSRunning
001C 8130 cpi R24,1
001E 39F4 brne L5
0020 .dbline 146
0020 .dbline 147
0020 ; if (OSIntNesting < 255) {
0020 80912C01 lds R24,_OSIntNesting
0024 8F3F cpi R24,255
0026 18F4 brsh L7
0028 .dbline 147
0028 .dbline 148
0028 ; OSIntNesting++; /* Increment ISR nesting level */
0028 8F5F subi R24,255 ; addi 1
002A 80932C01 sts _OSIntNesting,R24
002E .dbline 149
002E ; }
002E L7:
002E .dbline 150
002E L5:
002E .dbline -2
002E L4:
002E .dbline 0 ; func end
002E 0895 ret
0030 .dbend
0030 .dbfunc e OSIntExit _OSIntExit fV
.even
0030 _OSIntExit::
0030 0E940000 xcall push_gset2
0034 .dbline -1
0034 .dbline 173
0034 ; }
0034 ; }
0034 ;
0034 ; /*
0034 ; *********************************************************************************************************
0034 ; * EXIT ISR
0034 ; *
0034 ; * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
0034 ; * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
0034 ; * a new, high-priority task, is ready to run.
0034 ; *
0034 ; * Arguments : none
0034 ; *
0034 ; * Returns : none
0034 ; *
0034 ; * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
0034 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
0034 ; * end of the ISR.
0034 ; * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
0034 ; *********************************************************************************************************
0034 ; */
0034 ;
0034 ; void OSIntExit (void)
0034 ; {
0034 .dbline 179
0034 ; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
0034 ; OS_CPU_SR cpu_sr;
0034 ; #endif
0034 ;
0034 ;
0034 ; if (OSRunning == TRUE) {
0034 80912301 lds R24,_OSRunning
0038 8130 cpi R24,1
003A 09F0 breq X0
003C 6CC0 xjmp L10
003E X0:
003E .dbline 179
003E .dbline 180
003E ; OS_ENTER_CRITICAL();
003E 0A93 st -y,r16
0040 0FB7 in r16,0x3F
0042 F894 cli
0044 0F93 push r16
0046 0991 ld r16,y+
0048 .dbline 180
0048 .dbline 181
0048 ; if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
0048 2224 clr R2
004A 30902C01 lds R3,_OSIntNesting
004E 2314 cp R2,R3
0050 20F4 brsh L12
0052 .dbline 181
0052 .dbline 182
0052 ; OSIntNesting--;
0052 832D mov R24,R3
0054 8150 subi R24,1
0056 80932C01 sts _OSIntNesting,R24
005A .dbline 183
005A ; }
005A L12:
005A .dbline 184
005A ; if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ... */
005A 20902C01 lds R2,_OSIntNesting
005E 2220 tst R2
0060 09F0 breq X1
0062 55C0 xjmp L14
0064 X1:
0064 20902A01 lds R2,_OSLockNesting
0068 2220 tst R2
006A 09F0 breq X2
006C 50C0 xjmp L14
006E X2:
006E .dbline 184
006E .dbline 185
006E ; OSIntExitY = OSUnMapTbl[OSRdyGrp]; /* ... and not locked. */
006E 80E0 ldi R24,<_OSUnMapTbl
0070 90E0 ldi R25,>_OSUnMapTbl
0072 E0912701 lds R30,_OSRdyGrp
0076 FF27 clr R31
0078 E80F add R30,R24
007A F91F adc R31,R25
007C E491 lpm R30,Z
007E E0932B01 sts _OSIntExitY,R30
0082 .dbline 186
0082 ; OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
0082 80E0 ldi R24,<_OSRdyTbl
0084 90E0 ldi R25,>_OSRdyTbl
0086 FF27 clr R31
0088 E80F add R30,R24
008A F91F adc R31,R25
008C E081 ldd R30,z+0
008E FF27 clr R31
0090 80E0 ldi R24,<_OSUnMapTbl
0092 90E0 ldi R25,>_OSUnMapTbl
0094 E80F add R30,R24
0096 F91F adc R31,R25
0098 2490 lpm R2,Z
009A 3324 clr R3
009C 40902B01 lds R4,_OSIntExitY
00A0 5524 clr R5
00A2 440C lsl R4
00A4 551C rol R5
00A6 440C lsl R4
00A8 551C rol R5
00AA 440C lsl R4
00AC 551C rol R5
00AE 420C add R4,R2
00B0 531C adc R5,R3
00B2 40922801 sts _OSPrioHighRdy,R4
00B6 .dbline 187
00B6 ; if (OSPrioHighRdy != OSPrioCur) { /* No Ctx Sw if current task is highest rdy */
00B6 20902901 lds R2,_OSPrioCur
00BA 4214 cp R4,R2
00BC 41F1 breq L16
00BE .dbline 187
00BE .dbline 188
00BE ; OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
00BE 242C mov R2,R4
00C0 82E0 ldi R24,2
00C2 829D mul R24,R2
00C4 F001 movw R30,R0
00C6 80E0 ldi R24,<_OSTCBPrioTbl
00C8 90E0 ldi R25,>_OSTCBPrioTbl
00CA E80F add R30,R24
00CC F91F adc R31,R25
00CE 2080 ldd R2,z+0
00D0 3180 ldd R3,z+1
00D2 30929900 sts _OSTCBHighRdy+1,R3
00D6 20929800 sts _OSTCBHighRdy,R2
00DA .dbline 189
00DA ; OSCtxSwCtr++; /* Keep track of the number of ctx switches */
00DA 41E0 ldi R20,1
00DC 50E0 ldi R21,0
00DE 60E0 ldi R22,0
00E0 70E0 ldi R23,0
00E2 40904501 lds R4,_OSCtxSwCtr+2
00E6 50904601 lds R5,_OSCtxSwCtr+2+1
00EA 20904301 lds R2,_OSCtxSwCtr
00EE 30904401 lds R3,_OSCtxSwCtr+1
00F2 240E add R2,R20
00F4 351E adc R3,R21
00F6 461E adc R4,R22
00F8 571E adc R5,R23
00FA 30924401 sts _OSCtxSwCtr+1,R3
00FE 20924301 sts _OSCtxSwCtr,R2
0102 50924601 sts _OSCtxSwCtr+2+1,R5
0106 40924501 sts _OSCtxSwCtr+2,R4
010A .dbline 190
010A ; OSIntCtxSw(); /* Perform interrupt level ctx switch */
010A 0E940000 xcall _OSIntCtxSw
010E .dbline 191
010E ; }
010E L16:
010E .dbline 192
010E ; }
010E L14:
010E .dbline 193
010E 0A93 st -y,r16
0110 0F91 pop r16
0112 0FBF out 0x3F,r16
0114 0991 ld r16,y+
0116 .dbline 193
0116 .dbline 194
0116 L10:
0116 .dbline -2
0116 L9:
0116 0E940000 xcall pop_gset2
011A .dbline 0 ; func end
011A 0895 ret
011C .dbend
011C .dbfunc e OSStart _OSStart fV
011C ; x -> R22
011C ; y -> R20
.even
011C _OSStart::
011C 0E940000 xcall push_gset2
0120 .dbline -1
0120 .dbline 294
0120 .dbline 299
0120 20902301 lds R2,_OSRunning
0124 2220 tst R2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -