📄 os_core.lis
字号:
0184 ; #endif
0184 ;
0184 ; #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
0184 ; OS_FlagInit(); /* Initialize the event flag structures */
0184 ; #endif
0184 ;
0184 ; #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
0184 ; OS_QInit(); /* Initialize the message queue structures */
0184 ; #endif
0184 ;
0184 ; #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
0184 ; OS_MemInit(); /* Initialize the memory manager */
0184 ; #endif
0184 ;
0184 ; /* ------------------------------------- CREATION OF 'IDLE' TASK --------------------------------------- */
0184 ; #if OS_TASK_CREATE_EXT_EN > 0
0184 ; #if OS_STK_GROWTH == 1
0184 ; (void)OSTaskCreateExt(OS_TaskIdle,
0184 ; (void *)0, /* No arguments passed to OS_TaskIdle() */
0184 ; &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack */
0184 ; OS_IDLE_PRIO, /* Lowest priority level */
0184 ; OS_TASK_IDLE_ID,
0184 ; &OSTaskIdleStk[0], /* Set Bottom-Of-Stack */
0184 ; OS_TASK_IDLE_STK_SIZE,
0184 ; (void *)0, /* No TCB extension */
0184 ; OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack */
0184 ; #else
0184 ; (void)OSTaskCreateExt(OS_TaskIdle,
0184 ; (void *)0, /* No arguments passed to OS_TaskIdle() */
0184 ; &OSTaskIdleStk[0], /* Set Top-Of-Stack */
0184 ; OS_IDLE_PRIO, /* Lowest priority level */
0184 ; OS_TASK_IDLE_ID,
0184 ; &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Bottom-Of-Stack */
0184 ; OS_TASK_IDLE_STK_SIZE,
0184 ; (void *)0, /* No TCB extension */
0184 ; OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack */
0184 ; #endif
0184 ; #else
0184 ; #if OS_STK_GROWTH == 1
0184 ; (void)OSTaskCreate(OS_TaskIdle,
0184 84E1 ldi R24,20
0186 8A83 std y+2,R24
0188 80E0 ldi R24,<_OSTaskIdleStk+127
018A 90E0 ldi R25,>_OSTaskIdleStk+127
018C 9983 std y+1,R25
018E 8883 std y+0,R24
0190 2227 clr R18
0192 3327 clr R19
0194 00E0 ldi R16,<PL_OS_TaskIdle
0196 10E0 ldi R17,>PL_OS_TaskIdle
0198 4F92 push R4
019A 5F92 push R5
019C 00D0 rcall _OSTaskCreate
019E 5F90 pop R5
01A0 4F90 pop R4
01A2 .dbline 235
01A2 ; (void *)0,
01A2 ; &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1],
01A2 ; OS_IDLE_PRIO);
01A2 ; #else
01A2 ; (void)OSTaskCreate(OS_TaskIdle,
01A2 ; (void *)0,
01A2 ; &OSTaskIdleStk[0],
01A2 ; OS_IDLE_PRIO);
01A2 ; #endif
01A2 ; #endif
01A2 ;
01A2 ; /* ------------------------------- CREATION OF 'STATISTIC' TASK ---------------------------------- */
01A2 ; #if OS_TASK_STAT_EN > 0
01A2 ; #if OS_TASK_CREATE_EXT_EN > 0
01A2 ; #if OS_STK_GROWTH == 1
01A2 ; (void)OSTaskCreateExt(OS_TaskStat,
01A2 ; (void *)0, /* No args passed to OS_TaskStat()*/
01A2 ; &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Top-Of-Stack */
01A2 ; OS_STAT_PRIO, /* One higher than the idle task */
01A2 ; OS_TASK_STAT_ID,
01A2 ; &OSTaskStatStk[0], /* Set Bottom-Of-Stack */
01A2 ; OS_TASK_STAT_STK_SIZE,
01A2 ; (void *)0, /* No TCB extension */
01A2 ; OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear */
01A2 ; #else
01A2 ; (void)OSTaskCreateExt(OS_TaskStat,
01A2 ; (void *)0, /* No args passed to OS_TaskStat()*/
01A2 ; &OSTaskStatStk[0], /* Set Top-Of-Stack */
01A2 ; OS_STAT_PRIO, /* One higher than the idle task */
01A2 ; OS_TASK_STAT_ID,
01A2 ; &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Bottom-Of-Stack */
01A2 ; OS_TASK_STAT_STK_SIZE,
01A2 ; (void *)0, /* No TCB extension */
01A2 ; OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear */
01A2 ; #endif
01A2 ; #else
01A2 ; #if OS_STK_GROWTH == 1
01A2 ; (void)OSTaskCreate(OS_TaskStat,
01A2 ; (void *)0, /* No args passed to OS_TaskStat()*/
01A2 ; &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Top-Of-Stack */
01A2 ; OS_STAT_PRIO); /* One higher than the idle task */
01A2 ; #else
01A2 ; (void)OSTaskCreate(OS_TaskStat,
01A2 ; (void *)0, /* No args passed to OS_TaskStat()*/
01A2 ; &OSTaskStatStk[0], /* Set Top-Of-Stack */
01A2 ; OS_STAT_PRIO); /* One higher than the idle task */
01A2 ; #endif
01A2 ; #endif
01A2 ; #endif
01A2 ;
01A2 ; #if OS_VERSION >= 204
01A2 ; OSInitHookEnd(); /* Call port specific init. code */
01A2 4F92 push R4
01A4 5F92 push R5
01A6 00D0 rcall _OSInitHookEnd
01A8 5F90 pop R5
01AA 4F90 pop R4
01AC .dbline -2
01AC L3:
01AC 2796 adiw R28,7
01AE 00D0 rcall pop_gset5
01B0 .dbline 0 ; func end
01B0 0895 ret
01B2 .dbsym l prdytbl 5 pc
01B2 .dbsym r pevent2 12 pS[.1]
01B2 .dbsym l ptcb2 3 pS[os_tcb]
01B2 .dbsym r ptcb1 14 pS[os_tcb]
01B2 .dbsym r pevent1 10 pS[.1]
01B2 .dbsym r i 4 i
01B2 .dbend
01B2 .dbfunc e OSIntEnter _OSIntEnter fV
01B2 ; cpu_sr -> R20
.even
01B2 _OSIntEnter::
01B2 00D0 rcall push_gset1
01B4 .dbline -1
01B4 .dbline 263
01B4 ; #endif
01B4 ; }
01B4 ; /*$PAGE*/
01B4 ; /*
01B4 ; *********************************************************************************************************
01B4 ; * ENTER ISR
01B4 ; *
01B4 ; * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
01B4 ; * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
01B4 ; * only perform rescheduling at the last nested ISR.
01B4 ; *
01B4 ; * Arguments : none
01B4 ; *
01B4 ; * Returns : none
01B4 ; *
01B4 ; * Notes : 1) Your ISR can directly increment OSIntNesting without calling this function because
01B4 ; * OSIntNesting has been declared 'global'. You MUST, however, be sure that the increment
01B4 ; * is performed 'indivisibly' by your processor to ensure proper access to this critical
01B4 ; * resource.
01B4 ; * 2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
01B4 ; * 3) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
01B4 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
01B4 ; * end of the ISR.
01B4 ; *********************************************************************************************************
01B4 ; */
01B4 ;
01B4 ; void OSIntEnter (void)
01B4 ; {
01B4 .dbline 269
01B4 ; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
01B4 ; OS_CPU_SR cpu_sr;
01B4 ; #endif
01B4 ;
01B4 ;
01B4 ; OS_ENTER_CRITICAL();
01B4 00D0 rcall _OS_CPU_SR_Save
01B6 402F mov R20,R16
01B8 .dbline 270
01B8 ; if (OSIntNesting < 255) {
01B8 80912401 lds R24,_OSIntNesting
01BC 8F3F cpi R24,255
01BE 18F4 brsh L24
01C0 .dbline 270
01C0 .dbline 271
01C0 ; OSIntNesting++; /* Increment ISR nesting level */
01C0 8F5F subi R24,255 ; addi 1
01C2 80932401 sts _OSIntNesting,R24
01C6 .dbline 272
01C6 ; }
01C6 L24:
01C6 .dbline 273
01C6 ; OS_EXIT_CRITICAL();
01C6 042F mov R16,R20
01C8 00D0 rcall _OS_CPU_SR_Restore
01CA .dbline -2
01CA L23:
01CA 00D0 rcall pop_gset1
01CC .dbline 0 ; func end
01CC 0895 ret
01CE .dbsym r cpu_sr 20 c
01CE .dbend
01CE .dbfunc e OSIntExit _OSIntExit fV
01CE ; cpu_sr -> R10
.even
01CE _OSIntExit::
01CE 00D0 rcall push_gset3
01D0 .dbline -1
01D0 .dbline 296
01D0 ; }
01D0 ; /*$PAGE*/
01D0 ; /*
01D0 ; *********************************************************************************************************
01D0 ; * EXIT ISR
01D0 ; *
01D0 ; * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
01D0 ; * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
01D0 ; * a new, high-priority task, is ready to run.
01D0 ; *
01D0 ; * Arguments : none
01D0 ; *
01D0 ; * Returns : none
01D0 ; *
01D0 ; * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
01D0 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
01D0 ; * end of the ISR.
01D0 ; * 2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())
01D0 ; *********************************************************************************************************
01D0 ; */
01D0 ;
01D0 ; void OSIntExit (void)
01D0 ; {
01D0 .dbline 302
01D0 ; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
01D0 ; OS_CPU_SR cpu_sr;
01D0 ; #endif
01D0 ;
01D0 ;
01D0 ; OS_ENTER_CRITICAL();
01D0 00D0 rcall _OS_CPU_SR_Save
01D2 A02E mov R10,R16
01D4 .dbline 303
01D4 ; if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
01D4 2224 clr R2
01D6 30902401 lds R3,_OSIntNesting
01DA 2314 cp R2,R3
01DC 20F4 brsh L27
01DE .dbline 303
01DE .dbline 304
01DE ; OSIntNesting--;
01DE 832D mov R24,R3
01E0 8150 subi R24,1
01E2 80932401 sts _OSIntNesting,R24
01E6 .dbline 305
01E6 ; }
01E6 L27:
01E6 .dbline 306
01E6 ; if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ... */
01E6 20902401 lds R2,_OSIntNesting
01EA 2220 tst R2
01EC 09F0 breq X0
01EE 54C0 rjmp L29
01F0 X0:
01F0 20902201 lds R2,_OSLockNesting
01F4 2220 tst R2
01F6 09F0 breq X1
01F8 4FC0 rjmp L29
01FA X1:
01FA .dbline 306
01FA .dbline 307
01FA ; OSIntExitY = OSUnMapTbl[OSRdyGrp]; /* ... and not locked. */
01FA 80E0 ldi R24,<_OSUnMapTbl
01FC 90E0 ldi R25,>_OSUnMapTbl
01FE E0911F01 lds R30,_OSRdyGrp
0202 FF27 clr R31
0204 E80F add R30,R24
0206 F91F adc R31,R25
0208 E491 lpm R30,Z
020A E0932301 sts _OSIntExitY,R30
020E .dbline 308
020E ; OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -