📄 os_q.s79
字号:
STRH R1,[R0, #+22]
// 468 if (pq->OSQIn == pq->OSQEnd) { /* Wrap IN ptr if we are at end of queue */
LDR R1,[R0, #+12]
LDR R2,[R0, #+8]
CMP R1,R2
BNE ??OSQPost_6
// 469 pq->OSQIn = pq->OSQStart;
LDR R1,[R0, #+4]
STR R1,[R0, #+12]
// 470 }
// 471 OS_EXIT_CRITICAL();
??OSQPost_6:
MOVS R0,R5
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 472 return (OS_NO_ERR);
??OSQPost_4:
MOVS R0,#+0
??OSQPost_1:
POP {R4-R6}
POP {R1}
BX R1 ;; return
CFI EndBlock cfiBlock11
// 473 }
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock12 Using cfiCommon0
CFI NoFunction
ARM
??OSQPostFront??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock12
REQUIRE OSQPostFront
// 474 #endif
// 475 /*$PAGE*/
// 476 /*
// 477 *********************************************************************************************************
// 478 * POST MESSAGE TO THE FRONT OF A QUEUE
// 479 *
// 480 * Description: This function sends a message to a queue but unlike OSQPost(), the message is posted at
// 481 * the front instead of the end of the queue. Using OSQPostFront() allows you to send
// 482 * 'priority' messages.
// 483 *
// 484 * Arguments : pevent is a pointer to the event control block associated with the desired queue
// 485 *
// 486 * msg is a pointer to the message to send. You MUST NOT send a NULL pointer.
// 487 *
// 488 * Returns : OS_NO_ERR The call was successful and the message was sent
// 489 * OS_Q_FULL If the queue cannot accept any more messages because it is full.
// 490 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a queue.
// 491 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
// 492 *
// 493 * Note(s) : As of V2.60, this function allows you to send NULL pointer messages.
// 494 *********************************************************************************************************
// 495 */
// 496
// 497 #if OS_Q_POST_FRONT_EN > 0
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock13 Using cfiCommon1
CFI Function OSQPostFront
THUMB
// 498 INT8U OSQPostFront (OS_EVENT *pevent, void *msg)
// 499 {
OSQPostFront:
PUSH {R4-R6,LR}
CFI ?RET Frame(CFA, -4)
CFI R6 Frame(CFA, -8)
CFI R5 Frame(CFA, -12)
CFI R4 Frame(CFA, -16)
CFI CFA R13+16
MOVS R5,R0
MOVS R4,R1
// 500 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
// 501 OS_CPU_SR cpu_sr;
// 502 #endif
// 503 OS_Q *pq;
// 504
// 505
// 506 #if OS_ARG_CHK_EN > 0
// 507 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
CMP R5,#+0
BNE ??OSQPostFront_0
// 508 return (OS_ERR_PEVENT_NULL);
MOVS R0,#+4
B ??OSQPostFront_1
// 509 }
// 510 #endif
// 511 if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type */
??OSQPostFront_0:
LDRB R0,[R5, #+0]
CMP R0,#+2
BEQ ??OSQPostFront_2
// 512 return (OS_ERR_EVENT_TYPE);
MOVS R0,#+1
B ??OSQPostFront_1
// 513 }
// 514 OS_ENTER_CRITICAL();
??OSQPostFront_2:
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
MOVS R6,R0
// 515 if (pevent->OSEventGrp != 0x00) { /* See if any task pending on queue */
LDRB R0,[R5, #+1]
CMP R0,#+0
BEQ ??OSQPostFront_3
// 516 OS_EventTaskRdy(pevent, msg, OS_STAT_Q); /* Ready highest priority task waiting on event */
MOVS R2,#+4
MOVS R1,R4
MOVS R0,R5
_BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
// 517 OS_EXIT_CRITICAL();
MOVS R0,R6
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 518 OS_Sched(); /* Find highest priority task ready to run */
_BLF OS_Sched,??OS_Sched??rT
// 519 return (OS_NO_ERR);
B.N ??OSQPostFront_4
// 520 }
// 521 pq = (OS_Q *)pevent->OSEventPtr; /* Point to queue control block */
??OSQPostFront_3:
LDR R0,[R5, #+4]
// 522 if (pq->OSQEntries >= pq->OSQSize) { /* Make sure queue is not full */
LDRH R1,[R0, #+22]
LDRH R2,[R0, #+20]
CMP R1,R2
BCC ??OSQPostFront_5
// 523 OS_EXIT_CRITICAL();
MOVS R0,R6
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 524 return (OS_Q_FULL);
MOVS R0,#+30
B ??OSQPostFront_1
// 525 }
// 526 if (pq->OSQOut == pq->OSQStart) { /* Wrap OUT ptr if we are at the 1st queue entry */
??OSQPostFront_5:
LDR R1,[R0, #+16]
LDR R2,[R0, #+4]
CMP R1,R2
BNE ??OSQPostFront_6
// 527 pq->OSQOut = pq->OSQEnd;
LDR R1,[R0, #+8]
STR R1,[R0, #+16]
// 528 }
// 529 pq->OSQOut--;
??OSQPostFront_6:
LDR R1,[R0, #+16]
SUBS R1,R1,#+4
STR R1,[R0, #+16]
// 530 *pq->OSQOut = msg; /* Insert message into queue */
STR R4,[R1, #+0]
// 531 pq->OSQEntries++; /* Update the nbr of entries in the queue */
LDRH R1,[R0, #+22]
ADDS R1,R1,#+1
STRH R1,[R0, #+22]
// 532 OS_EXIT_CRITICAL();
MOVS R0,R6
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
// 533 return (OS_NO_ERR);
??OSQPostFront_4:
MOVS R0,#+0
??OSQPostFront_1:
POP {R4-R6}
POP {R1}
BX R1 ;; return
CFI EndBlock cfiBlock13
// 534 }
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock14 Using cfiCommon0
CFI NoFunction
ARM
??OSQPostOpt??rA:
ADD R12,PC,#+1
BX R12
CFI EndBlock cfiBlock14
REQUIRE OSQPostOpt
// 535 #endif
// 536 /*$PAGE*/
// 537 /*
// 538 *********************************************************************************************************
// 539 * POST MESSAGE TO A QUEUE
// 540 *
// 541 * Description: This function sends a message to a queue. This call has been added to reduce code size
// 542 * since it can replace both OSQPost() and OSQPostFront(). Also, this function adds the
// 543 * capability to broadcast a message to ALL tasks waiting on the message queue.
// 544 *
// 545 * Arguments : pevent is a pointer to the event control block associated with the desired queue
// 546 *
// 547 * msg is a pointer to the message to send. You MUST NOT send a NULL pointer.
// 548 *
// 549 * opt determines the type of POST performed:
// 550 * OS_POST_OPT_NONE POST to a single waiting task
// 551 * (Identical to OSQPost())
// 552 * OS_POST_OPT_BROADCAST POST to ALL tasks that are waiting on the queue
// 553 * OS_POST_OPT_FRONT POST as LIFO (Simulates OSQPostFront())
// 554 *
// 555 * Below is a list of ALL the possible combination of these flags:
// 556 *
// 557 * 1) OS_POST_OPT_NONE
// 558 * identical to OSQPost()
// 559 *
// 560 * 2) OS_POST_OPT_FRONT
// 561 * identical to OSQPostFront()
// 562 *
// 563 * 3) OS_POST_OPT_BROADCAST
// 564 * identical to OSQPost() but will broadcast 'msg' to ALL waiting tasks
// 565 *
// 566 * 4) OS_POST_OPT_FRONT + OS_POST_OPT_BROADCAST is identical to
// 567 * OSQPostFront() except that will broadcast 'msg' to ALL waiting tasks
// 568 *
// 569 * Returns : OS_NO_ERR The call was successful and the message was sent
// 570 * OS_Q_FULL If the queue cannot accept any more messages because it is full.
// 571 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a queue.
// 572 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
// 573 * OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
// 574 *
// 575 * Warning : Interrupts can be disabled for a long time if you do a 'broadcast'. In fact, the
// 576 * interrupt disable time is proportional to the number of tasks waiting on the queue.
// 577 *********************************************************************************************************
// 578 */
// 579
// 580 #if OS_Q_POST_OPT_EN > 0
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock15 Using cfiCommon1
CFI Function OSQPostOpt
THUMB
// 581 INT8U OSQPostOpt (OS_EVENT *pevent, void *msg, INT8U opt)
// 582 {
OSQPostOpt:
PUSH {R4-R7,LR}
CFI ?RET Frame(CFA, -4)
CFI R7 Frame(CFA, -8)
CFI R6 Frame(CFA, -12)
CFI R5 Frame(CFA, -16)
CFI R4 Frame(CFA, -20)
CFI CFA R13+20
MOVS R7,R0
MOVS R4,R1
MOVS R5,R2
// 583 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
// 584 OS_CPU_SR cpu_sr;
// 585 #endif
// 586 OS_Q *pq;
// 587
// 588
// 589 #if OS_ARG_CHK_EN > 0
// 590 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
CMP R7,#+0
BNE ??OSQPostOpt_0
// 591 return (OS_ERR_PEVENT_NULL);
MOVS R0,#+4
B ??OSQPostOpt_1
// 592 }
// 593 if (msg == (void *)0) { /* Make sure we are not posting a NULL pointer */
??OSQPostOpt_0:
CMP R4,#+0
BNE ??OSQPostOpt_2
// 594 return (OS_ERR_POST_NULL_PTR);
MOVS R0,#+3
B ??OSQPostOpt_1
// 595 }
// 596 #endif
// 597 if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type */
??OSQPostOpt_2:
LDRB R0,[R7, #+0]
CMP R0,#+2
BEQ ??OSQPostOpt_3
// 598 return (OS_ERR_EVENT_TYPE);
MOVS R0,#+1
B ??OSQPostOpt_1
// 599 }
// 600 OS_ENTER_CRITICAL();
??OSQPostOpt_3:
_BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
MOVS R6,R0
// 601 if (pevent->OSEventGrp != 0x00) { /* See if any task pending on queue */
LDRB R0,[R7, #+1]
CMP R0,#+0
BEQ ??OSQPostOpt_4
// 602 if ((opt & OS_POST_OPT_BROADCAST) != 0x00) { /* Do we need to post msg to ALL waiting tasks ? */
LSLS R0,R5,#+31
BPL ??OSQPostOpt_5
// 603 while (pevent->OSEventGrp != 0x00) { /* Yes, Post to ALL tasks waiting on queue */
// 604 OS_EventTaskRdy(pevent, msg, OS_STAT_Q);
??OSQPostOpt_6:
MOVS R2,#+4
MOVS R1,R4
MOVS R0,R7
_BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
// 605 }
LDRB R0,[R7, #+1]
CMP R0,#+0
BNE ??OSQPostOpt_6
B ??OSQPostOpt_7
// 606 } else {
// 607 OS_EventTaskRdy(pevent, msg, OS_STAT_Q); /* No, Post to HPT waiting on queue */
??OSQPostOpt_5:
MOVS R2,#+4
MOVS R1,R4
MOVS R0,R7
_BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
// 608 }
// 609 OS_EXIT_CRITICAL();
??OSQPostOpt_7:
MOVS R0,R6
_BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -