📄 ucos.s
字号:
(void *)0, /* No args passed to OSTaskStat() */ &OSTaskStatStk[0], /* Set Top-Of-Stack */ OS_STAT_PRIO, /* One higher than the idle task */ OS_TASK_STAT_ID, &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],/* Set Bottom-Of-Stack */ OS_TASK_STAT_STK_SIZE, (void *)0, /* No TCB extension */ OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear */ #endif #else #if OS_STK_GROWTH == 1 OSTaskCreate(OSTaskStat, (void *)0, /* No args passed to OSTaskStat() */ &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1], /* Set Top-Of-Stack */ OS_STAT_PRIO); /* One higher than the idle task */ #else OSTaskCreate(OSTaskStat, (void *)0, /* No args passed to OSTaskStat() */ &OSTaskStatStk[0], /* Set Top-Of-Stack */ OS_STAT_PRIO); /* One higher than the idle task */ #endif #endif#endif} 1000794: e91ba810 ldmdb r11, {r4, r11, sp, pc} 1000798: 01007904 tsteq r0, r4, lsl #18 100079c: 01007074 tsteq r0, r4, ror r0 10007a0: 010070ac tsteq r0, r12, lsr #1 10007a4: 010070fc streqsh r7, [r0, -r12] 10007a8: 01007098 swpeq r7, r8, [r0] 10007ac: 0100709c swpeq r7, r12, [r0] 10007b0: 010070b4 streqh r7, [r0, -r4] 10007b4: 010070b0 streqh r7, [r0, -r0] 10007b8: 01007094 swpeq r7, r4, [r0] 10007bc: 0100706c tsteq r0, r12, rrx 10007c0: 010070a8 tsteq r0, r8, lsr #1 10007c4: 010070a0 tsteq r0, r0, lsr #1 10007c8: 010070a4 tsteq r0, r4, lsr #1 10007cc: 010070c0 tsteq r0, r0, asr #1 10007d0: 010070b8 streqh r7, [r0, -r8] 10007d4: 010070c4 tsteq r0, r4, asr #1 10007d8: 010070c8 tsteq r0, r8, asr #1 10007dc: 010070bc streqh r7, [r0, -r12] 10007e0: 01000af4 streqsh r0, [r0, -r4] 10007e4: 01007070 tsteq r0, r0, ror r0 10007e8: 01007900 tsteq r0, r0, lsl #18010007ec <OSIntEnter>: 10007ec: e1a0c00d mov r12, sp 10007f0: e92dd800 stmdb sp!, {r11, r12, lr, pc} 10007f4: e24cb004 sub r11, r12, #4 ; 0x4/*$PAGE*//*********************************************************************************************************** ENTER ISR** Description: This function is used to notify uC/OS-II that you are about to service an interrupt* service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus* only perform rescheduling at the last nested ISR.** Arguments : none** Returns : none** Notes : 1) Your ISR can directly increment OSIntNesting without calling this function because * OSIntNesting has been declared 'global'. You MUST, however, be sure that the increment* is performed 'indivisibly' by your processor to ensure proper access to this critical* resource.* 2) You MUST still call OSIntExit() even though you increment OSIntNesting directly.* 3) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call* to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the* end of the ISR.**********************************************************************************************************/void OSIntEnter (void){ OS_ENTER_CRITICAL(); 10007f8: ebfffee7 bl 100039c <ARMDisableInt> OSIntNesting++; /* Increment ISR nesting level */ 10007fc: e59f2010 ldr r2, [pc, #10] ; 1000814 <OSIntEnter+0x28> 1000800: e5d23000 ldrb r3, [r2] 1000804: e2833001 add r3, r3, #1 ; 0x1 1000808: e5c23000 strb r3, [r2] OS_EXIT_CRITICAL(); 100080c: ebfffee7 bl 10003b0 <ARMEnableInt> 1000810: e91ba800 ldmdb r11, {r11, sp, pc} 1000814: 01007098 swpeq r7, r8, [r0]01000818 <OSIntExit>: 1000818: e1a0c00d mov r12, sp 100081c: e92dd800 stmdb sp!, {r11, r12, lr, pc} 1000820: e24cb004 sub r11, r12, #4 ; 0x4}/*$PAGE*//*********************************************************************************************************** EXIT ISR** Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether* a new, high-priority task, is ready to run.** Arguments : none** Returns : none** Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call* to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the* end of the ISR.* 2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())**********************************************************************************************************/void OSIntExit (void){ OS_ENTER_CRITICAL(); 1000824: ebfffedc bl 100039c <ARMDisableInt> if ((--OSIntNesting | OSLockNesting) == 0) { /* Reschedule only if all ISRs completed & not locked */ 1000828: e59f0094 ldr r0, [pc, #94] ; 10008c4 <OSIntExit+0xac> 100082c: e59f1094 ldr r1, [pc, #94] ; 10008c8 <OSIntExit+0xb0> 1000830: e5d02000 ldrb r2, [r0] 1000834: e5d13000 ldrb r3, [r1] 1000838: e2422001 sub r2, r2, #1 ; 0x1 100083c: e1823003 orr r3, r2, r3 1000840: e31300ff tst r3, #255 ; 0xff 1000844: e5c02000 strb r2, [r0] 1000848: 1a00001b bne 10008bc <OSIntExit+0xa4> OSIntExitY = OSUnMapTbl[OSRdyGrp]; 100084c: e59f3078 ldr r3, [pc, #78] ; 10008cc <OSIntExit+0xb4> 1000850: e59fe078 ldr lr, [pc, #78] ; 10008d0 <OSIntExit+0xb8> 1000854: e59f1078 ldr r1, [pc, #78] ; 10008d4 <OSIntExit+0xbc> OSPrioHighRdy = (INT8U)((OSIntExitY << 3) + OSUnMapTbl[OSRdyTbl[OSIntExitY]]); 1000858: e59f0078 ldr r0, [pc, #78] ; 10008d8 <OSIntExit+0xc0> 100085c: e5d32000 ldrb r2, [r3] 1000860: e7dec002 ldrb r12, [lr, r2] 1000864: e5c1c000 strb r12, [r1] 1000868: e5d13000 ldrb r3, [r1] 100086c: e7d02003 ldrb r2, [r0, r3] if (OSPrioHighRdy != OSPrioCur) { /* No context switch if current task is highest ready */ 1000870: e59f3064 ldr r3, [pc, #64] ; 10008dc <OSIntExit+0xc4> 1000874: e7de1002 ldrb r1, [lr, r2] 1000878: e5d30000 ldrb r0, [r3] 100087c: e59f305c ldr r3, [pc, #5c] ; 10008e0 <OSIntExit+0xc8> 1000880: e081118c add r1, r1, r12, lsl #3 1000884: e20120ff and r2, r1, #255 ; 0xff 1000888: e1520000 cmp r2, r0 100088c: e5c31000 strb r1, [r3] 1000890: 0a000009 beq 10008bc <OSIntExit+0xa4> OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy]; 1000894: e59fe048 ldr lr, [pc, #48] ; 10008e4 <OSIntExit+0xcc> 1000898: e59f0048 ldr r0, [pc, #48] ; 10008e8 <OSIntExit+0xd0> 100089c: e5d32000 ldrb r2, [r3] OSCtxSwCtr++; /* Keep track of the number of context switches */ 10008a0: e59fc044 ldr r12, [pc, #44] ; 10008ec <OSIntExit+0xd4> 10008a4: e7901102 ldr r1, [r0, r2, lsl #2] 10008a8: e59c3000 ldr r3, [r12] 10008ac: e58e1000 str r1, [lr] 10008b0: e2833001 add r3, r3, #1 ; 0x1 10008b4: e58c3000 str r3, [r12] OSIntCtxSw(); /* Perform interrupt level context switch */ 10008b8: ebfffea3 bl 100034c <OSIntCtxSw> } } OS_EXIT_CRITICAL(); 10008bc: ebfffebb bl 10003b0 <ARMEnableInt> 10008c0: e91ba800 ldmdb r11, {r11, sp, pc} 10008c4: 01007098 swpeq r7, r8, [r0] 10008c8: 0100709c swpeq r7, r12, [r0] 10008cc: 010070a8 tsteq r0, r8, lsr #1 10008d0: 0100145c tsteq r0, r12, asr r4 10008d4: 01007100 tsteq r0, r0, lsl #2 10008d8: 010070ac tsteq r0, r12, lsr #1 10008dc: 010070a0 tsteq r0, r0, lsr #1 10008e0: 010070a4 tsteq r0, r4, lsr #1 10008e4: 010070c0 tsteq r0, r0, asr #1 10008e8: 010070c8 tsteq r0, r8, asr #1 10008ec: 0100706c tsteq r0, r12, rrx010008f0 <OSSched>: 10008f0: e1a0c00d mov r12, sp 10008f4: e92dd800 stmdb sp!, {r11, r12, lr, pc} 10008f8: e24cb004 sub r11, r12, #4 ; 0x4}/*$PAGE*//*********************************************************************************************************** SCHEDULER** Description: This function is called by other uC/OS-II services to determine whether a new, high* priority task has been made ready to run. This function is invoked by TASK level code* and is not used to reschedule tasks from ISRs (see OSIntExit() for ISR rescheduling).** Arguments : none** Returns : none** Notes : 1) This function is INTERNAL to uC/OS-II and your application should not call it.* 2) Rescheduling is prevented when the scheduler is locked (see OSSchedLock())**********************************************************************************************************/void OSSched (void){ INT8U y; OS_ENTER_CRITICAL(); 10008fc: ebfffea6 bl 100039c <ARMDisableInt> if ((OSLockNesting | OSIntNesting) == 0) { /* Task scheduling must be enabled and not ISR level */ 1000900: e59f207c ldr r2, [pc, #7c] ; 1000984 <OSSched+0x94> 1000904: e59f107c ldr r1, [pc, #7c] ; 1000988 <OSSched+0x98> 1000908: e5d20000 ldrb r0, [r2] 100090c: e5d13000 ldrb r3, [r1] 1000910: e1900003 orrs r0, r0, r3 1000914: 1a000018 bne 100097c <OSSched+0x8c> y = OSUnMapTbl[OSRdyGrp]; /* Get pointer to highest priority task ready to run */ 1000918: e59f206c ldr r2, [pc, #6c] ; 100098c <OSSched+0x9c> 100091c: e59f006c ldr r0, [pc, #6c] ; 1000990 <OSSched+0xa0> 1000920: e5d23000 ldrb r3, [r2] OSPrioHighRdy = (INT8U)((y << 3) + OSUnMapTbl[OSRdyTbl[y]]); 1000924: e59f2068 ldr r2, [pc, #68] ; 1000994 <OSSched+0xa4> 1000928: e7d0c003 ldrb r12, [r0, r3] 100092c: e7d2300c ldrb r3, [r2, r12] if (OSPrioHighRdy != OSPrioCur) { /* No context switch if current task is highest ready */ 1000930: e59f2060 ldr r2, [pc, #60] ; 1000998 <OSSched+0xa8> 1000934: e7d01003 ldrb r1, [r0, r3] 1000938: e5d20000 ldrb r0, [r2] 100093c: e59f2058 ldr r2, [pc, #58] ; 100099c <OSSched+0xac> 1000940: e081118c add r1, r1, r12, lsl #3 1000944: e20130ff and r3, r1, #255 ; 0xff 1000948: e1530000 cmp r3, r0 100094c: e5c21000 strb r1, [r2] 1000950: 0a000009 beq 100097c <OSSched+0x8c> OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy]; 1000954: e59fe044 ldr lr, [pc, #44] ; 10009a0 <OSSched+0xb0> 1000958: e59f0044 ldr r0, [pc, #44] ; 10009a4 <OSSched+0xb4> 100095c: e5d22000 ldrb r2, [r2] OSCtxSwCtr++; /* Increment context switch counter */ 1000960: e59fc040 ldr r12, [pc, #40] ; 10009a8 <OSSched+0xb8> 1000964: e7901102 ldr r1, [r0, r2, lsl #2] 1000968: e59c3000 ldr r3, [r12] 100096c: e58e1000 str r1, [lr] 1000970: e2833001 add r3, r3, #1 ; 0x1 1000974: e58c3000 str r3, [r12] OS_TASK_SW(); /* Perform a context switch */ 1000978: ebfffe5c bl 10002f0 <OSCtxSw> } } OS_EXIT_CRITICAL(); 100097c: ebfffe8b bl 10003b0 <ARMEnableInt>} 1000980: e91ba800 ldmdb r11, {r11, sp, pc} 1000984: 0100709c swpeq r7, r12, [r0] 1000988: 01007098 swpeq r7, r8, [r0] 100098c: 010070a8 tsteq r0, r8, lsr #1 1000990: 0100145c tsteq r0, r12, asr r4 1000994: 010070ac tsteq r0, r12, lsr #1 1000998: 010070a0 tsteq r0, r0, lsr #1 100099c: 010070a4 tsteq r0, r4, lsr #1 10009a0: 010070c0 tsteq r0, r0, asr #1 10009a4: 010070c8 tsteq r0, r8, asr #1 10009a8: 0100706c tsteq r0, r12, rrx010009ac <OSSchedLock>: 10009ac: e1a0c00d mov r12, sp 10009b0: e92dd800 stmdb sp!, {r11, r12, lr, pc}/*$PAGE*//*********************************************************************************************************** PREVENT SCHEDULING** Description: This function is used to prevent rescheduling to take place. This allows your application* to prevent context switches until you are ready to permit context switching.** Arguments : none** Returns : none** Notes : 1) You MUST invoke OSSchedLock() and OSSchedUnlock() in pair. In other words, for every * call to OSSchedLock() you MUST have a call to OSSchedUnlock().**********************************************************************************************************/void OSSchedLock (void){ if (OSRunning == TRUE) { /* Make sure multitasking is running */ 10009b4: e59f3028 ldr r3, [pc, #28] ; 10009e4 <OSSchedLock+0x38> 10009b8: e5d32000 ldrb r2, [r3] 10009bc: e24cb004 sub r11, r12, #4 ; 0x4 10009c0: e3520001 cmp r2, #1 ; 0x1 10009c4: 191ba800 ldmnedb r11, {r11, sp, pc} OS_ENTER_CRITICAL(); 10009c8: ebfffe73 bl 100039c <ARMDisableInt> OSLockNesting++; /* Increment lock nesting level */ 10009cc: e59f2014 ldr r2, [pc, #14] ; 10009e8 <OSSchedLock+0x3c> 10009d0: e5d23000 ldrb r3, [r2] 10009d4: e2833001 add r3, r3, #1 ; 0x1 10009d8: e5c23000 strb r3, [r2] OS_EXIT_CRITICAL(); 10009dc: ebfffe73 bl 10003b0 <ARMEnableInt> } 10009e0: e91ba800 ldmdb r11, {r11, sp, pc} 10009e4: 010070b0 streqh r7, [r0, -r0] 10009e8: 0100709c swpeq r7, r12, [r0]010009ec <OSSchedUnlock>: 10009ec: e1a0c00d mov r12, sp 10009f0: e92dd800 stmdb sp!, {r11, r12, lr, pc}}/*$PAGE*//*********************************************************************************************************** ENABLE SCHEDULING** Description: This function is used to re-allow rescheduling. ** Arguments : none** Returns : none*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -