📄 tasks.lst
字号:
541 {
542 /* Pass the TCB out - in an anonymous way. The calling function/
543 task can use this as a handle to delete the task later if
544 required.*/
545 *pxCreatedTask = ( xTaskHandle ) pxNewTCB;
\ 0000F4 86440000 MOV.W R4, 0(R6)
546 }
547
548 if( xSchedulerRunning != pdFALSE )
\ ??xTaskCreate_7:
\ 0000F8 8293.... CMP.W #0x0, &xSchedulerRunning
\ 0000FC 0724 JEQ ??xTaskCreate_6
549 {
550 /* If the created task is of a higher priority than the current task
551 then it should run now. */
552 if( pxCurrentTCB->uxPriority < uxPriority )
\ 0000FE 1F42.... MOV.W &pxCurrentTCB, R15
\ 000102 8F991600 CMP.W R9, 0x16(R15)
\ 000106 022C JC ??xTaskCreate_6
553 {
554 taskYIELD();
\ 000108 B012.... CALL #vPortYield
555 }
556 }
557 }
558
559 return xReturn;
\ ??xTaskCreate_6:
\ 00010C 0C47 MOV.W R7, R12
\ 00010E 2153 ADD.W #0x2, SP
\ 000110 3040.... BR #?Epilogue8
560 }
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
\ ??uxTaskNumber:
\ 000000 DS8 2
561 /*-----------------------------------------------------------*/
562
563 #if ( INCLUDE_vTaskDelete == 1 )
564
\ In segment CODE, align 2
565 void vTaskDelete( xTaskHandle pxTaskToDelete )
\ vTaskDelete:
566 {
\ 000000 0A12 PUSH.W R10
\ 000002 0B12 PUSH.W R11
\ 000004 0A4C MOV.W R12, R10
567 tskTCB *pxTCB;
568
569 taskENTER_CRITICAL();
\ 000006 32C2 DINT
\ 000008 0343 NOP
\ 00000A 9253.... ADD.W #0x1, &usCriticalNesting
570 {
571 /* If null is passed in here then we are deleting ourselves. */
572 pxTCB = prvGetTCBFromHandle( pxTaskToDelete );
\ 00000E 0A93 CMP.W #0x0, R10
\ 000010 0320 JNE ??vTaskDelete_0
\ 000012 1B42.... MOV.W &pxCurrentTCB, R11
\ 000016 013C JMP ??vTaskDelete_1
\ ??vTaskDelete_0:
\ 000018 0B4A MOV.W R10, R11
573
574 /* Remove task from the ready list and place in the termination list.
575 This will stop the task from be scheduled. The idle task will check
576 the termination list and free up any memory allocated by the
577 scheduler for the TCB and stack. */
578 vListRemove( &( pxTCB->xGenericListItem ) );
\ ??vTaskDelete_1:
\ 00001A 0C4B MOV.W R11, R12
\ 00001C 2C53 ADD.W #0x2, R12
\ 00001E B012.... CALL #vListRemove
579
580 /* Is the task waiting on an event also? */
581 if( pxTCB->xEventListItem.pvContainer )
\ 000022 8B931400 CMP.W #0x0, 0x14(R11)
\ 000026 0524 JEQ ??vTaskDelete_2
582 {
583 vListRemove( &( pxTCB->xEventListItem ) );
\ 000028 0C4B MOV.W R11, R12
\ 00002A 3C500C00 ADD.W #0xc, R12
\ 00002E B012.... CALL #vListRemove
584 }
585
586 vListInsertEnd( ( xList * ) &xTasksWaitingTermination, &( pxTCB->xGenericListItem ) );
\ ??vTaskDelete_2:
\ 000032 0E4B MOV.W R11, R14
\ 000034 2E53 ADD.W #0x2, R14
\ 000036 3C40.... MOV.W #xTasksWaitingTermination, R12
\ 00003A B012.... CALL #vListInsertEnd
587
588 /* Increment the ucTasksDeleted variable so the idle task knows
589 there is a task that has been deleted and that it should therefore
590 check the xTasksWaitingTermination list. */
591 ++uxTasksDeleted;
\ 00003E 9253.... ADD.W #0x1, &uxTasksDeleted
592 }
593 taskEXIT_CRITICAL();
\ 000042 8293.... CMP.W #0x0, &usCriticalNesting
\ 000046 0624 JEQ ??vTaskDelete_3
\ 000048 B253.... ADD.W #0xffff, &usCriticalNesting
\ 00004C 8293.... CMP.W #0x0, &usCriticalNesting
\ 000050 0120 JNE ??vTaskDelete_3
\ 000052 32D2 EINT
594
595 /* Force a reschedule if we have just deleted the current task. */
596 if( ( void * ) pxTaskToDelete == NULL )
\ ??vTaskDelete_3:
\ 000054 0A93 CMP.W #0x0, R10
\ 000056 0220 JNE ??vTaskDelete_4
597 {
598 taskYIELD();
\ 000058 B012.... CALL #vPortYield
599 }
600 }
\ ??vTaskDelete_4:
\ 00005C 3B41 POP.W R11
\ 00005E 3A41 POP.W R10
\ 000060 3041 RET
601
602 #endif
603
604
605
606
607
608
609 /*-----------------------------------------------------------
610 * TASK CONTROL API documented in task.h
611 *----------------------------------------------------------*/
612
613 #if ( INCLUDE_vTaskDelayUntil == 1 )
614
\ In segment CODE, align 2
615 void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement )
\ vTaskDelayUntil:
616 {
\ 000000 0A12 PUSH.W R10
\ 000002 0B12 PUSH.W R11
\ 000004 0812 PUSH.W R8
\ 000006 0912 PUSH.W R9
\ 000008 0612 PUSH.W R6
\ 00000A 0A4C MOV.W R12, R10
\ 00000C 0B4E MOV.W R14, R11
617 portTickType xTimeToWake;
618 portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE;
\ 00000E 0643 MOV.W #0x0, R6
619
620 vTaskSuspendAll();
\ 000010 B012.... CALL #vTaskSuspendAll
621 {
622 /* Generate the tick time at which the task wants to wake. */
623 xTimeToWake = *pxPreviousWakeTime + xTimeIncrement;
\ 000014 0F4B MOV.W R11, R15
\ 000016 2F5A ADD.W @R10, R15
\ 000018 084F MOV.W R15, R8
624
625 if( xTickCount < *pxPreviousWakeTime )
\ 00001A A29A.... CMP.W @R10, &xTickCount
\ 00001E 072C JC ??vTaskDelayUntil_0
626 {
627 /* The tick count has overflowed since this function was
628 lasted called. In this case the only time we should ever
629 actually delay is if the wake time has also overflowed,
630 and the wake time is greater than the tick time. When this
631 is the case it is as if neither time had overflowed. */
632 if( ( xTimeToWake < *pxPreviousWakeTime ) && ( xTimeToWake > xTickCount ) )
\ 000020 289A CMP.W @R10, R8
\ 000022 0B2C JC ??vTaskDelayUntil_1
\ 000024 8298.... CMP.W R8, &xTickCount
\ 000028 082C JC ??vTaskDelayUntil_1
633 {
634 xShouldDelay = pdTRUE;
\ 00002A 1643 MOV.W #0x1, R6
\ 00002C 063C JMP ??vTaskDelayUntil_1
635 }
636 }
637 else
638 {
639 /* The tick time has not overflowed. In this case we will
640 delay if either the wake time has overflowed, and/or the
641 tick time is less than the wake time. */
642 if( ( xTimeToWake < *pxPreviousWakeTime ) || ( xTimeToWake > xTickCount ) )
\ ??vTaskDelayUntil_0:
\ 00002E 289A CMP.W @R10, R8
\ 000030 0328 JNC ??vTaskDelayUntil_2
\ 000032 8298.... CMP.W R8, &xTickCount
\ 000036 012C JC ??vTaskDelayUntil_1
643 {
644 xShouldDelay = pdTRUE;
\ ??vTaskDelayUntil_2:
\ 000038 1643 MOV.W #0x1, R6
645 }
646 }
647
648 /* Update the wake time ready for the next call. */
649 *pxPreviousWakeTime = xTimeToWake;
\ ??vTaskDelayUntil_1:
\ 00003A 8A480000 MOV.W R8, 0(R10)
650
651 if( xShouldDelay )
\ 00003E 0693 CMP.W #0x0, R6
\ 000040 1B24 JEQ ??vTaskDelayUntil_3
652 {
653 /* We must remove ourselves from the ready list before adding
654 ourselves to the blocked list as the same list item is used for
655 both lists. */
656 vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
\ 000042 1C42.... MOV.W &pxCurrentTCB, R12
\ 000046 2C53 ADD.W #0x2, R12
\ 000048 B012.... CALL #vListRemove
657
658 /* The list item will be inserted in wake time order. */
659 listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
\ 00004C 1F42.... MOV.W &pxCurrentTCB, R15
\ 000050 8F480200 MOV.W R8, 0x2(R15)
660
661 if( xTimeToWake < xTickCount )
\ 000054 1892.... CMP.W &xTickCount, R8
\ 000058 082C JC ??vTaskDelayUntil_4
662 {
663 /* Wake time has overflowed. Place this item in the
664 overflow list. */
665 vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
^
Warning[Pa082]: undefined behavior: the order of volatile accesses is
undefined in this statement
\ 00005A 1E42.... MOV.W &pxCurrentTCB, R14
\ 00005E 2E53 ADD.W #0x2, R14
\ 000060 1C42.... MOV.W &pxOverflowDelayedTaskList, R12
\ 000064 B012.... CALL #vListInsert
\ 000068 073C JMP ??vTaskDelayUntil_3
666 }
667 else
668 {
669 /* The wake time has not overflowed, so we can use the
670 current block list. */
671 vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
^
Warning[Pa082]: undefined behavior: the order of volatile accesses is
undefined in this statement
\ ??vTaskDelayUntil_4:
\ 00006A 1E42.... MOV.W &pxCurrentTCB, R14
\ 00006E 2E53 ADD.W #0x2, R14
\ 000070 1C42.... MOV.W &pxDelayedTaskList, R12
\ 000074 B012.... CALL #vListInsert
672 }
673 }
674 }
675 xAlreadyYielded = xTaskResumeAll();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -