📄 tasks.s43
字号:
// 591 ++uxTasksDeleted;
ADD.W #0x1, &uxTasksDeleted
// 592 }
// 593 taskEXIT_CRITICAL();
CMP.W #0x0, &usCriticalNesting
JEQ ??vTaskDelete_3
ADD.W #0xffff, &usCriticalNesting
CMP.W #0x0, &usCriticalNesting
JNE ??vTaskDelete_3
EINT
// 594
// 595 /* Force a reschedule if we have just deleted the current task. */
// 596 if( ( void * ) pxTaskToDelete == NULL )
??vTaskDelete_3:
CMP.W #0x0, R10
JNE ??vTaskDelete_4
// 597 {
// 598 taskYIELD();
CALL #vPortYield
// 599 }
// 600 }
??vTaskDelete_4:
POP.W R11
CFI R11 SameValue
CFI CFA SP+4
POP.W R10
CFI R10 SameValue
CFI CFA SP+2
RET
CFI EndBlock cfiBlock1
// 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
RSEG CODE:CODE:REORDER:NOROOT(1)
// 615 void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement )
vTaskDelayUntil:
CFI Block cfiBlock2 Using cfiCommon0
CFI Function vTaskDelayUntil
// 616 {
FUNCALL vTaskDelayUntil, vTaskSuspendAll
LOCFRAME CSTACK, 12, STACK
FUNCALL vTaskDelayUntil, vListRemove
LOCFRAME CSTACK, 12, STACK
FUNCALL vTaskDelayUntil, vListInsert
LOCFRAME CSTACK, 12, STACK
FUNCALL vTaskDelayUntil, vListInsert
LOCFRAME CSTACK, 12, STACK
FUNCALL vTaskDelayUntil, xTaskResumeAll
LOCFRAME CSTACK, 12, STACK
FUNCALL vTaskDelayUntil, vPortYield
LOCFRAME CSTACK, 12, 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
PUSH.W R9
CFI R9 Frame(CFA, -10)
CFI CFA SP+10
PUSH.W R6
CFI R6 Frame(CFA, -12)
CFI CFA SP+12
MOV.W R12, R10
MOV.W R14, R11
// 617 portTickType xTimeToWake;
// 618 portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE;
MOV.W #0x0, R6
// 619
// 620 vTaskSuspendAll();
CALL #vTaskSuspendAll
// 621 {
// 622 /* Generate the tick time at which the task wants to wake. */
// 623 xTimeToWake = *pxPreviousWakeTime + xTimeIncrement;
MOV.W R11, R15
ADD.W @R10, R15
MOV.W R15, R8
// 624
// 625 if( xTickCount < *pxPreviousWakeTime )
CMP.W @R10, &xTickCount
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 ) )
CMP.W @R10, R8
JC ??vTaskDelayUntil_1
CMP.W R8, &xTickCount
JC ??vTaskDelayUntil_1
// 633 {
// 634 xShouldDelay = pdTRUE;
MOV.W #0x1, R6
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:
CMP.W @R10, R8
JNC ??vTaskDelayUntil_2
CMP.W R8, &xTickCount
JC ??vTaskDelayUntil_1
// 643 {
// 644 xShouldDelay = pdTRUE;
??vTaskDelayUntil_2:
MOV.W #0x1, R6
// 645 }
// 646 }
// 647
// 648 /* Update the wake time ready for the next call. */
// 649 *pxPreviousWakeTime = xTimeToWake;
??vTaskDelayUntil_1:
MOV.W R8, 0(R10)
// 650
// 651 if( xShouldDelay )
CMP.W #0x0, R6
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 ) );
MOV.W &pxCurrentTCB, R12
ADD.W #0x2, R12
CALL #vListRemove
// 657
// 658 /* The list item will be inserted in wake time order. */
// 659 listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
MOV.W &pxCurrentTCB, R15
MOV.W R8, 0x2(R15)
// 660
// 661 if( xTimeToWake < xTickCount )
CMP.W &xTickCount, R8
JC ??vTaskDelayUntil_4
// 662 {
// 663 /* Wake time has overflowed. Place this item in the
// 664 overflow list. */
// 665 vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
MOV.W &pxCurrentTCB, R14
ADD.W #0x2, R14
MOV.W &pxOverflowDelayedTaskList, R12
CALL #vListInsert
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 ) );
??vTaskDelayUntil_4:
MOV.W &pxCurrentTCB, R14
ADD.W #0x2, R14
MOV.W &pxDelayedTaskList, R12
CALL #vListInsert
// 672 }
// 673 }
// 674 }
// 675 xAlreadyYielded = xTaskResumeAll();
??vTaskDelayUntil_3:
CALL #xTaskResumeAll
MOV.W R12, R9
// 676
// 677 /* Force a reschedule if xTaskResumeAll has not already done so, we may
// 678 have put ourselves to sleep. */
// 679 if( !xAlreadyYielded )
CMP.W #0x0, R9
JNE ??vTaskDelayUntil_5
// 680 {
// 681 taskYIELD();
CALL #vPortYield
// 682 }
// 683 }
??vTaskDelayUntil_5:
BR #?Epilogue5
CFI EndBlock cfiBlock2
// 684
// 685 #endif
// 686 /*-----------------------------------------------------------*/
// 687
// 688 #if ( INCLUDE_vTaskDelay == 1 )
// 689
RSEG CODE:CODE:REORDER:NOROOT(1)
// 690 void vTaskDelay( portTickType xTicksToDelay )
vTaskDelay:
CFI Block cfiBlock3 Using cfiCommon0
CFI Function vTaskDelay
// 691 {
FUNCALL vTaskDelay, vTaskSuspendAll
LOCFRAME CSTACK, 8, STACK
FUNCALL vTaskDelay, vListRemove
LOCFRAME CSTACK, 8, STACK
FUNCALL vTaskDelay, vListInsert
LOCFRAME CSTACK, 8, STACK
FUNCALL vTaskDelay, vListInsert
LOCFRAME CSTACK, 8, STACK
FUNCALL vTaskDelay, xTaskResumeAll
LOCFRAME CSTACK, 8, STACK
FUNCALL vTaskDelay, vPortYield
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
// 692 portTickType xTimeToWake;
// 693 signed portBASE_TYPE xAlreadyYielded = pdFALSE;
MOV.W #0x0, R8
// 694
// 695 /* A delay time of zero just forces a reschedule. */
// 696 if( xTicksToDelay > ( portTickType ) 0 )
CMP.W #0x0, R10
JEQ ??vTaskDelay_0
// 697 {
// 698 vTaskSuspendAll();
CALL #vTaskSuspendAll
// 699 {
// 700 /* A task that is removed from the event list while the
// 701 scheduler is suspended will not get placed in the ready
// 702 list or removed from the blocked list until the scheduler
// 703 is resumed.
// 704
// 705 This task cannot be in an event list as it is the currently
// 706 executing task. */
// 707
// 708 /* Calculate the time to wake - this may overflow but this is
// 709 not a problem. */
// 710 xTimeToWake = xTickCount + xTicksToDelay;
MOV.W R10, R15
ADD.W &xTickCount, R15
MOV.W R15, R11
// 711
// 712 /* We must remove ourselves from the ready list before adding
// 713 ourselves to the blocked list as the same list item is used for
// 714 both lists. */
// 715 vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
MOV.W &pxCurrentTCB, R12
ADD.W #0x2, R12
CALL #vListRemove
// 716
// 717 /* The list item will be inserted in wake time order. */
// 718 listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
MOV.W &pxCurrentTCB, R15
MOV.W R11, 0x2(R15)
// 719
// 720 if( xTimeToWake < xTickCount )
CMP.W &xTickCount, R11
JC ??vTaskDelay_1
// 721 {
// 722 /* Wake time has overflowed. Place this item in the
// 723 overflow list. */
// 724 vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
MOV.W &pxCurrentTCB, R14
ADD.W #0x2, R14
MOV.W &pxOverflowDelayedTaskList, R12
CALL #vListInsert
JMP ??vTaskDelay_2
// 725 }
// 726 else
// 727 {
// 728 /* The wake time has not overflowed, so we can use the
// 729 current block list. */
// 730 vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
??vTaskDelay_1:
MOV.W &pxCurrentTCB, R14
ADD.W #0x2, R14
MOV.W &pxDelayedTaskList, R12
CALL #vListInsert
// 731 }
// 732 }
// 733 xAlreadyYielded = xTaskResumeAll();
??vTaskDelay_2:
CALL #xTaskResumeAll
MOV.W R12, R8
// 734 }
// 735
// 736 /* Force a reschedule if xTaskResumeAll has not already done so, we may
// 737 have put ourselves to sleep. */
// 738 if( !xAlreadyYielded )
??vTaskDelay_0:
CMP.W #0x0, R8
JNE ??vTaskDelay_3
// 739 {
// 740 taskYIELD();
CALL #vPortYield
// 741 }
// 742 }
??vTaskDelay_3:
BR #?Epilogue3
CFI EndBlock cfiBlock3
// 743
// 744 #endif
// 745 /*-----------------------------------------------------------*/
// 746
// 747 #if ( INCLUDE_uxTaskPriorityGet == 1 )
// 748
RSEG CODE:CODE:REORDER:NOROOT(1)
// 749 unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask )
uxTaskPriorityGet:
CFI Block cfiBlock4 Using cfiCommon0
CFI Function uxTaskPriorityGet
// 750 {
MOV.W R12, R15
// 751 tskTCB *pxTCB;
// 752 unsigned portBASE_TYPE uxReturn;
// 753
// 754 taskENTER_CRITICAL();
DINT
NOP
ADD.W #0x1, &usCriticalNesting
// 755 {
// 756 /* If null is passed in here then we are changing the
// 757 priority of the calling function. */
// 758 pxTCB = prvGetTCBFromHandle( pxTask );
CMP.W #0x0, R15
JNE ??uxTaskPriorityGet_0
MOV.W &pxCurrentTCB, R14
JMP ??uxTaskPriorityGet_1
??uxTaskPriorityGet_0:
MOV.W R15, R14
// 759 uxReturn = pxTCB->uxPriority;
??uxTaskPriorityGet_1:
MOV.W 0x16(R14), R12
// 760 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -