📄 os_mbox.lst
字号:
220 pevent->OSEventCnt = 0;
\ 00000096 5046 MOV R0,R10
\ 00000098 2081 STRH R0,[R4, #+8]
221 OSEventFreeList = pevent; /* Get next free event control block */
\ 0000009A 3460 STR R4,[R6, #+0]
222 OS_EXIT_CRITICAL();
\ 0000009C 4846 MOV R0,R9
\ 0000009E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
223 if (tasks_waiting == OS_TRUE) { /* Reschedule only if task(s) were waiting */
\ 000000A2 012F CMP R7,#+1
\ 000000A4 01D1 BNE.N ??OSMboxDel_8
224 OS_Sched(); /* Find highest priority task ready to run */
\ 000000A6 ........ _BLF OS_Sched,??OS_Sched??rT
225 }
226 *perr = OS_ERR_NONE;
\ ??OSMboxDel_8:
\ 000000AA 5046 MOV R0,R10
\ 000000AC 2870 STRB R0,[R5, #+0]
227 pevent_return = (OS_EVENT *)0; /* Mailbox has been deleted */
\ 000000AE 05E0 B.N ??OSMboxDel_1
228 break;
229
230 default:
231 OS_EXIT_CRITICAL();
\ ??OSMboxDel_6:
\ 000000B0 4846 MOV R0,R9
\ 000000B2 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
232 *perr = OS_ERR_INVALID_OPT;
\ 000000B6 0720 MOVS R0,#+7
\ 000000B8 2870 STRB R0,[R5, #+0]
233 pevent_return = pevent;
\ 000000BA 2000 MOVS R0,R4
234 break;
235 }
236 return (pevent_return);
\ ??OSMboxDel_1:
\ 000000BC BDE8F08F POP {R4-R11,PC} ;; return
237 }
238 #endif
239
240 /*$PAGE*/
241 /*
242 *********************************************************************************************************
243 * PEND ON MAILBOX FOR A MESSAGE
244 *
245 * Description: This function waits for a message to be sent to a mailbox
246 *
247 * Arguments : pevent is a pointer to the event control block associated with the desired mailbox
248 *
249 * timeout is an optional timeout period (in clock ticks). If non-zero, your task will
250 * wait for a message to arrive at the mailbox up to the amount of time
251 * specified by this argument. If you specify 0, however, your task will wait
252 * forever at the specified mailbox or, until a message arrives.
253 *
254 * perr is a pointer to where an error message will be deposited. Possible error
255 * messages are:
256 *
257 * OS_ERR_NONE The call was successful and your task received a
258 * message.
259 * OS_ERR_TIMEOUT A message was not received within the specified 'timeout'.
260 * OS_ERR_PEND_ABORT The wait on the mailbox was aborted.
261 * OS_ERR_EVENT_TYPE Invalid event type
262 * OS_ERR_PEND_ISR If you called this function from an ISR and the result
263 * would lead to a suspension.
264 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
265 * OS_ERR_PEND_LOCKED If you called this function when the scheduler is locked
266 *
267 * Returns : != (void *)0 is a pointer to the message received
268 * == (void *)0 if no message was received or,
269 * if 'pevent' is a NULL pointer or,
270 * if you didn't pass the proper pointer to the event control block.
271 *********************************************************************************************************
272 */
273 /*$PAGE*/
\ In segment CODE, align 4, keep-with-next
274 void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *perr)
275 {
\ OSMboxPend:
\ 00000000 2DE9F047 PUSH {R4-R10,LR}
\ 00000004 8846 MOV R8,R1
\ 00000006 0400 MOVS R4,R0
\ 00000008 1500 MOVS R5,R2
276 void *pmsg;
277 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
278 OS_CPU_SR cpu_sr = 0;
279 #endif
280
281
282
283 #if OS_ARG_CHK_EN > 0
284 if (perr == (INT8U *)0) { /* Validate 'perr' */
285 return ((void *)0);
286 }
287 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
288 *perr = OS_ERR_PEVENT_NULL;
289 return ((void *)0);
290 }
291 #endif
292 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ 0000000A 2078 LDRB R0,[R4, #+0]
\ 0000000C 0128 CMP R0,#+1
\ 0000000E 03D0 BEQ.N ??OSMboxPend_0
293 *perr = OS_ERR_EVENT_TYPE;
\ 00000010 0120 MOVS R0,#+1
\ 00000012 2870 STRB R0,[R5, #+0]
294 return ((void *)0);
\ 00000014 0020 MOVS R0,#+0
\ 00000016 6AE0 B.N ??OSMboxPend_1
295 }
296 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ ??OSMboxPend_0:
\ 00000018 .... LDR.N R0,??DataTable4 ;; OSIntNesting
\ 0000001A 0078 LDRB R0,[R0, #+0]
\ 0000001C 0028 CMP R0,#+0
\ 0000001E 03D0 BEQ.N ??OSMboxPend_2
297 *perr = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
\ 00000020 0220 MOVS R0,#+2
\ 00000022 2870 STRB R0,[R5, #+0]
298 return ((void *)0);
\ 00000024 0020 MOVS R0,#+0
\ 00000026 62E0 B.N ??OSMboxPend_1
299 }
300 if (OSLockNesting > 0) { /* See if called with scheduler locked ... */
\ ??OSMboxPend_2:
\ 00000028 3248 LDR.N R0,??OSMboxPend_3 ;; OSLockNesting
\ 0000002A 0078 LDRB R0,[R0, #+0]
\ 0000002C 0028 CMP R0,#+0
\ 0000002E 03D0 BEQ.N ??OSMboxPend_4
301 *perr = OS_ERR_PEND_LOCKED; /* ... can't PEND when locked */
\ 00000030 0D20 MOVS R0,#+13
\ 00000032 2870 STRB R0,[R5, #+0]
302 return ((void *)0);
\ 00000034 0020 MOVS R0,#+0
\ 00000036 5AE0 B.N ??OSMboxPend_1
303 }
304 OS_ENTER_CRITICAL();
\ ??OSMboxPend_4:
\ 00000038 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 0000003C 0600 MOVS R6,R0
305 pmsg = pevent->OSEventPtr;
\ 0000003E 6068 LDR R0,[R4, #+4]
\ 00000040 8146 MOV R9,R0
306 if (pmsg != (void *)0) { /* See if there is already a message */
\ 00000042 0027 MOVS R7,#+0
\ 00000044 0028 CMP R0,#+0
\ 00000046 06D0 BEQ.N ??OSMboxPend_5
307 pevent->OSEventPtr = (void *)0; /* Clear the mailbox */
\ 00000048 6760 STR R7,[R4, #+4]
308 OS_EXIT_CRITICAL();
\ 0000004A 3000 MOVS R0,R6
\ 0000004C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
309 *perr = OS_ERR_NONE;
\ 00000050 2F70 STRB R7,[R5, #+0]
310 return (pmsg); /* Return the message received (or NULL) */
\ 00000052 4846 MOV R0,R9
\ 00000054 4BE0 B.N ??OSMboxPend_1
311 }
312 OSTCBCur->OSTCBStat |= OS_STAT_MBOX; /* Message not available, task will pend */
\ ??OSMboxPend_5:
\ 00000056 2848 LDR.N R0,??OSMboxPend_3+0x4 ;; OSTCBCur
\ 00000058 8246 MOV R10,R0
\ 0000005A DAF80000 LDR R0,[R10, #+0]
\ 0000005E 0100 MOVS R1,R0
\ 00000060 3031 ADDS R1,R1,#+48
\ 00000062 0978 LDRB R1,[R1, #+0]
\ 00000064 51F00201 ORRS R1,R1,#0x2
\ 00000068 80F83010 STRB R1,[R0, #+48]
313 OSTCBCur->OSTCBStatPend = OS_STAT_PEND_OK;
\ 0000006C DAF80000 LDR R0,[R10, #+0]
\ 00000070 3130 ADDS R0,R0,#+49
\ 00000072 3900 MOVS R1,R7
\ 00000074 0170 STRB R1,[R0, #+0]
314 OSTCBCur->OSTCBDly = timeout; /* Load timeout in TCB */
\ 00000076 DAF80000 LDR R0,[R10, #+0]
\ 0000007A A0F82E80 STRH R8,[R0, #+46]
315 OS_EventTaskWait(pevent); /* Suspend task until event or timeout occurs */
\ 0000007E 2000 MOVS R0,R4
\ 00000080 ........ _BLF OS_EventTaskWait,??OS_EventTaskWait??rT
316 OS_EXIT_CRITICAL();
\ 00000084 3000 MOVS R0,R6
\ 00000086 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
317 OS_Sched(); /* Find next highest priority task ready to run */
\ 0000008A ........ _BLF OS_Sched,??OS_Sched??rT
318 OS_ENTER_CRITICAL();
\ 0000008E ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000092 0600 MOVS R6,R0
319 switch (OSTCBCur->OSTCBStatPend) { /* See if we timed-out or aborted */
\ 00000094 DAF80000 LDR R0,[R10, #+0]
\ 00000098 0100 MOVS R1,R0
\ 0000009A 2431 ADDS R1,R1,#+36
\ 0000009C 4A7B LDRB R2,[R1, #+13]
\ 0000009E 002A CMP R2,#+0
\ 000000A0 02D0 BEQ.N ??OSMboxPend_6
\ 000000A2 022A CMP R2,#+2
\ 000000A4 05D0 BEQ.N ??OSMboxPend_7
\ 000000A6 07E0 B.N ??OSMboxPend_8
320 case OS_STAT_PEND_OK:
321 pmsg = OSTCBCur->OSTCBMsg;
\ ??OSMboxPend_6:
\ 000000A8 0868 LDR R0,[R1, #+0]
\ 000000AA 8146 MOV R9,R0
322 *perr = OS_ERR_NONE;
\ 000000AC 3800 MOVS R0,R7
\ 000000AE 2870 STRB R0,[R5, #+0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -