📄 os_q.lst
字号:
\ 000000B2 0A20 MOVS R0,#+10
\ 000000B4 3070 STRB R0,[R6, #+0]
407 return ((void *)0); /* No message received */
\ 000000B6 0020 MOVS R0,#+0
\ 000000B8 15E0 B ??OSQPend_1
408 }
409 msg = OSTCBCur->OSTCBMsg;/* No, Extract message from TCB (Put there by QPost) */
\ ??OSQPend_7:
\ 000000BA 0C48 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 000000BC 0068 LDR R0,[R0, #+0]
\ 000000BE 046A LDR R4,[R0, #+32]
410 OSTCBCur->OSTCBMsg = (void *)0;
\ 000000C0 0A48 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 000000C2 0068 LDR R0,[R0, #+0]
\ 000000C4 0021 MOVS R1,#+0
\ 000000C6 0162 STR R1,[R0, #+32]
411 OSTCBCur->OSTCBStat = OS_STAT_RDY;
\ 000000C8 0848 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 000000CA 0068 LDR R0,[R0, #+0]
\ 000000CC 2C30 ADDS R0,R0,#+44
\ 000000CE 0021 MOVS R1,#+0
\ 000000D0 0170 STRB R1,[R0, #+0]
412 OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0; /* No longer waiting for event */
\ 000000D2 0648 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 000000D4 0068 LDR R0,[R0, #+0]
\ 000000D6 0021 MOVS R1,#+0
\ 000000D8 C161 STR R1,[R0, #+28]
413 OS_EXIT_CRITICAL();
\ 000000DA 3800 MOVS R0,R7
\ 000000DC ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
414 *err = OS_NO_ERR;
\ 000000E0 0020 MOVS R0,#+0
\ 000000E2 3070 STRB R0,[R6, #+0]
415 return (msg); /* Return message received */
\ 000000E4 2000 MOVS R0,R4
\ ??OSQPend_1:
\ 000000E6 F0BC POP {R4-R7}
\ 000000E8 02BC POP {R1}
\ 000000EA 0847 BX R1 ;; return
\ ??OSQPend_6:
\ 000000EC ........ DC32 OSTCBCur
416 }
417 /*$PAGE*/
418 /*
419 *********************************************************************************************************
420 * POST MESSAGE TO A QUEUE
421 *
422 * Description: This function sends a message to a queue
423 *
424 * Arguments : pevent is a pointer to the event control block associated with the desired queue
425 *
426 * msg is a pointer to the message to send. You MUST NOT send a NULL pointer.
427 *
428 * Returns : OS_NO_ERR The call was successful and the message was sent
429 * OS_Q_FULL If the queue cannot accept any more messages because it is full.
430 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a queue.
431 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
432 *
433 * Note(s) : As of V2.60, this function allows you to send NULL pointer messages.
434 *********************************************************************************************************
435 */
436
437 #if OS_Q_POST_EN > 0
\ In segment CODE, align 4, keep-with-next
438 INT8U OSQPost (OS_EVENT *pevent, void *msg)
439 {
\ OSQPost:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0600 MOVS R6,R0
\ 00000004 0C00 MOVS R4,R1
440 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
441 OS_CPU_SR cpu_sr;
442 #endif
443 OS_Q *pq;
444
445
446 #if OS_ARG_CHK_EN > 0
447 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ 00000006 002E CMP R6,#+0
\ 00000008 01D1 BNE ??OSQPost_0
448 return (OS_ERR_PEVENT_NULL);
\ 0000000A 0420 MOVS R0,#+4
\ 0000000C 32E0 B ??OSQPost_1
449 }
450 #endif
451 if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type */
\ ??OSQPost_0:
\ 0000000E 3078 LDRB R0,[R6, #+0]
\ 00000010 0228 CMP R0,#+2
\ 00000012 01D0 BEQ ??OSQPost_2
452 return (OS_ERR_EVENT_TYPE);
\ 00000014 0120 MOVS R0,#+1
\ 00000016 2DE0 B ??OSQPost_1
453 }
454 OS_ENTER_CRITICAL();
\ ??OSQPost_2:
\ 00000018 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 0000001C 0500 MOVS R5,R0
455 if (pevent->OSEventGrp != 0x00) { /* See if any task pending on queue */
\ 0000001E 7078 LDRB R0,[R6, #+1]
\ 00000020 0028 CMP R0,#+0
\ 00000022 0BD0 BEQ ??OSQPost_3
456 OS_EventTaskRdy(pevent, msg, OS_STAT_Q); /* Ready highest priority task waiting on event */
\ 00000024 0422 MOVS R2,#+4
\ 00000026 2100 MOVS R1,R4
\ 00000028 3000 MOVS R0,R6
\ 0000002A ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
457 OS_EXIT_CRITICAL();
\ 0000002E 2800 MOVS R0,R5
\ 00000030 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
458 OS_Sched(); /* Find highest priority task ready to run */
\ 00000034 ........ _BLF OS_Sched,??OS_Sched??rT
459 return (OS_NO_ERR);
\ 00000038 0020 MOVS R0,#+0
\ 0000003A 1BE0 B ??OSQPost_1
460 }
461 pq = (OS_Q *)pevent->OSEventPtr; /* Point to queue control block */
\ ??OSQPost_3:
\ 0000003C 7068 LDR R0,[R6, #+4]
462 if (pq->OSQEntries >= pq->OSQSize) { /* Make sure queue is not full */
\ 0000003E C18A LDRH R1,[R0, #+22]
\ 00000040 828A LDRH R2,[R0, #+20]
\ 00000042 9142 CMP R1,R2
\ 00000044 04D3 BCC ??OSQPost_4
463 OS_EXIT_CRITICAL();
\ 00000046 2800 MOVS R0,R5
\ 00000048 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
464 return (OS_Q_FULL);
\ 0000004C 1E20 MOVS R0,#+30
\ 0000004E 11E0 B ??OSQPost_1
465 }
466 *pq->OSQIn++ = msg; /* Insert message into queue */
\ ??OSQPost_4:
\ 00000050 C168 LDR R1,[R0, #+12]
\ 00000052 0A00 MOVS R2,R1
\ 00000054 121D ADDS R2,R2,#+4
\ 00000056 C260 STR R2,[R0, #+12]
\ 00000058 0C60 STR R4,[R1, #+0]
467 pq->OSQEntries++; /* Update the nbr of entries in the queue */
\ 0000005A C18A LDRH R1,[R0, #+22]
\ 0000005C 491C ADDS R1,R1,#+1
\ 0000005E C182 STRH R1,[R0, #+22]
468 if (pq->OSQIn == pq->OSQEnd) { /* Wrap IN ptr if we are at end of queue */
\ 00000060 C168 LDR R1,[R0, #+12]
\ 00000062 8268 LDR R2,[R0, #+8]
\ 00000064 9142 CMP R1,R2
\ 00000066 01D1 BNE ??OSQPost_5
469 pq->OSQIn = pq->OSQStart;
\ 00000068 4168 LDR R1,[R0, #+4]
\ 0000006A C160 STR R1,[R0, #+12]
470 }
471 OS_EXIT_CRITICAL();
\ ??OSQPost_5:
\ 0000006C 2800 MOVS R0,R5
\ 0000006E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
472 return (OS_NO_ERR);
\ 00000072 0020 MOVS R0,#+0
\ ??OSQPost_1:
\ 00000074 70BC POP {R4-R6}
\ 00000076 02BC POP {R1}
\ 00000078 0847 BX R1 ;; return
473 }
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
\ In segment CODE, align 4, keep-with-next
498 INT8U OSQPostFront (OS_EVENT *pevent, void *msg)
499 {
\ OSQPostFront:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0500 MOVS R5,R0
\ 00000004 0C00 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' */
\ 00000006 002D CMP R5,#+0
\ 00000008 01D1 BNE ??OSQPostFront_0
508
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -