📄 os_sem.lst
字号:
340 OS_ENTER_CRITICAL();
\ 00000084 ........ BL OS_CPU_SR_Save
\ 00000088 0700 MOVS R7,R0
341 switch (OSTCBCur->OSTCBStatPend) { /* See if we timed-out or aborted */
\ 0000008A .... LDR.N R0,??DataTable3_4
\ 0000008C 0068 LDR R0,[R0, #+0]
\ 0000008E 90F83500 LDRB R0,[R0, #+53]
\ 00000092 0028 CMP R0,#+0
\ 00000094 02D0 BEQ.N ??OSSemPend_5
\ 00000096 0228 CMP R0,#+2
\ 00000098 03D0 BEQ.N ??OSSemPend_6
\ 0000009A 05E0 B.N ??OSSemPend_7
342 case OS_STAT_PEND_OK:
343 *perr = OS_ERR_NONE;
\ ??OSSemPend_5:
\ 0000009C 0020 MOVS R0,#+0
\ 0000009E 3070 STRB R0,[R6, #+0]
344 break;
\ 000000A0 09E0 B.N ??OSSemPend_8
345
346 case OS_STAT_PEND_ABORT:
347 *perr = OS_ERR_PEND_ABORT; /* Indicate that we aborted */
\ ??OSSemPend_6:
\ 000000A2 0E20 MOVS R0,#+14
\ 000000A4 3070 STRB R0,[R6, #+0]
348 break;
\ 000000A6 06E0 B.N ??OSSemPend_8
349
350 case OS_STAT_PEND_TO:
351 default:
352 OS_EventTaskRemove(OSTCBCur, pevent);
\ ??OSSemPend_7:
\ 000000A8 2100 MOVS R1,R4
\ 000000AA .... LDR.N R0,??DataTable3_4
\ 000000AC 0068 LDR R0,[R0, #+0]
\ 000000AE ........ BL OS_EventTaskRemove
353 *perr = OS_ERR_TIMEOUT; /* Indicate that we didn't get event within TO */
\ 000000B2 0A20 MOVS R0,#+10
\ 000000B4 3070 STRB R0,[R6, #+0]
354 break;
355 }
356 OSTCBCur->OSTCBStat = OS_STAT_RDY; /* Set task status to ready */
\ ??OSSemPend_8:
\ 000000B6 .... LDR.N R0,??DataTable3_4
\ 000000B8 0068 LDR R0,[R0, #+0]
\ 000000BA 0021 MOVS R1,#+0
\ 000000BC 80F83410 STRB R1,[R0, #+52]
357 OSTCBCur->OSTCBStatPend = OS_STAT_PEND_OK; /* Clear pend status */
\ 000000C0 .... LDR.N R0,??DataTable3_4
\ 000000C2 0068 LDR R0,[R0, #+0]
\ 000000C4 0021 MOVS R1,#+0
\ 000000C6 80F83510 STRB R1,[R0, #+53]
358 OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0; /* Clear event pointers */
\ 000000CA .... LDR.N R0,??DataTable3_4
\ 000000CC 0068 LDR R0,[R0, #+0]
\ 000000CE 0021 MOVS R1,#+0
\ 000000D0 C161 STR R1,[R0, #+28]
359 #if (OS_EVENT_MULTI_EN > 0u)
360 OSTCBCur->OSTCBEventMultiPtr = (OS_EVENT **)0;
\ 000000D2 .... LDR.N R0,??DataTable3_4
\ 000000D4 0068 LDR R0,[R0, #+0]
\ 000000D6 0021 MOVS R1,#+0
\ 000000D8 0162 STR R1,[R0, #+32]
361 #endif
362 OS_EXIT_CRITICAL();
\ 000000DA 3800 MOVS R0,R7
\ 000000DC ........ BL OS_CPU_SR_Restore
363 }
\ ??OSSemPend_1:
\ 000000E0 F1BD POP {R0,R4-R7,PC} ;; return
364
365 /*$PAGE*/
366 /*
367 *********************************************************************************************************
368 * ABORT WAITING ON A SEMAPHORE
369 *
370 * Description: This function aborts & readies any tasks currently waiting on a semaphore. This function
371 * should be used to fault-abort the wait on the semaphore, rather than to normally signal
372 * the semaphore via OSSemPost().
373 *
374 * Arguments : pevent is a pointer to the event control block associated with the desired
375 * semaphore.
376 *
377 * opt determines the type of ABORT performed:
378 * OS_PEND_OPT_NONE ABORT wait for a single task (HPT) waiting on the
379 * semaphore
380 * OS_PEND_OPT_BROADCAST ABORT wait for ALL tasks that are waiting on the
381 * semaphore
382 *
383 * perr is a pointer to where an error message will be deposited. Possible error
384 * messages are:
385 *
386 * OS_ERR_NONE No tasks were waiting on the semaphore.
387 * OS_ERR_PEND_ABORT At least one task waiting on the semaphore was readied
388 * and informed of the aborted wait; check return value
389 * for the number of tasks whose wait on the semaphore
390 * was aborted.
391 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a semaphore.
392 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
393 *
394 * Returns : == 0 if no tasks were waiting on the semaphore, or upon error.
395 * > 0 if one or more tasks waiting on the semaphore are now readied and informed.
396 *********************************************************************************************************
397 */
398
399 #if OS_SEM_PEND_ABORT_EN > 0u
\ In section .text, align 2, keep-with-next
400 INT8U OSSemPendAbort (OS_EVENT *pevent,
401 INT8U opt,
402 INT8U *perr)
403 {
\ OSSemPendAbort:
\ 00000000 2DE9F041 PUSH {R4-R8,LR}
\ 00000004 0400 MOVS R4,R0
\ 00000006 0D00 MOVS R5,R1
\ 00000008 1600 MOVS R6,R2
404 INT8U nbr_tasks;
405 #if OS_CRITICAL_METHOD == 3u /* Allocate storage for CPU status register */
406 OS_CPU_SR cpu_sr = 0u;
\ 0000000A 5FF00008 MOVS R8,#+0
407 #endif
408
409
410
411 #ifdef OS_SAFETY_CRITICAL
412 if (perr == (INT8U *)0) {
413 OS_SAFETY_CRITICAL_EXCEPTION();
414 return (0u);
415 }
416 #endif
417
418 #if OS_ARG_CHK_EN > 0u
419 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
420 *perr = OS_ERR_PEVENT_NULL;
421 return (0u);
422 }
423 #endif
424 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
\ 0000000E 2078 LDRB R0,[R4, #+0]
\ 00000010 0328 CMP R0,#+3
\ 00000012 03D0 BEQ.N ??OSSemPendAbort_0
425 *perr = OS_ERR_EVENT_TYPE;
\ 00000014 0120 MOVS R0,#+1
\ 00000016 3070 STRB R0,[R6, #+0]
426 return (0u);
\ 00000018 0020 MOVS R0,#+0
\ 0000001A 2DE0 B.N ??OSSemPendAbort_1
427 }
428 OS_ENTER_CRITICAL();
\ ??OSSemPendAbort_0:
\ 0000001C ........ BL OS_CPU_SR_Save
\ 00000020 8046 MOV R8,R0
429 if (pevent->OSEventGrp != 0u) { /* See if any task waiting on semaphore? */
\ 00000022 A07A LDRB R0,[R4, #+10]
\ 00000024 0028 CMP R0,#+0
\ 00000026 21D0 BEQ.N ??OSSemPendAbort_2
430 nbr_tasks = 0u;
\ 00000028 0020 MOVS R0,#+0
\ 0000002A 0700 MOVS R7,R0
431 switch (opt) {
\ 0000002C EDB2 UXTB R5,R5 ;; ZeroExt R5,R5,#+24,#+24
\ 0000002E 012D CMP R5,#+1
\ 00000030 0BD1 BNE.N ??OSSemPendAbort_3
432 case OS_PEND_OPT_BROADCAST: /* Do we need to abort ALL waiting tasks? */
433 while (pevent->OSEventGrp != 0u) { /* Yes, ready ALL tasks waiting on semaphore */
\ ??OSSemPendAbort_4:
\ 00000032 A07A LDRB R0,[R4, #+10]
\ 00000034 0028 CMP R0,#+0
\ 00000036 07D0 BEQ.N ??OSSemPendAbort_5
434 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_ABORT);
\ 00000038 0223 MOVS R3,#+2
\ 0000003A 0122 MOVS R2,#+1
\ 0000003C 0021 MOVS R1,#+0
\ 0000003E 2000 MOVS R0,R4
\ 00000040 ........ BL OS_EventTaskRdy
435 nbr_tasks++;
\ 00000044 7F1C ADDS R7,R7,#+1
\ 00000046 F4E7 B.N ??OSSemPendAbort_4
436 }
437 break;
\ ??OSSemPendAbort_5:
\ 00000048 06E0 B.N ??OSSemPendAbort_6
438
439 case OS_PEND_OPT_NONE:
440 default: /* No, ready HPT waiting on semaphore */
441 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_ABORT);
\ ??OSSemPendAbort_3:
\ 0000004A 0223 MOVS R3,#+2
\ 0000004C 0122 MOVS R2,#+1
\ 0000004E 0021 MOVS R1,#+0
\ 00000050 2000 MOVS R0,R4
\ 00000052 ........ BL OS_EventTaskRdy
442 nbr_tasks++;
\ 00000056 7F1C ADDS R7,R7,#+1
443 break;
444 }
445 OS_EXIT_CRITICAL();
\ ??OSSemPendAbort_6:
\ 00000058 4046 MOV R0,R8
\ 0000005A ........ BL OS_CPU_SR_Restore
446 OS_Sched(); /* Find HPT ready to run */
\ 0000005E ........ BL OS_Sched
447 *perr = OS_ERR_PEND_ABORT;
\ 00000062 0E20 MOVS R0,#+14
\ 00000064 3070 STRB R0,[R6, #+0]
448 return (nbr_tasks);
\ 00000066 3800 MOVS R0,R7
\ 00000068 C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 0000006A 05E0 B.N ??OSSemPendAbort_1
449 }
450 OS_EXIT_CRITICAL();
\ ??OSSemPendAbort_2:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -