📄 os_q.lst
字号:
\ 000000CE 02BC POP {R1}
\ 000000D0 0847 BX R1 ;; return
\ 000000D2 C046 Nop
\ ??OSQPend_8:
\ 000000D4 ........ 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 30E0 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 2BE0 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 0AD0 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 19E0 B.N ??OSQPost_4
460 }
461 pq = (OS_Q *)pevent->OSEventPtr; /* Point to queue control block */
\ ??OSQPost_3:
\ 0000003A 7068 LDR R0,[R6, #+4]
462 if (pq->OSQEntries >= pq->OSQSize) { /* Make sure queue is not full */
\ 0000003C C18A LDRH R1,[R0, #+22]
\ 0000003E 828A LDRH R2,[R0, #+20]
\ 00000040 9142 CMP R1,R2
\ 00000042 04D3 BCC ??OSQPost_5
463 OS_EXIT_CRITICAL();
\ 00000044 2800 MOVS R0,R5
\ 00000046 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
464 return (OS_Q_FULL);
\ 0000004A 1E20 MOVS R0,#+30
\ 0000004C 10E0 B ??OSQPost_1
465 }
466 *pq->OSQIn++ = msg; /* Insert message into queue */
\ ??OSQPost_5:
\ 0000004E C168 LDR R1,[R0, #+12]
\ 00000050 0A1D ADDS R2,R1,#+4
\ 00000052 C260 STR R2,[R0, #+12]
\ 00000054 0C60 STR R4,[R1, #+0]
467 pq->OSQEntries++; /* Update the nbr of entries in the queue */
\ 00000056 C18A LDRH R1,[R0, #+22]
\ 00000058 491C ADDS R1,R1,#+1
\ 0000005A C182 STRH R1,[R0, #+22]
468 if (pq->OSQIn == pq->OSQEnd) { /* Wrap IN ptr if we are at end of queue */
\ 0000005C C168 LDR R1,[R0, #+12]
\ 0000005E 8268 LDR R2,[R0, #+8]
\ 00000060 9142 CMP R1,R2
\ 00000062 01D1 BNE ??OSQPost_6
469 pq->OSQIn = pq->OSQStart;
\ 00000064 4168 LDR R1,[R0, #+4]
\ 00000066 C160 STR R1,[R0, #+12]
470 }
471 OS_EXIT_CRITICAL();
\ ??OSQPost_6:
\ 00000068 2800 MOVS R0,R5
\ 0000006A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
472 return (OS_NO_ERR);
\ ??OSQPost_4:
\ 0000006E 0020 MOVS R0,#+0
\ ??OSQPost_1:
\ 00000070 70BC POP {R4-R6}
\ 00000072 02BC POP {R1}
\ 00000074 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 return (OS_ERR_PEVENT_NULL);
\ 0000000A 0420 MOVS R0,#+4
\ 0000000C 30E0 B ??OSQPostFront_1
509 }
510 #endif
511 if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type */
\ ??OSQPostFront_0:
\ 0000000E 2878 LDRB R0,[R5, #+0]
\ 00000010 0228 CMP R0,#+2
\ 00000012 01D0 BEQ ??OSQPostFront_2
512 return (OS_ERR_EVENT_TYPE);
\ 00000014 0120 MOVS R0,#+1
\ 00000016 2BE0 B ??OSQPostFront_1
513 }
514 OS_ENTER_CRITICAL();
\ ??OSQPostFront_2:
\ 00000018 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 0000001C 0600 MOVS R6,R0
515 if (pevent->OSEventGrp != 0x00) { /* See if any task pending on queue */
\ 0000001E 6878 LDRB R0,[R5, #+1]
\ 00000020 0028 CMP R0,#+0
\ 00000022 0AD0 BEQ ??OSQPostFront_3
516 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 2800 MOVS R0,R5
\ 0000002A ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
517 OS_EXIT_CRITICAL();
\ 0000002E 3000 MOVS R0,R6
\ 00000030 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
518 OS_Sched(); /* Find highest priority task ready to run */
\ 00000034 ........ _BLF OS_Sched,??OS_Sched??rT
519 return (OS_NO_ERR);
\ 00000038 19E0 B.N ??OSQPostFront_4
520 }
521 pq
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -