📄 croutine.s43
字号:
// 253
// 254 /* Is the co-routine waiting on an event also? */
// 255 if( pxCRCB->xEventListItem.pvContainer )
CMP.W #0x0, 0x14(R10)
JEQ ??prvCheckDelayedList_5
// 256 {
// 257 vListRemove( &( pxCRCB->xEventListItem ) );
MOV.W R10, R12
ADD.W #0xc, R12
CALL #vListRemove
// 258 }
// 259 }
// 260 portENABLE_INTERRUPTS();
??prvCheckDelayedList_5:
EINT
// 261
// 262 prvAddCoRoutineToReadyQueue( pxCRCB );
CMP.W 0x16(R10), &uxTopCoRoutineReadyPriority
JC ??prvCheckDelayedList_6
MOV.W 0x16(R10), &uxTopCoRoutineReadyPriority
??prvCheckDelayedList_6:
MOV.W R10, R14
ADD.W #0x2, R14
MOV.W #pxReadyCoRoutineLists, R12
MOV.W 0x16(R10), R15
RLA.W R15
MOV.W R15, R13
RLA.W R15
RLA.W R15
ADD.W R13, R15
ADD.W R15, R12
CALL #vListInsertEnd
JMP ??prvCheckDelayedList_1
// 263 }
// 264 }
// 265
// 266 xLastTickCount = xCoRoutineTickCount;
??prvCheckDelayedList_2:
MOV.W &xCoRoutineTickCount, &??xLastTickCount
// 267 }
POP.W R10
CFI R10 SameValue
CFI CFA SP+2
RET
CFI EndBlock cfiBlock3
RSEG DATA16_Z:DATA:SORT:NOROOT(1)
REQUIRE ?cstart_init_zero
??xLastTickCount:
DS8 2
RSEG DATA16_Z:DATA:SORT:NOROOT(1)
REQUIRE ?cstart_init_zero
??xPassedTicks:
DS8 2
// 268 /*-----------------------------------------------------------*/
// 269
RSEG CODE:CODE:REORDER:NOROOT(1)
// 270 void vCoRoutineSchedule( void )
vCoRoutineSchedule:
CFI Block cfiBlock4 Using cfiCommon0
CFI Function vCoRoutineSchedule
// 271 {
// 272 /* See if any co-routines readied by events need moving to the ready lists. */
// 273 prvCheckPendingReadyList();
FUNCALL vCoRoutineSchedule, prvCheckPendingReadyList
LOCFRAME CSTACK, 2, STACK
FUNCALL vCoRoutineSchedule, prvCheckDelayedList
LOCFRAME CSTACK, 2, STACK
FUNCALL vCoRoutineSchedule
LOCFRAME CSTACK, 2, STACK
CALL #prvCheckPendingReadyList
// 274
// 275 /* See if any delayed co-routines have timed out. */
// 276 prvCheckDelayedList();
CALL #prvCheckDelayedList
// 277
// 278 /* Find the highest priority queue that contains ready co-routines. */
// 279 while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
??vCoRoutineSchedule_0:
MOV.W &uxTopCoRoutineReadyPriority, R15
RLA.W R15
MOV.W R15, R14
RLA.W R15
RLA.W R15
ADD.W R14, R15
CMP.W #0x0, pxReadyCoRoutineLists(R15)
JNE ??vCoRoutineSchedule_1
// 280 {
// 281 if( uxTopCoRoutineReadyPriority == 0 )
CMP.W #0x0, &uxTopCoRoutineReadyPriority
JEQ ??vCoRoutineSchedule_2
// 282 {
// 283 /* No more co-routines to check. */
// 284 return;
// 285 }
// 286 --uxTopCoRoutineReadyPriority;
ADD.W #0xffff, &uxTopCoRoutineReadyPriority
JMP ??vCoRoutineSchedule_0
// 287 }
// 288
// 289 /* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
// 290 of the same priority get an equal share of the processor time. */
// 291 listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );
??vCoRoutineSchedule_1:
MOV.W &uxTopCoRoutineReadyPriority, R15
RLA.W R15
MOV.W R15, R14
RLA.W R15
RLA.W R15
ADD.W R14, R15
MOV.W pxReadyCoRoutineLists + 2(R15), R15
MOV.W &uxTopCoRoutineReadyPriority, R14
RLA.W R14
MOV.W R14, R13
RLA.W R14
RLA.W R14
ADD.W R13, R14
MOV.W 0x2(R15), pxReadyCoRoutineLists + 2(R14)
MOV.W &uxTopCoRoutineReadyPriority, R15
RLA.W R15
MOV.W R15, R14
RLA.W R15
RLA.W R15
ADD.W R14, R15
MOV.W #pxReadyCoRoutineLists + 4, R14
MOV.W &uxTopCoRoutineReadyPriority, R13
RLA.W R13
MOV.W R13, R12
RLA.W R13
RLA.W R13
ADD.W R12, R13
ADD.W R13, R14
CMP.W R14, pxReadyCoRoutineLists + 2(R15)
JNE ??vCoRoutineSchedule_3
MOV.W &uxTopCoRoutineReadyPriority, R15
RLA.W R15
MOV.W R15, R14
RLA.W R15
RLA.W R15
ADD.W R14, R15
MOV.W pxReadyCoRoutineLists + 2(R15), R15
MOV.W &uxTopCoRoutineReadyPriority, R14
RLA.W R14
MOV.W R14, R13
RLA.W R14
RLA.W R14
ADD.W R13, R14
MOV.W 0x2(R15), pxReadyCoRoutineLists + 2(R14)
??vCoRoutineSchedule_3:
MOV.W &uxTopCoRoutineReadyPriority, R15
RLA.W R15
MOV.W R15, R14
RLA.W R15
RLA.W R15
ADD.W R14, R15
MOV.W pxReadyCoRoutineLists + 2(R15), R15
MOV.W 0x6(R15), &pxCurrentCoRoutine
// 292
// 293 /* Call the co-routine. */
// 294 ( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
MOV.W &pxCurrentCoRoutine, R15
MOV.W 0x18(R15), R14
MOV.W &pxCurrentCoRoutine, R12
MOV.W &pxCurrentCoRoutine, R15
CALL @R15
// 295
// 296 return;
??vCoRoutineSchedule_2:
RET
CFI EndBlock cfiBlock4
// 297 }
// 298 /*-----------------------------------------------------------*/
// 299
RSEG CODE:CODE:REORDER:NOROOT(1)
// 300 static void prvInitialiseCoRoutineLists( void )
prvInitialiseCoRoutineLists:
CFI Block cfiBlock5 Using cfiCommon0
CFI Function prvInitialiseCoRoutineLists
// 301 {
FUNCALL prvInitialiseCoRoutineLists, vListInitialise
LOCFRAME CSTACK, 4, STACK
FUNCALL prvInitialiseCoRoutineLists, vListInitialise
LOCFRAME CSTACK, 4, STACK
FUNCALL prvInitialiseCoRoutineLists, vListInitialise
LOCFRAME CSTACK, 4, STACK
FUNCALL prvInitialiseCoRoutineLists, vListInitialise
LOCFRAME CSTACK, 4, STACK
PUSH.W R10
CFI R10 Frame(CFA, -4)
CFI CFA SP+4
// 302 unsigned portBASE_TYPE uxPriority;
// 303
// 304 for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ )
MOV.W #0x0, R10
??prvInitialiseCoRoutineLists_0:
CMP.W #0x2, R10
JC ??prvInitialiseCoRoutineLists_1
// 305 {
// 306 vListInitialise( ( xList * ) &( pxReadyCoRoutineLists[ uxPriority ] ) );
MOV.W #pxReadyCoRoutineLists, R12
MOV.W R10, R15
RLA.W R15
MOV.W R15, R14
RLA.W R15
RLA.W R15
ADD.W R14, R15
ADD.W R15, R12
CALL #vListInitialise
// 307 }
ADD.W #0x1, R10
JMP ??prvInitialiseCoRoutineLists_0
// 308
// 309 vListInitialise( ( xList * ) &xDelayedCoRoutineList1 );
??prvInitialiseCoRoutineLists_1:
MOV.W #xDelayedCoRoutineList1, R12
CALL #vListInitialise
// 310 vListInitialise( ( xList * ) &xDelayedCoRoutineList2 );
MOV.W #xDelayedCoRoutineList2, R12
CALL #vListInitialise
// 311 vListInitialise( ( xList * ) &xPendingReadyList );
MOV.W #xPendingReadyList, R12
CALL #vListInitialise
// 312
// 313 /* Start with pxDelayedCoRoutineList using list1 and the
// 314 pxOverflowDelayedCoRoutineList using list2. */
// 315 pxDelayedCoRoutineList = &xDelayedCoRoutineList1;
MOV.W #xDelayedCoRoutineList1, &pxDelayedCoRoutineList
// 316 pxOverflowDelayedCoRoutineList = &xDelayedCoRoutineList2;
MOV.W #xDelayedCoRoutineList2, &pxOverflowDelayedCoRoutineList
// 317 }
POP.W R10
CFI R10 SameValue
CFI CFA SP+2
RET
CFI EndBlock cfiBlock5
// 318 /*-----------------------------------------------------------*/
// 319
RSEG CODE:CODE:REORDER:NOROOT(1)
// 320 portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList )
xCoRoutineRemoveFromEventList:
CFI Block cfiBlock6 Using cfiCommon0
CFI Function xCoRoutineRemoveFromEventList
// 321 {
FUNCALL xCoRoutineRemoveFromEventList, vListRemove
LOCFRAME CSTACK, 8, STACK
FUNCALL xCoRoutineRemoveFromEventList, vListInsertEnd
LOCFRAME CSTACK, 8, STACK
PUSH.W R10
CFI R10 Frame(CFA, -4)
CFI CFA SP+4
PUSH.W R11
CFI R11 Frame(CFA, -6)
CFI CFA SP+6
PUSH.W R8
CFI R8 Frame(CFA, -8)
CFI CFA SP+8
MOV.W R12, R10
// 322 corCRCB *pxUnblockedCRCB;
// 323 portBASE_TYPE xReturn;
// 324
// 325 /* This function is called from within an interrupt. It can only access
// 326 event lists and the pending ready list. */
// 327 pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
CMP.W #0x0, 0(R10)
JEQ ??xCoRoutineRemoveFromEventList_0
MOV.W 0x6(R10), R15
MOV.W 0x6(R15), R11
JMP ??xCoRoutineRemoveFromEventList_1
??xCoRoutineRemoveFromEventList_0:
MOV.W #0x0, R11
// 328 vListRemove( &( pxUnblockedCRCB->xEventListItem ) );
??xCoRoutineRemoveFromEventList_1:
MOV.W R11, R12
ADD.W #0xc, R12
CALL #vListRemove
// 329 vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxUnblockedCRCB->xEventListItem ) );
MOV.W R11, R14
ADD.W #0xc, R14
MOV.W #xPendingReadyList, R12
CALL #vListInsertEnd
// 330
// 331 if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )
MOV.W &pxCurrentCoRoutine, R15
CMP.W 0x16(R15), 0x16(R11)
JNC ??xCoRoutineRemoveFromEventList_2
// 332 {
// 333 xReturn = pdTRUE;
MOV.W #0x1, R8
JMP ??xCoRoutineRemoveFromEventList_3
// 334 }
// 335 else
// 336 {
// 337 xReturn = pdFALSE;
??xCoRoutineRemoveFromEventList_2:
MOV.W #0x0, R8
// 338 }
// 339
// 340 return xReturn;
??xCoRoutineRemoveFromEventList_3:
MOV.W R8, R12
BR #?Epilogue3
CFI EndBlock cfiBlock6
// 341 }
RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r4:
REQUIRE ?setjmp_r4
REQUIRE ?longjmp_r4
RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r5:
REQUIRE ?setjmp_r5
REQUIRE ?longjmp_r5
END
// 342
//
// 866 bytes in segment CODE
// 64 bytes in segment DATA16_Z
//
// 866 bytes of CODE memory
// 64 bytes of DATA memory
//
//Errors: none
//Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -