📄 os_mbox.lst
字号:
\ 000000B0 07E0 B.N ??OSMboxPend_9
323 break;
324
325 case OS_STAT_PEND_ABORT:
326 pmsg = (void *)0;
327 *perr = OS_ERR_PEND_ABORT; /* Indicate that we aborted */
\ ??OSMboxPend_7:
\ 000000B2 0E20 MOVS R0,#+14
\ 000000B4 2870 STRB R0,[R5, #+0]
\ 000000B6 04E0 B.N ??OSMboxPend_9
328 break;
329
330 case OS_STAT_PEND_TO:
331 default:
332 OS_EventTaskRemove(OSTCBCur, pevent);
\ ??OSMboxPend_8:
\ 000000B8 2100 MOVS R1,R4
\ 000000BA ........ _BLF OS_EventTaskRemove,??OS_EventTaskRemove??rT
333 pmsg = (void *)0;
334 *perr = OS_ERR_TIMEOUT; /* Indicate that we didn't get event within TO */
\ 000000BE 0A20 MOVS R0,#+10
\ 000000C0 2870 STRB R0,[R5, #+0]
335 break;
336 }
337 OSTCBCur->OSTCBStat = OS_STAT_RDY; /* Set task status to ready */
\ ??OSMboxPend_9:
\ 000000C2 DAF80000 LDR R0,[R10, #+0]
\ 000000C6 3030 ADDS R0,R0,#+48
\ 000000C8 3900 MOVS R1,R7
\ 000000CA 0170 STRB R1,[R0, #+0]
338 OSTCBCur->OSTCBStatPend = OS_STAT_PEND_OK; /* Clear pend status */
\ 000000CC DAF80000 LDR R0,[R10, #+0]
\ 000000D0 3130 ADDS R0,R0,#+49
\ 000000D2 0170 STRB R1,[R0, #+0]
339 OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0; /* Clear event pointers */
\ 000000D4 DAF80000 LDR R0,[R10, #+0]
\ 000000D8 C761 STR R7,[R0, #+28]
340 #if (OS_EVENT_MULTI_EN > 0)
341 OSTCBCur->OSTCBEventMultiPtr = (OS_EVENT **)0;
\ 000000DA DAF80000 LDR R0,[R10, #+0]
\ 000000DE 0762 STR R7,[R0, #+32]
342 #endif
343 OSTCBCur->OSTCBMsg = (void *)0; /* Clear received message */
\ 000000E0 DAF80000 LDR R0,[R10, #+0]
\ 000000E4 4762 STR R7,[R0, #+36]
344 OS_EXIT_CRITICAL();
\ 000000E6 3000 MOVS R0,R6
\ 000000E8 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
345 return (pmsg); /* Return received message */
\ 000000EC 4846 MOV R0,R9
\ ??OSMboxPend_1:
\ 000000EE BDE8F087 POP {R4-R10,PC} ;; return
\ 000000F2 00BF Nop
\ ??OSMboxPend_3:
\ 000000F4 ........ DC32 OSLockNesting
\ 000000F8 ........ DC32 OSTCBCur
346 }
347 /*$PAGE*/
348 /*
349 *********************************************************************************************************
350 * ABORT WAITING ON A MESSAGE MAILBOX
351 *
352 * Description: This function aborts & readies any tasks currently waiting on a mailbox. This function
353 * should be used to fault-abort the wait on the mailbox, rather than to normally signal
354 * the mailbox via OSMboxPost() or OSMboxPostOpt().
355 *
356 * Arguments : pevent is a pointer to the event control block associated with the desired mailbox.
357 *
358 * opt determines the type of ABORT performed:
359 * OS_PEND_OPT_NONE ABORT wait for a single task (HPT) waiting on the
360 * mailbox
361 * OS_PEND_OPT_BROADCAST ABORT wait for ALL tasks that are waiting on the
362 * mailbox
363 *
364 * perr is a pointer to where an error message will be deposited. Possible error
365 * messages are:
366 *
367 * OS_ERR_NONE No tasks were waiting on the mailbox.
368 * OS_ERR_PEND_ABORT At least one task waiting on the mailbox was readied
369 * and informed of the aborted wait; check return value
370 * for the number of tasks whose wait on the mailbox
371 * was aborted.
372 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a mailbox.
373 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
374 *
375 * Returns : == 0 if no tasks were waiting on the mailbox, or upon error.
376 * > 0 if one or more tasks waiting on the mailbox are now readied and informed.
377 *********************************************************************************************************
378 */
379
380 #if OS_MBOX_PEND_ABORT_EN > 0
\ In segment CODE, align 4, keep-with-next
381 INT8U OSMboxPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr)
382 {
\ OSMboxPendAbort:
\ 00000000 2DE9F043 PUSH {R4-R9,LR}
\ 00000004 8846 MOV R8,R1
\ 00000006 0400 MOVS R4,R0
\ 00000008 1500 MOVS R5,R2
383 INT8U nbr_tasks;
384 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
385 OS_CPU_SR cpu_sr = 0;
386 #endif
387
388
389
390 #if OS_ARG_CHK_EN > 0
391 if (perr == (INT8U *)0) { /* Validate 'perr' */
392 return (0);
393 }
394 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
395 *perr = OS_ERR_PEVENT_NULL;
396 return (0);
397 }
398 #endif
399 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ 0000000A 0120 MOVS R0,#+1
\ 0000000C 8146 MOV R9,R0
\ 0000000E 2078 LDRB R0,[R4, #+0]
\ 00000010 0128 CMP R0,#+1
\ 00000012 03D0 BEQ.N ??OSMboxPendAbort_0
400 *perr = OS_ERR_EVENT_TYPE;
\ 00000014 4846 MOV R0,R9
\ 00000016 2870 STRB R0,[R5, #+0]
401 return (0);
\ 00000018 0020 MOVS R0,#+0
\ 0000001A 2AE0 B.N ??OSMboxPendAbort_1
402 }
403 OS_ENTER_CRITICAL();
\ ??OSMboxPendAbort_0:
\ 0000001C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000020 0600 MOVS R6,R0
404 if (pevent->OSEventGrp != 0) { /* See if any task waiting on mailbox? */
\ 00000022 0027 MOVS R7,#+0
\ 00000024 A07A LDRB R0,[R4, #+10]
\ 00000026 0028 CMP R0,#+0
\ 00000028 1ED0 BEQ.N ??OSMboxPendAbort_2
405 nbr_tasks = 0;
406 switch (opt) {
\ 0000002A 4046 MOV R0,R8
\ 0000002C 0128 CMP R0,#+1
\ 0000002E 0BD1 BNE.N ??OSMboxPendAbort_3
407 case OS_PEND_OPT_BROADCAST: /* Do we need to abort ALL waiting tasks? */
408 while (pevent->OSEventGrp != 0) { /* Yes, ready ALL tasks waiting on mailbox */
\ ??OSMboxPendAbort_4:
\ 00000030 A07A LDRB R0,[R4, #+10]
\ 00000032 0028 CMP R0,#+0
\ 00000034 0FD0 BEQ.N ??OSMboxPendAbort_5
409 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX, OS_STAT_PEND_ABORT);
\ 00000036 0223 MOVS R3,#+2
\ 00000038 1A46 MOV R2,R3
\ 0000003A 0021 MOVS R1,#+0
\ 0000003C 2000 MOVS R0,R4
\ 0000003E ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
410 nbr_tasks++;
\ 00000042 7F1C ADDS R7,R7,#+1
\ 00000044 FFB2 UXTB R7,R7
\ 00000046 F3E7 B.N ??OSMboxPendAbort_4
411 }
412 break;
413
414 case OS_PEND_OPT_NONE:
415 default: /* No, ready HPT waiting on mailbox */
416 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX, OS_STAT_PEND_ABORT);
\ ??OSMboxPendAbort_3:
\ 00000048 0223 MOVS R3,#+2
\ 0000004A 1A46 MOV R2,R3
\ 0000004C 3946 MOV R1,R7
\ 0000004E 2000 MOVS R0,R4
\ 00000050 ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
417 nbr_tasks++;
\ 00000054 4F46 MOV R7,R9
418 break;
419 }
420 OS_EXIT_CRITICAL();
\ ??OSMboxPendAbort_5:
\ 00000056 3000 MOVS R0,R6
\ 00000058 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
421 OS_Sched(); /* Find HPT ready to run */
\ 0000005C ........ _BLF OS_Sched,??OS_Sched??rT
422 *perr = OS_ERR_PEND_ABORT;
\ 00000060 0E20 MOVS R0,#+14
\ 00000062 2870 STRB R0,[R5, #+0]
423 return (nbr_tasks);
\ 00000064 3800 MOVS R0,R7
\ 00000066 04E0 B.N ??OSMboxPendAbort_1
424 }
425 OS_EXIT_CRITICAL();
\ ??OSMboxPendAbort_2:
\ 00000068 3000 MOVS R0,R6
\ 0000006A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
426 *perr = OS_ERR_NONE;
\ 0000006E 2F70 STRB R7,[R5, #+0]
427 return (0); /* No tasks waiting on mailbox */
\ 00000070 3846 MOV R0,R7
\ ??OSMboxPendAbort_1:
\ 00000072 BDE8F083 POP {R4-R9,PC} ;; return
428 }
429 #endif
430
431 /*$PAGE*/
432 /*
433 *********************************************************************************************************
434 * POST MESSAGE TO A MAILBOX
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -