📄 ucosii.lst
字号:
(0270)
(0271) #if OS_Q_EN && (OS_MAX_QS >= 2)
(0272) OSQInit(); /* Initialize the message queue structures */
(0273) #endif
(0274)
(0275) #if OS_MEM_EN && OS_MAX_MEM_PART >= 2
(0276) OSMemInit(); /* Initialize the memory manager */
(0277) #endif
(0278)
(0279) #if OS_STK_GROWTH == 1
(0280) #if OS_TASK_CREATE_EXT_EN
(0281) OSTaskCreateExt(OSTaskIdle,
(0282) (void *)0, /* No arguments passed to OSTaskIdle() */
(0283) &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack */
(0284) OS_IDLE_PRIO, /* Lowest priority level */
(0285) OS_TASK_IDLE_ID,
(0286) &OSTaskIdleStk[0], /* Set Bottom-Of-Stack */
(0287) OS_TASK_IDLE_STK_SIZE,
(0288) (void *)0, /* No TCB extension */
(0289) OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack */
(0290) #else
(0291) OSTaskCreate(OSTaskIdle, (void *)0, &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], OS_IDLE_PRIO);
03DA E184 LDI R24,0x14
03DB 838A STD R24,2+Y
03DC E08F LDI R24,0xF
03DD E091 LDI R25,1
03DE 8388 STD R24,0+Y
03DF 8399 STD R25,1+Y
03E0 2722 CLR R18
03E1 2733 CLR R19
03E2 E10A LDI R16,0x1A
03E3 E010 LDI R17,0
03E4 D4BC RCALL _OSTaskCreate
(0292) #endif
(0293) #else
(0294) #if OS_TASK_CREATE_EXT_EN
(0295) OSTaskCreateExt(OSTaskIdle,
(0296) (void *)0, /* No arguments passed to OSTaskIdle() */
(0297) &OSTaskIdleStk[0], /* Set Top-Of-Stack */
(0298) OS_IDLE_PRIO, /* Lowest priority level */
(0299) OS_TASK_IDLE_ID,
(0300) &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack */
(0301) OS_TASK_IDLE_STK_SIZE,
(0302) (void *)0, /* No TCB extension */
(0303) OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack */
(0304) #else
(0305) OSTaskCreate(OSTaskIdle, (void *)0, &OSTaskIdleStk[0], OS_IDLE_PRIO);
(0306) #endif
(0307) #endif
(0308)
(0309) #if OS_TASK_STAT_EN
(0310) #if OS_TASK_CREATE_EXT_EN
(0311) #if OS_STK_GROWTH == 1
(0312) OSTaskCreateExt(OSTaskStat,
(0313) (void *)0, /* No args passed to OSTaskStat() */
(0314) &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],/* Set Top-Of-Stack */
(0315) OS_STAT_PRIO, /* One higher than the idle task */
(0316) OS_TASK_STAT_ID,
(0317) &OSTaskStatStk[0], /* Set Bottom-Of-Stack */
(0318) OS_TASK_STAT_STK_SIZE,
(0319) (void *)0, /* No TCB extension */
(0320) OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear */
(0321) #else
(0322) OSTaskCreateExt(OSTaskStat,
(0323) (void *)0, /* No args passed to OSTaskStat() */
(0324) &OSTaskStatStk[0], /* Set Top-Of-Stack */
(0325) OS_STAT_PRIO, /* One higher than the idle task */
(0326) OS_TASK_STAT_ID,
(0327) &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],/* Set Bottom-Of-Stack */
(0328) OS_TASK_STAT_STK_SIZE,
(0329) (void *)0, /* No TCB extension */
(0330) OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear */
(0331) #endif
(0332) #else
(0333) #if OS_STK_GROWTH == 1
(0334) OSTaskCreate(OSTaskStat,
(0335) (void *)0, /* No args passed to OSTaskStat() */
(0336) &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Top-Of-Stack */
(0337) OS_STAT_PRIO); /* One higher than the idle task */
(0338) #else
(0339) OSTaskCreate(OSTaskStat,
(0340) (void *)0, /* No args passed to OSTaskStat() */
(0341) &OSTaskStatStk[0], /* Set Top-Of-Stack */
(0342) OS_STAT_PRIO); /* One higher than the idle task */
(0343) #endif
(0344) #endif
(0345) #endif
(0346) }
03E5 9623 ADIW R28,3
03E6 D919 RCALL pop_gset1
03E7 9508 RET
(0347) /*$PAGE*/
(0348) /*
(0349) *********************************************************************************************************
(0350) * ENTER ISR
(0351) *
(0352) * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
(0353) * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
(0354) * only perform rescheduling at the last nested ISR.
(0355) *
(0356) * Arguments : none
(0357) *
(0358) * Returns : none
(0359) *
(0360) * Notes : 1) Your ISR can directly increment OSIntNesting without calling this function because
(0361) * OSIntNesting has been declared 'global'. You MUST, however, be sure that the increment
(0362) * is performed 'indivisibly' by your processor to ensure proper access to this critical
(0363) * resource.
(0364) * 2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
(0365) * 3) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
(0366) * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
(0367) * end of the ISR.
(0368) *********************************************************************************************************
(0369) */
(0370)
(0371) void OSIntEnter (void)
(0372) {
(0373) OS_ENTER_CRITICAL();
_OSIntEnter:
03E8 930A ST R16,-Y
03E9 B70F IN R16,P3F
03EA 94F8 BCLR 7
03EB 930F PUSH R16
03EC 9109 LD R16,Y+
(0374) OSIntNesting++; /* Increment ISR nesting level */
03ED 91800150 LDS R24,_OSIntNesting
03EF 5F8F SUBI R24,0xFF
03F0 93800150 STS R24,_OSIntNesting
(0375) OS_EXIT_CRITICAL();
03F2 930A ST R16,-Y
03F3 910F POP R16
03F4 BF0F OUT P3F,R16
03F5 9109 LD R16,Y+
(0376) }
03F6 9508 RET
(0377) /*$PAGE*/
(0378) /*
(0379) *********************************************************************************************************
(0380) * EXIT ISR
(0381) *
(0382) * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
(0383) * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
(0384) * a new, high-priority task, is ready to run.
(0385) *
(0386) * Arguments : none
(0387) *
(0388) * Returns : none
(0389) *
(0390) * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
(0391) * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
(0392) * end of the ISR.
(0393) * 2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
(0394) *********************************************************************************************************
(0395) */
(0396)
(0397) void OSIntExit (void)
(0398) {
(0399) OS_ENTER_CRITICAL();
_OSIntExit:
03F7 930A ST R16,-Y
03F8 B70F IN R16,P3F
03F9 94F8 BCLR 7
03FA 930F PUSH R16
03FB 9109 LD R16,Y+
(0400) if ((--OSIntNesting | OSLockNesting) == 0) { /* Reschedule only if all ISRs completed & not locked */
03FC 91800150 LDS R24,_OSIntNesting
03FE 5081 SUBI R24,1
03FF 2E28 MOV R2,R24
0400 92200150 STS R2,_OSIntNesting
0402 9040014F LDS R4,_OSLockNesting
0404 2824 OR R2,R4
0405 F009 BEQ 0x0407
0406 C055 RJMP 0x045C
(0401) OSIntExitY = OSUnMapTbl[OSRdyGrp];
0407 E288 LDI R24,0x28
0408 E090 LDI R25,0
0409 9020014C LDS R2,_OSRdyGrp
040B 2433 CLR R3
040C 0E28 ADD R2,R24
040D 1E39 ADC R3,R25
040E 2DE2 MOV R30,R2
040F 2DF3 MOV R31,R3
0410 95C8 LPM
0411 92000110 STS R0,0x110
(0402) OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
0413 E489 LDI R24,0x49
0414 E091 LDI R25,1
0415 2DE0 MOV R30,R0
0416 27FF CLR R31
0417 0FE8 ADD R30,R24
0418 1FF9 ADC R31,R25
0419 8020 LDD R2,0+Z
041A 2433 CLR R3
041B E288 LDI R24,0x28
041C E090 LDI R25,0
041D 0E28 ADD R2,R24
041E 1E39 ADC R3,R25
041F 2DE2 MOV R30,R2
0420 2DF3 MOV R31,R3
0421 95C8 LPM
0422 2C20 MOV R2,R0
0423 2433 CLR R3
0424 90400110 LDS R4,0x110
0426 2455 CLR R5
0427 0C44 LSL R4
0428 1C55 ROL R5
0429 0C44 LSL R4
042A 1C55 ROL R5
042B 0C44 LSL R4
042C 1C55 ROL R5
042D 0C42 ADD R4,R2
042E 1C53 ADC R5,R3
042F 9240014D STS R4,_OSPrioHighRdy
(0403) if (OSPrioHighRdy != OSPrioCur) { /* No context switch if current task is highest ready */
0431 9020014E LDS R2,_OSPrioCur
0433 1442 CP R4,R2
0434 F139 BEQ 0x045C
(0404) OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
0435 E185 LDI R24,0x15
0436 E091 LDI R25,1
0437 2DE4 MOV R30,R4
0438 27FF CLR R31
0439 0FEE LSL R30
043A 1FFF ROL R31
043B 0FE8 ADD R30,R24
043C 1FF9 ADC R31,R25
043D 8020 LDD R2,0+Z
043E 8031 LDD R3,1+Z
043F 92300142 STS R3,_OSTCBHighRdy+1
0441 92200141 STS R2,_OSTCBHighRdy
(0405) OSCtxSwCtr++; /* Keep track of the number of context switches */
0443 E081 LDI R24,1
0444 E090 LDI R25,0
0445 E0A0 LDI R26,0
0446 E0B0 LDI R27,0
0447 9040016B LDS R4,_OSCtxSwCtr+2
0449 9050016C LDS R5,_OSCtxSwCtr+3
044B 90200169 LDS R2,_OSCtxSwCtr
044D 9030016A LDS R3,_OSCtxSwCtr+1
044F 0E28 ADD R2,R24
0450 1E39 ADC R3,R25
0451 1E4A ADC R4,R26
0452 1E5B ADC R5,R27
0453 9230016A STS R3,_OSCtxSwCtr+1
0455 92200169 STS R2,_OSCtxSwCtr
0457 9250016C STS R5,_OSCtxSwCtr+3
0459 9240016B STS R4,_OSCtxSwCtr+2
(0406) OSIntCtxSw(); /* Perform interrupt level context switch */
045B D729 RCALL _OSIntCtxSw
(0407) }
(0408) }
(0409) OS_EXIT_CRITICAL();
045C 930A ST R16,-Y
045D 910F POP R16
045E BF0F OUT P3F,R16
045F 9109 LD R16,Y+
(0410) }
0460 9508 RET
(0411)
(0412) void OSIntExit2 (void)
(0413) {
(0414) // OS_ENTER_CRITICAL();
(0415) if ((--OSIntNesting | OSLockNesting) == 0) { /* Reschedule only if all ISRs completed & not locked */
_OSIntExit2:
0461 91800150 LDS R24,_OSIntNesting
0463 5081 SUBI R24,1
0464 2E28 MOV R2,R24
0465 92200150 STS R2,_OSIntNesting
0467 9040014F LDS R4,_OSLockNesting
0469 2824 OR R2,R4
046A F009 BEQ 0x046C
046B C055 RJMP 0x04C1
(0416) OSIntExitY = OSUnMapTbl[OSRdyGrp];
046C E288 LDI R24,0x28
046D E090 LDI R25,0
046E 9020014C LDS R2,_OSRdyGrp
0470 2433 CLR R3
0471 0E28 ADD R2,R24
0472 1E39 ADC R3,R25
0473 2DE2 MOV R30,R2
0474 2DF3 MOV R31,R3
0475 95C8 LPM
0476 92000110 STS R0,0x110
(0417) OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
0478 E489 LDI R24,0x49
0479 E091 LDI R25,1
047A 2DE0 MOV R30,R0
047B 27FF CLR R31
047C 0FE8 ADD R30,R24
047D 1FF9 ADC R31,R25
047E 8020 LDD R2,0+Z
047F 2433 CLR R3
0480 E288 LDI R24,0x28
0481 E090 LDI R25,0
0482 0E28 ADD R2,R24
0483 1E39 ADC R3,R25
0484 2DE2 MOV R30,R2
0485 2DF3 MOV R31,R3
0486 95C8 LPM
0487 2C20 MOV R2,R0
0488 2433 CLR R3
0489 90400110 LDS R4,0x110
048B 2455 CLR R5
048C 0C44 LSL R4
048D 1C55 ROL R5
048E 0C44 LSL R4
048F 1C55 ROL R5
0490 0C44 LSL R4
0491 1C55 ROL R5
0492 0C42 ADD R4,R2
0493 1C53 ADC R5,R3
0494 9240014D STS R4,_OSPrioHighRdy
(0418) if (OSPrioHighRdy != OSPrioCur) { /* No context switch if current task is highest ready */
0496 9020014E LDS R2,_OSPrioCur
0498 1442 CP R4,R2
0499 F139 BEQ 0x04C1
(0419) OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy];
049A E185 LDI R24,0x15
049B E091 LDI R25,1
049C 2DE4 MOV R30,R4
049D 27FF CLR R31
049E 0FEE LSL R30
049F 1FFF ROL R31
04A0 0FE8 ADD R30,R24
04A1 1FF9 ADC R31,R25
04A2 8020 LDD R2,0+Z
04A3 8031 LDD R3,1+Z
04A4 92300142 STS R3,_OSTCBHighRdy+1
04A6 92200141 STS R2,_OSTCBHighRdy
(0420) OSCtxSwCtr++; /* Keep track of the number of context switches */
04A8 E081 LDI R24,1
04A9 E090
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -