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