📄 os_mbox.lst
字号:
\ 0000013C 0220A0E3 MOV R2,#+2
\ 00000140 0010A0E3 MOV R1,#+0
\ 00000144 0900B0E1 MOVS R0,R9
\ 00000148 ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rA
\ 0000014C F6FFFFEA B ??OSMboxDel_8
213 }
214 #if OS_EVENT_NAME_SIZE > 1
215 pevent->OSEventName[0] = '?'; /* Unknown name */
\ ??OSMboxDel_12:
\ 00000150 3F00A0E3 MOV R0,#+63
\ 00000154 0F00C9E5 STRB R0,[R9, #+15]
216 pevent->OSEventName[1] = OS_ASCII_NUL;
\ 00000158 0000A0E3 MOV R0,#+0
\ 0000015C 1000C9E5 STRB R0,[R9, #+16]
217 #endif
218 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
\ 00000160 0000A0E3 MOV R0,#+0
\ 00000164 0000C9E5 STRB R0,[R9, #+0]
219 pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free list */
\ 00000168 ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 0000016C 000090E5 LDR R0,[R0, #+0]
\ 00000170 040089E5 STR R0,[R9, #+4]
220 pevent->OSEventCnt = 0;
\ 00000174 0000A0E3 MOV R0,#+0
\ 00000178 B800C9E1 STRH R0,[R9, #+8]
221 OSEventFreeList = pevent; /* Get next free event control block */
\ 0000017C ........ LDR R0,??DataTable9 ;; OSEventFreeList
\ 00000180 009080E5 STR R9,[R0, #+0]
222 OS_EXIT_CRITICAL();
\ 00000184 0800B0E1 MOVS R0,R8
\ 00000188 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
223 if (tasks_waiting == OS_TRUE) { /* Reschedule only if task(s) were waiting */
\ 0000018C 010056E3 CMP R6,#+1
\ 00000190 0000001A BNE ??OSMboxDel_13
224 OS_Sched(); /* Find highest priority task ready to run */
\ 00000194 ........ _BLF OS_Sched,??OS_Sched??rA
225 }
226 *err = OS_ERR_NONE;
\ ??OSMboxDel_13:
\ 00000198 0000A0E3 MOV R0,#+0
\ 0000019C 0000C5E5 STRB R0,[R5, #+0]
227 pevent_return = (OS_EVENT *)0; /* Mailbox has been deleted */
\ 000001A0 0000A0E3 MOV R0,#+0
\ 000001A4 0070B0E1 MOVS R7,R0
\ 000001A8 040000EA B ??OSMboxDel_11
228 break;
229
230 default:
231 OS_EXIT_CRITICAL();
\ ??OSMboxDel_9:
\ 000001AC 0800B0E1 MOVS R0,R8
\ 000001B0 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
232 *err = OS_ERR_INVALID_OPT;
\ 000001B4 0700A0E3 MOV R0,#+7
\ 000001B8 0000C5E5 STRB R0,[R5, #+0]
233 pevent_return = pevent;
\ 000001BC 0970B0E1 MOVS R7,R9
234 break;
235 }
236 return (pevent_return);
\ ??OSMboxDel_11:
\ 000001C0 0700B0E1 MOVS R0,R7
\ ??OSMboxDel_1:
\ 000001C4 F083BDE8 POP {R4-R9,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 * err 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
\ In segment CODE, align 4, keep-with-next
274 void *OSMboxPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
275 {
\ OSMboxPend:
\ 00000000 F0432DE9 PUSH {R4-R9,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0260B0E1 MOVS R6,R2
276 void *msg;
277 INT8U pend_stat;
278 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
279 OS_CPU_SR cpu_sr = 0;
\ 00000010 0000A0E3 MOV R0,#+0
\ 00000014 0090B0E1 MOVS R9,R0
280 #endif
281
282
283
284 #if OS_ARG_CHK_EN > 0
285 if (err == (INT8U *)0) { /* Validate 'err' */
\ 00000018 000056E3 CMP R6,#+0
\ 0000001C 0100001A BNE ??OSMboxPend_0
286 return ((void *)0);
\ 00000020 0000A0E3 MOV R0,#+0
\ 00000024 6B0000EA B ??OSMboxPend_1
287 }
288 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ ??OSMboxPend_0:
\ 00000028 000054E3 CMP R4,#+0
\ 0000002C 0300001A BNE ??OSMboxPend_2
289 *err = OS_ERR_PEVENT_NULL;
\ 00000030 0400A0E3 MOV R0,#+4
\ 00000034 0000C6E5 STRB R0,[R6, #+0]
290 return ((void *)0);
\ 00000038 0000A0E3 MOV R0,#+0
\ 0000003C 650000EA B ??OSMboxPend_1
291 }
292 #endif
293 if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) { /* Validate event block type */
\ ??OSMboxPend_2:
\ 00000040 0000D4E5 LDRB R0,[R4, #+0]
\ 00000044 010050E3 CMP R0,#+1
\ 00000048 0300000A BEQ ??OSMboxPend_3
294 *err = OS_ERR_EVENT_TYPE;
\ 0000004C 0100A0E3 MOV R0,#+1
\ 00000050 0000C6E5 STRB R0,[R6, #+0]
295 return ((void *)0);
\ 00000054 0000A0E3 MOV R0,#+0
\ 00000058 5E0000EA B ??OSMboxPend_1
296 }
297 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ ??OSMboxPend_3:
\ 0000005C ........ LDR R0,??DataTable10 ;; OSIntNesting
\ 00000060 0000D0E5 LDRB R0,[R0, #+0]
\ 00000064 010050E3 CMP R0,#+1
\ 00000068 0300003A BCC ??OSMboxPend_4
298 *err = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
\ 0000006C 0200A0E3 MOV R0,#+2
\ 00000070 0000C6E5 STRB R0,[R6, #+0]
299 return ((void *)0);
\ 00000074 0000A0E3 MOV R0,#+0
\ 00000078 560000EA B ??OSMboxPend_1
300 }
301 if (OSLockNesting > 0) { /* See if called with scheduler locked ... */
\ ??OSMboxPend_4:
\ 0000007C 58019FE5 LDR R0,??OSMboxPend_5 ;; OSLockNesting
\ 00000080 0000D0E5 LDRB R0,[R0, #+0]
\ 00000084 010050E3 CMP R0,#+1
\ 00000088 0300003A BCC ??OSMboxPend_6
302 *err = OS_ERR_PEND_LOCKED; /* ... can't PEND when locked */
\ 0000008C 0D00A0E3 MOV R0,#+13
\ 00000090 0000C6E5 STRB R0,[R6, #+0]
303 return ((void *)0);
\ 00000094 0000A0E3 MOV R0,#+0
\ 00000098 4E0000EA B ??OSMboxPend_1
304 }
305 OS_ENTER_CRITICAL();
\ ??OSMboxPend_6:
\ 0000009C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
\ 000000A0 0090B0E1 MOVS R9,R0
306 msg = pevent->OSEventPtr;
\ 000000A4 040094E5 LDR R0,[R4, #+4]
\ 000000A8 0070B0E1 MOVS R7,R0
307 if (msg != (void *)0) { /* See if there is already a message */
\ 000000AC 000057E3 CMP R7,#+0
\ 000000B0 0700000A BEQ ??OSMboxPend_7
308 pevent->OSEventPtr = (void *)0; /* Clear the mailbox */
\ 000000B4 0000A0E3 MOV R0,#+0
\ 000000B8 040084E5 STR R0,[R4, #+4]
309 OS_EXIT_CRITICAL();
\ 000000BC 0900B0E1 MOVS R0,R9
\ 000000C0 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
310 *err = OS_ERR_NONE;
\ 000000C4 0000A0E3 MOV R0,#+0
\ 000000C8 0000C6E5 STRB R0,[R6, #+0]
311 return (msg); /* Return the message received (or NULL) */
\ 000000CC 0700B0E1 MOVS R0,R7
\ 000000D0 400000EA B ??OSMboxPend_1
312 }
313 OSTCBCur->OSTCBStat |= OS_STAT_MBOX; /* Message not available, task will pend */
\ ??OSMboxPend_7:
\ 000000D4 04019FE5 LDR R0,??OSMboxPend_5+0x4 ;; OSTCBCur
\ 000000D8 000090E5 LDR R0,[R0, #+0]
\ 000000DC FC109FE5 LDR R1,??OSMboxPend_5+0x4 ;; OSTCBCur
\ 000000E0 001091E5 LDR R1,[R1, #+0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -