📄 queue.s43
字号:
// 475 xReturn = pdPASS;
MOV.W #0x1, R8
ADD.W #0x2, SP
CFI CFA SP+10
JMP ??xQueueReceive_6
// 476 }
// 477 else
// 478 {
// 479 xReturn = pdFAIL;
??xQueueReceive_4:
MOV.W #0x0, R8
// 480 }
// 481 }
// 482 taskEXIT_CRITICAL();
??xQueueReceive_6:
CMP.W #0x0, &usCriticalNesting
JEQ ??xQueueReceive_7
ADD.W #0xffff, &usCriticalNesting
CMP.W #0x0, &usCriticalNesting
JNE ??xQueueReceive_7
EINT
// 483
// 484 /* We no longer require exclusive access to the queue. */
// 485 if( prvUnlockQueue( pxQueue ) )
??xQueueReceive_7:
MOV.W R9, R12
CALL #prvUnlockQueue
CMP.W #0x0, R12
JEQ ??xQueueReceive_8
// 486 {
// 487 if( !xTaskResumeAll() )
CALL #xTaskResumeAll
CMP.W #0x0, R12
JNE ??xQueueReceive_9
// 488 {
// 489 taskYIELD();
CALL #vPortYield
JMP ??xQueueReceive_9
// 490 }
// 491 }
// 492 else
// 493 {
// 494 xTaskResumeAll();
??xQueueReceive_8:
CALL #xTaskResumeAll
// 495 }
// 496
// 497 return xReturn;
??xQueueReceive_9:
MOV.W R8, R12
BR #?Epilogue4
CFI EndBlock cfiBlock3
// 498 }
// 499 /*-----------------------------------------------------------*/
// 500
RSEG CODE:CODE:REORDER:NOROOT(1)
// 501 signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken )
xQueueReceiveFromISR:
CFI Block cfiBlock4 Using cfiCommon0
CFI Function xQueueReceiveFromISR
// 502 {
FUNCALL xQueueReceiveFromISR, memcpy
LOCFRAME CSTACK, 12, STACK
FUNCALL xQueueReceiveFromISR, xTaskRemoveFromEventList
LOCFRAME CSTACK, 10, 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
MOV.W R12, R10
MOV.W R14, R11
MOV.W 0xa(SP), R8
// 503 signed portBASE_TYPE xReturn;
// 504
// 505 /* We cannot block from an ISR, so check there is data available. */
// 506 if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )
CMP.W #0x0, 0x1c(R10)
JEQ ??xQueueReceiveFromISR_0
// 507 {
// 508 /* Copy the data from the queue. */
// 509 pxQueue->pcReadFrom += pxQueue->uxItemSize;
MOV.W R10, R15
ADD.W 0x20(R10), 0x6(R15)
// 510 if( pxQueue->pcReadFrom >= pxQueue->pcTail )
CMP.W 0x2(R10), 0x6(R10)
JNC ??xQueueReceiveFromISR_1
// 511 {
// 512 pxQueue->pcReadFrom = pxQueue->pcHead;
MOV.W @R10, 0x6(R10)
// 513 }
// 514 --( pxQueue->uxMessagesWaiting );
??xQueueReceiveFromISR_1:
MOV.W R10, R15
ADD.W #0xffff, 0x1c(R15)
// 515 memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->pcReadFrom, ( unsigned ) pxQueue->uxItemSize );
PUSH.W 0x20(R10)
CFI CFA SP+12
MOV.W 0x6(R10), R14
MOV.W R11, R12
CALL #memcpy
// 516
// 517 /* If the queue is locked we will not modify the event list. Instead
// 518 we update the lock count so the task that unlocks the queue will know
// 519 that an ISR has removed data while the queue was locked. */
// 520 if( pxQueue->xRxLock == queueUNLOCKED )
ADD.W #0x2, SP
CFI CFA SP+10
CMP.W #0xffff, 0x22(R10)
JNE ??xQueueReceiveFromISR_2
// 521 {
// 522 /* We only want to wake one task per ISR, so check that a task has
// 523 not already been woken. */
// 524 if( !( *pxTaskWoken ) )
CMP.W #0x0, 0(R8)
JNE ??xQueueReceiveFromISR_3
// 525 {
// 526 if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )
CMP.W #0x0, 0x8(R10)
JEQ ??xQueueReceiveFromISR_3
// 527 {
// 528 if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
MOV.W R10, R12
ADD.W #0x8, R12
CALL #xTaskRemoveFromEventList
CMP.W #0x0, R12
JEQ ??xQueueReceiveFromISR_3
// 529 {
// 530 /* The task waiting has a higher priority than us so
// 531 force a context switch. */
// 532 *pxTaskWoken = pdTRUE;
MOV.W #0x1, 0(R8)
JMP ??xQueueReceiveFromISR_3
// 533 }
// 534 }
// 535 }
// 536 }
// 537 else
// 538 {
// 539 /* Increment the lock count so the task that unlocks the queue
// 540 knows that data was removed while it was locked. */
// 541 ++( pxQueue->xRxLock );
??xQueueReceiveFromISR_2:
MOV.W R10, R15
ADD.W #0x1, 0x22(R15)
// 542 }
// 543
// 544 xReturn = pdPASS;
??xQueueReceiveFromISR_3:
MOV.W #0x1, R9
JMP ??xQueueReceiveFromISR_4
// 545 }
// 546 else
// 547 {
// 548 xReturn = pdFAIL;
??xQueueReceiveFromISR_0:
MOV.W #0x0, R9
// 549 }
// 550
// 551 return xReturn;
??xQueueReceiveFromISR_4:
MOV.W R9, R12
BR #?Epilogue4
CFI EndBlock cfiBlock4
// 552 }
// 553 /*-----------------------------------------------------------*/
// 554
RSEG CODE:CODE:REORDER:NOROOT(1)
// 555 unsigned portBASE_TYPE uxQueueMessagesWaiting( xQueueHandle pxQueue )
uxQueueMessagesWaiting:
CFI Block cfiBlock5 Using cfiCommon0
CFI Function uxQueueMessagesWaiting
// 556 {
MOV.W R12, R15
// 557 unsigned portBASE_TYPE uxReturn;
// 558
// 559 taskENTER_CRITICAL();
DINT
NOP
ADD.W #0x1, &usCriticalNesting
// 560 uxReturn = pxQueue->uxMessagesWaiting;
MOV.W 0x1c(R15), R12
// 561 taskEXIT_CRITICAL();
CMP.W #0x0, &usCriticalNesting
JEQ ??uxQueueMessagesWaiting_0
ADD.W #0xffff, &usCriticalNesting
CMP.W #0x0, &usCriticalNesting
JNE ??uxQueueMessagesWaiting_0
EINT
// 562
// 563 return uxReturn;
??uxQueueMessagesWaiting_0:
RET
CFI EndBlock cfiBlock5
// 564 }
// 565 /*-----------------------------------------------------------*/
// 566
RSEG CODE:CODE:REORDER:NOROOT(1)
// 567 void vQueueDelete( xQueueHandle pxQueue )
vQueueDelete:
CFI Block cfiBlock6 Using cfiCommon0
CFI Function vQueueDelete
// 568 {
FUNCALL vQueueDelete, vPortFree
LOCFRAME CSTACK, 4, STACK
FUNCALL vQueueDelete, vPortFree
LOCFRAME CSTACK, 4, STACK
PUSH.W R10
CFI R10 Frame(CFA, -4)
CFI CFA SP+4
MOV.W R12, R10
// 569 vPortFree( pxQueue->pcHead );
MOV.W @R10, R12
CALL #vPortFree
// 570 vPortFree( pxQueue );
MOV.W R10, R12
CALL #vPortFree
// 571 }
POP.W R10
CFI R10 SameValue
CFI CFA SP+2
RET
CFI EndBlock cfiBlock6
// 572 /*-----------------------------------------------------------*/
// 573
RSEG CODE:CODE:REORDER:NOROOT(1)
// 574 static signed portBASE_TYPE prvUnlockQueue( xQueueHandle pxQueue )
prvUnlockQueue:
CFI Block cfiBlock7 Using cfiCommon0
CFI Function prvUnlockQueue
// 575 {
FUNCALL prvUnlockQueue, xTaskRemoveFromEventList
LOCFRAME CSTACK, 6, STACK
FUNCALL prvUnlockQueue, xTaskRemoveFromEventList
LOCFRAME CSTACK, 6, 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
MOV.W R12, R10
// 576 signed portBASE_TYPE xYieldRequired = pdFALSE;
MOV.W #0x0, R11
// 577
// 578 /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */
// 579
// 580 /* The lock counts contains the number of extra data items placed or
// 581 removed from the queue while the queue was locked. When a queue is
// 582 locked items can be added or removed, but the event lists cannot be
// 583 updated. */
// 584 taskENTER_CRITICAL();
DINT
NOP
ADD.W #0x1, &usCriticalNesting
// 585 {
// 586 --( pxQueue->xTxLock );
MOV.W R10, R15
ADD.W #0xffff, 0x24(R15)
// 587
// 588 /* See if data was added to the queue while it was locked. */
// 589 if( pxQueue->xTxLock > queueUNLOCKED )
CMP.W #0x0, 0x24(R10)
JL ??prvUnlockQueue_0
// 590 {
// 591 pxQueue->xTxLock = queueUNLOCKED;
MOV.W #0xffff, 0x24(R10)
// 592
// 593 /* Data was posted while the queue was locked. Are any tasks
// 594 blocked waiting for data to become available? */
// 595 if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )
CMP.W #0x0, 0x12(R10)
JEQ ??prvUnlockQueue_0
// 596 {
// 597 /* Tasks that are removed from the event list will get added to
// 598 the pending ready list as the scheduler is still suspended. */
// 599 if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
MOV.W R10, R12
ADD.W #0x12, R12
CALL #xTaskRemoveFromEventList
CMP.W #0x0, R12
JEQ ??prvUnlockQueue_0
// 600 {
// 601 /* The task waiting has a higher priority so record that a
// 602 context switch is required. */
// 603 xYieldRequired = pdTRUE;
MOV.W #0x1, R11
// 604 }
// 605 }
// 606 }
// 607 }
// 608 taskEXIT_CRITICAL();
??prvUnlockQueue_0:
CMP.W #0x0, &usCriticalNesting
JEQ ??prvUnlockQueue_1
ADD.W #0xffff, &usCriticalNesting
CMP.W #0x0, &usCriticalNesting
JNE ??prvUnlockQueue_1
EINT
// 609
// 610 /* Do the same for the Rx lock. */
// 611 taskENTER_CRITICAL();
??prvUnlockQueue_1:
DINT
NOP
ADD.W #0x1, &usCriticalNesting
// 612 {
// 613 --( pxQueue->xRxLock );
MOV.W R10, R15
ADD.W #0xffff, 0x22(R15)
// 614
// 615 if( pxQueue->xRxLock > queueUNLOCKED )
CMP.W #0x0, 0x22(R10)
JL ??prvUnlockQueue_2
// 616 {
// 617 pxQueue->xRxLock = queueUNLOCKED;
MOV.W #0xffff, 0x22(R10)
// 618
// 619 if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )
CMP.W #0x0, 0x8(R10)
JEQ ??prvUnlockQueue_2
// 620 {
// 621 if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
MOV.W R10, R12
ADD.W #0x8, R12
CALL #xTaskRemoveFromEventList
CMP.W #0x0, R12
JEQ ??prvUnlockQueue_2
// 622 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -