📄 os_sem.lst
字号:
\ 000000A4 0F46 MOV R7,R1
328 OS_EventTOAbort(pevent);
\ 000000A6 2000 MOVS R0,R4
\ 000000A8 ........ _BLF OS_EventTOAbort,??OS_EventTOAbort??rT
329 OS_EXIT_CRITICAL();
\ 000000AC 3000 MOVS R0,R6
\ 000000AE ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
330 switch (pend_stat) {
\ 000000B2 022F CMP R7,#+2
\ 000000B4 02D0 BEQ.N ??OSSemPend_8
331 case OS_STAT_PEND_TO:
332 default:
333 *perr = OS_ERR_TIMEOUT; /* Indicate that didn't get event within TO */
\ 000000B6 0A20 MOVS R0,#+10
\ 000000B8 2870 STRB R0,[R5, #+0]
\ 000000BA 07E0 B.N ??OSSemPend_0
334 break;
335
336 case OS_STAT_PEND_ABORT:
337 *perr = OS_ERR_PEND_ABORT; /* Indicate that we aborted */
\ ??OSSemPend_8:
\ 000000BC 0E20 MOVS R0,#+14
\ 000000BE 2870 STRB R0,[R5, #+0]
\ 000000C0 04E0 B.N ??OSSemPend_0
338 break;
339 }
340 return;
341 }
342 OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;
\ ??OSSemPend_7:
\ 000000C2 0760 STR R7,[R0, #+0]
343 OS_EXIT_CRITICAL();
\ 000000C4 3000 MOVS R0,R6
\ 000000C6 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
344 *perr = OS_ERR_NONE;
\ 000000CA 2F70 STRB R7,[R5, #+0]
345 }
\ ??OSSemPend_0:
\ 000000CC BDE8F083 POP {R4-R9,PC} ;; return
\ ??OSSemPend_4:
\ 000000D0 ........ DC32 OSLockNesting
\ 000000D4 ........ DC32 OSTCBCur
346
347 /*$PAGE*/
348 /*
349 *********************************************************************************************************
350 * ABORT WAITING ON A SEMAPHORE
351 *
352 * Description: This function aborts & readies any tasks currently waiting on a semaphore. This function
353 * should be used to fault-abort the wait on the semaphore, rather than to normally signal
354 * the semaphore via OSSemPost().
355 *
356 * Arguments : pevent is a pointer to the event control block associated with the desired
357 * semaphore.
358 *
359 * opt determines the type of ABORT performed:
360 * OS_PEND_OPT_NONE ABORT wait for a single task (HPT) waiting on the
361 * semaphore
362 * OS_PEND_OPT_BROADCAST ABORT wait for ALL tasks that are waiting on the
363 * semaphore
364 *
365 * perr is a pointer to where an error message will be deposited. Possible error
366 * messages are:
367 *
368 * OS_ERR_NONE No tasks were waiting on the semaphore.
369 * OS_ERR_PEND_ABORT At least one task waiting on the semaphore was readied
370 * and informed of the aborted wait; check return value
371 * for the number of tasks whose wait on the semaphore
372 * was aborted.
373 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a semaphore.
374 * OS_ERR_PEVENT_NULL If 'pevent' is a NULL pointer.
375 *
376 * Returns : == 0 if no tasks were waiting on the semaphore, or upon error.
377 * > 0 if one or more tasks waiting on the semaphore are now readied and informed.
378 *********************************************************************************************************
379 */
380
381 #if OS_SEM_PEND_ABORT_EN > 0
\ In segment CODE, align 4, keep-with-next
382 INT8U OSSemPendAbort (OS_EVENT *pevent, INT8U opt, INT8U *perr)
383 {
\ OSSemPendAbort:
\ 00000000 2DE9F043 PUSH {R4-R9,LR}
\ 00000004 8846 MOV R8,R1
\ 00000006 0400 MOVS R4,R0
\ 00000008 1500 MOVS R5,R2
384 INT8U nbr_tasks;
385 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
386 OS_CPU_SR cpu_sr = 0;
387 #endif
388
389
390
391 #if OS_ARG_CHK_EN > 0
392 if (perr == (INT8U *)0) { /* Validate 'perr' */
\ 0000000A 02D1 BNE.N ??OSSemPendAbort_0
393 return (0);
\ ??OSSemPendAbort_1:
\ 0000000C 0020 MOVS R0,#+0
\ ??OSSemPendAbort_2:
\ 0000000E BDE8F083 POP {R4-R9,PC} ;; return
394 }
395 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
\ ??OSSemPendAbort_0:
\ 00000012 002C CMP R4,#+0
\ 00000014 02D1 BNE.N ??OSSemPendAbort_3
396 *perr = OS_ERR_PEVENT_NULL;
\ 00000016 0420 MOVS R0,#+4
\ 00000018 2870 STRB R0,[R5, #+0]
\ 0000001A F7E7 B.N ??OSSemPendAbort_1
397 return (0);
398 }
399 #endif
400 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
\ ??OSSemPendAbort_3:
\ 0000001C 0120 MOVS R0,#+1
\ 0000001E 8146 MOV R9,R0
\ 00000020 2078 LDRB R0,[R4, #+0]
\ 00000022 0328 CMP R0,#+3
\ 00000024 02D0 BEQ.N ??OSSemPendAbort_4
401 *perr = OS_ERR_EVENT_TYPE;
\ 00000026 4846 MOV R0,R9
\ 00000028 2870 STRB R0,[R5, #+0]
\ 0000002A EFE7 B.N ??OSSemPendAbort_1
402 return (0);
403 }
404 OS_ENTER_CRITICAL();
\ ??OSSemPendAbort_4:
\ 0000002C ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000030 0600 MOVS R6,R0
405 if (pevent->OSEventGrp != 0) { /* See if any task waiting on semaphore? */
\ 00000032 0027 MOVS R7,#+0
\ 00000034 A07A LDRB R0,[R4, #+10]
\ 00000036 0028 CMP R0,#+0
\ 00000038 1ED0 BEQ.N ??OSSemPendAbort_5
406 nbr_tasks = 0;
407 switch (opt) {
\ 0000003A 4046 MOV R0,R8
\ 0000003C 0128 CMP R0,#+1
\ 0000003E 0BD1 BNE.N ??OSSemPendAbort_6
408 case OS_PEND_OPT_BROADCAST: /* Do we need to abort ALL waiting tasks? */
409 while (pevent->OSEventGrp != 0) { /* Yes, ready ALL tasks waiting on semaphore */
\ ??OSSemPendAbort_7:
\ 00000040 A07A LDRB R0,[R4, #+10]
\ 00000042 0028 CMP R0,#+0
\ 00000044 0FD0 BEQ.N ??OSSemPendAbort_8
410 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_ABORT);
\ 00000046 0223 MOVS R3,#+2
\ 00000048 4A46 MOV R2,R9
\ 0000004A 0021 MOVS R1,#+0
\ 0000004C 2000 MOVS R0,R4
\ 0000004E ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
411 nbr_tasks++;
\ 00000052 7F1C ADDS R7,R7,#+1
\ 00000054 FFB2 UXTB R7,R7
\ 00000056 F3E7 B.N ??OSSemPendAbort_7
412 }
413 break;
414
415 case OS_PEND_OPT_NONE: /* No, ready HPT waiting on semaphore */
416 default:
417 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_ABORT);
\ ??OSSemPendAbort_6:
\ 00000058 0223 MOVS R3,#+2
\ 0000005A 4A46 MOV R2,R9
\ 0000005C 3946 MOV R1,R7
\ 0000005E 2000 MOVS R0,R4
\ 00000060 ........ _BLF OS_EventTaskRdy,??OS_EventTaskRdy??rT
418 nbr_tasks++;
\ 00000064 4F46 MOV R7,R9
419 break;
420 }
421 OS_EXIT_CRITICAL();
\ ??OSSemPendAbort_8:
\ 00000066 3000 MOVS R0,R6
\ 00000068 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
422 OS_Sched(); /* Find HPT ready to run */
\ 0000006C ........ _BLF OS_Sched,??OS_Sched??rT
423 *perr = OS_ERR_PEND_ABORT;
\ 00000070 0E20 MOVS R0,#+14
\ 00000072 2870 STRB R0,[R5, #+0]
424 return (nbr_tasks);
\ 00000074 3800 MOVS R0,R7
\ 00000076 CAE7 B.N ??OSSemPendAbort_2
425 }
426 OS_EXIT_CRITICAL();
\ ??OSSemPendAbort_5:
\ 00000078 3000 MOVS R0,R6
\ 0000007A ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
427 *perr = OS_ERR_NONE;
\ 0000007E 2F70 STRB R7,[R5, #+0]
\ 00000080 C4E7 B.N ??OSSemPendAbort_1
428 return (0); /* No tasks waiting on semaphore */
429 }
430 #endif
431
432 /*$PAGE*/
433 /*
434 *********************************************************************************************************
435 * POST TO A SEMAPHORE
436 *
437 * Description: This function signals a semaphore
438 *
439 * Arguments : pevent is a pointer to the event control block associated with the desired
440 * semaphore.
441 *
442 * Returns : OS_ERR_NONE The call was successful and the semaphore was signaled.
443 * OS_ERR_SEM_OVF If the semaphore count exceeded its limit. In other words, you have
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -