📄 os_q.lst
字号:
\ 0000000A 10E0 B ??OSQFlush_1
312 }
313 if (pevent->OSEventType != OS_EVENT_TYPE_Q) { /* Validate event block type */
\ ??OSQFlush_0:
\ 0000000C 2078 LDRB R0,[R4, #+0]
\ 0000000E 0228 CMP R0,#+2
\ 00000010 01D0 BEQ ??OSQFlush_2
314 return (OS_ERR_EVENT_TYPE);
\ 00000012 0120 MOVS R0,#+1
\ 00000014 0BE0 B ??OSQFlush_1
315 }
316 #endif
317 OS_ENTER_CRITICAL();
\ ??OSQFlush_2:
\ 00000016 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
318 pq = (OS_Q *)pevent->OSEventPtr; /* Point to queue storage structure */
\ 0000001A 6168 LDR R1,[R4, #+4]
319 pq->OSQIn = pq->OSQStart;
\ 0000001C 4A68 LDR R2,[R1, #+4]
\ 0000001E CA60 STR R2,[R1, #+12]
320 pq->OSQOut = pq->OSQStart;
\ 00000020 4A68 LDR R2,[R1, #+4]
\ 00000022 0A61 STR R2,[R1, #+16]
321 pq->OSQEntries = 0;
\ 00000024 0022 MOVS R2,#+0
\ 00000026 CA82 STRH R2,[R1, #+22]
322 OS_EXIT_CRITICAL();
\ 00000028 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
323 return (OS_NO_ERR);
\ 0000002C 0020 MOVS R0,#+0
\ ??OSQFlush_1:
\ 0000002E 10BC POP {R4}
\ 00000030 02BC POP {R1}
\ 00000032 0847 BX R1 ;; return
324 }
325 #endif
326
327 /*$PAGE*/
328 /*
329 *********************************************************************************************************
330 * PEND ON A QUEUE FOR A MESSAGE
331 *
332 * Description: This function waits for a message to be sent to a queue
333 *
334 * Arguments : pevent is a pointer to the event control block associated with the desired queue
335 *
336 * timeout is an optional timeout period (in clock ticks). If non-zero, your task will
337 * wait for a message to arrive at the queue up to the amount of time
338 * specified by this argument. If you specify 0, however, your task will wait
339 * forever at the specified queue or, until a message arrives.
340 *
341 * err is a pointer to where an error message will be deposited. Possible error
342 * messages are:
343 *
344 * OS_NO_ERR The call was successful and your task received a
345 * message.
346 * OS_TIMEOUT A message was not received within the specified timeout
347 * OS_ERR_EVENT_TYPE You didn't pass a pointer to a queue
348 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer
349 * OS_ERR_PEND_ISR If you called this function from an ISR and the result
350 * would lead to a suspension.
351 *
352 * Returns : != (void *)0 is a pointer to the message received
353 * == (void *)0 if you received a NULL pointer message or,
354 * if no message was received or,
355 * if 'pevent' is a NULL pointer or,
356 * if you didn't pass a pointer to a queue.
357 *
358 * Note(s) : As of V2.60, this function allows you to receive NULL pointer messages.
359 *********************************************************************************************************
360 */
361
\ In segment CODE, align 4, keep-with-next
362 void *OSQPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
363 {
\ OSQPend:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
\ 00000006 1600 MOVS R6,R2
364 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
365 OS_CPU_SR cpu_sr;
366 #endif
367 void *msg;
368 OS_Q *pq;
369
370
371 if (OSIntNesting > 0) { /* See if called from ISR ... */
\ 00000008 .... LDR R0,??DataTable19 ;; OSIntNesting
\ 0000000A 0078 LDRB R0,[R0, #+0]
\ 0000000C 0128 CMP R0,#+1
\ 0000000E 03D3 BCC ??OSQPend_0
372 *err = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
\ 00000010 0220 MOVS R0,#+2
\ 00000012 3070 STRB R0,[R6, #+0]
373 return ((void *)0);
\ 00000014 0020 MOVS R0,#+0
\ 00000016 66E0 B ??OSQPend_1
374 }
375 #if OS_ARG_CHK_EN > 0
376 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ ??OSQPend_0:
\ 00000018 002C CMP R4,#+0
\ 0000001A 03D1 BNE ??OSQPend_2
377 *err = OS_ERR_PEVENT_NULL;
\ 0000001C 0420 MOVS R0,#+4
\ 0000001E 3070 STRB R0,[R6, #+0]
378 return ((void *)0);
\ 00000020 0020 MOVS R0,#+0
\ 00000022 60E0 B ??OSQPend_1
379 }
380 if (pevent->OSEventType != OS_EVENT_TYPE_Q) {/* Validate event block type */
\ ??OSQPend_2:
\ 00000024 2078 LDRB R0,[R4, #+0]
\ 00000026 0228 CMP R0,#+2
\ 00000028 03D0 BEQ ??OSQPend_3
381 *err = OS_ERR_EVENT_TYPE;
\ 0000002A 0120 MOVS R0,#+1
\ 0000002C 3070 STRB R0,[R6, #+0]
382 return ((void *)0);
\ 0000002E 0020 MOVS R0,#+0
\ 00000030 59E0 B ??OSQPend_1
383 }
384 #endif
385 OS_ENTER_CRITICAL();
\ ??OSQPend_3:
\ 00000032 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000036 0700 MOVS R7,R0
386 pq = (OS_Q *)pevent->OSEventPtr; /* Point at queue control block */
\ 00000038 6068 LDR R0,[R4, #+4]
387 if (pq->OSQEntries > 0) { /* See if any messages in the queue */
\ 0000003A C18A LDRH R1,[R0, #+22]
\ 0000003C 0129 CMP R1,#+1
\ 0000003E 14D3 BCC ??OSQPend_4
388 msg = *pq->OSQOut++; /* Yes, extract oldest message from the queue */
\ 00000040 0169 LDR R1,[R0, #+16]
\ 00000042 0A00 MOVS R2,R1
\ 00000044 121D ADDS R2,R2,#+4
\ 00000046 0261 STR R2,[R0, #+16]
\ 00000048 0C68 LDR R4,[R1, #+0]
389 pq->OSQEntries--; /* Update the number of entries in the queue */
\ 0000004A C18A LDRH R1,[R0, #+22]
\ 0000004C 491E SUBS R1,R1,#+1
\ 0000004E C182 STRH R1,[R0, #+22]
390 if (pq->OSQOut == pq->OSQEnd) { /* Wrap OUT pointer if we are at the end of the queue */
\ 00000050 0169 LDR R1,[R0, #+16]
\ 00000052 8268 LDR R2,[R0, #+8]
\ 00000054 9142 CMP R1,R2
\ 00000056 01D1 BNE ??OSQPend_5
391 pq->OSQOut = pq->OSQStart;
\ 00000058 4168 LDR R1,[R0, #+4]
\ 0000005A 0161 STR R1,[R0, #+16]
392 }
393 OS_EXIT_CRITICAL();
\ ??OSQPend_5:
\ 0000005C 3800 MOVS R0,R7
\ 0000005E ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
394 *err = OS_NO_ERR;
\ 00000062 0020 MOVS R0,#+0
\ 00000064 3070 STRB R0,[R6, #+0]
395 return (msg); /* Return message received */
\ 00000066 2000 MOVS R0,R4
\ 00000068 3DE0 B ??OSQPend_1
396 }
397 OSTCBCur->OSTCBStat |= OS_STAT_Q; /* Task will have to pend for a message to be posted */
\ ??OSQPend_4:
\ 0000006A 2048 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 0000006C 0068 LDR R0,[R0, #+0]
\ 0000006E 2C30 ADDS R0,R0,#+44
\ 00000070 1E49 LDR R1,??OSQPend_6 ;; OSTCBCur
\ 00000072 0968 LDR R1,[R1, #+0]
\ 00000074 2C31 ADDS R1,R1,#+44
\ 00000076 0978 LDRB R1,[R1, #+0]
\ 00000078 0422 MOVS R2,#+4
\ 0000007A 0A43 ORRS R2,R2,R1
\ 0000007C 0270 STRB R2,[R0, #+0]
398 OSTCBCur->OSTCBDly = timeout; /* Load timeout into TCB */
\ 0000007E 1B48 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 00000080 0068 LDR R0,[R0, #+0]
\ 00000082 4585 STRH R5,[R0, #+42]
399 OS_EventTaskWait(pevent); /* Suspend task until event or timeout occurs */
\ 00000084 2000 MOVS R0,R4
\ 00000086 ........ _BLF OS_EventTaskWait,??OS_EventTaskWait??rT
400 OS_EXIT_CRITICAL();
\ 0000008A 3800 MOVS R0,R7
\ 0000008C ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
401 OS_Sched(); /* Find next highest priority task ready to run */
\ 00000090 ........ _BLF OS_Sched,??OS_Sched??rT
402 OS_ENTER_CRITICAL();
\ 00000094 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000098 0700 MOVS R7,R0
403 if (OSTCBCur->OSTCBStat & OS_STAT_Q) { /* Was task readied because of a timeout? */
\ 0000009A 1448 LDR R0,??OSQPend_6 ;; OSTCBCur
\ 0000009C 0068 LDR R0,[R0, #+0]
\ 0000009E 2C30 ADDS R0,R0,#+44
\ 000000A0 0078 LDRB R0,[R0, #+0]
\ 000000A2 4007 LSLS R0,R0,#+29
\ 000000A4 09D5 BPL ??OSQPend_7
404 OS_EventTO(pevent); /* Yes */
\ 000000A6 2000 MOVS R0,R4
\ 000000A8 ........ _BLF OS_EventTO,??OS_EventTO??rT
405 OS_EXIT_CRITICAL();
\ 000000AC 3800 MOVS R0,R7
\ 000000AE ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
406 *err = OS_TIMEOUT; /* Indicate a timeout occured */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -