📄 os_mutex.lst
字号:
338 pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free list */
\ 00000088 ........ LDR.W R0,??DataTable7_3
\ 0000008C 0068 LDR R0,[R0, #+0]
\ 0000008E CBF80400 STR R0,[R11, #+4]
339 pevent->OSEventCnt = 0u;
\ 00000092 0020 MOVS R0,#+0
\ 00000094 ABF80800 STRH R0,[R11, #+8]
340 OSEventFreeList = pevent;
\ 00000098 ........ LDR.W R0,??DataTable7_3
\ 0000009C C0F800B0 STR R11,[R0, #+0]
341 OS_EXIT_CRITICAL();
\ 000000A0 5046 MOV R0,R10
\ 000000A2 ........ BL OS_CPU_SR_Restore
342 *perr = OS_ERR_NONE;
\ 000000A6 0020 MOVS R0,#+0
\ 000000A8 2870 STRB R0,[R5, #+0]
343 pevent_return = (OS_EVENT *)0; /* Mutex has been deleted */
\ 000000AA 0020 MOVS R0,#+0
\ 000000AC 0700 MOVS R7,R0
\ 000000AE 05E0 B.N ??OSMutexDel_10
344 } else {
345 OS_EXIT_CRITICAL();
\ ??OSMutexDel_8:
\ 000000B0 5046 MOV R0,R10
\ 000000B2 ........ BL OS_CPU_SR_Restore
346 *perr = OS_ERR_TASK_WAITING;
\ 000000B6 4920 MOVS R0,#+73
\ 000000B8 2870 STRB R0,[R5, #+0]
347 pevent_return = pevent;
\ 000000BA 5F46 MOV R7,R11
348 }
349 break;
\ ??OSMutexDel_10:
\ 000000BC 5FE0 B.N ??OSMutexDel_11
350
351 case OS_DEL_ALWAYS: /* ALWAYS DELETE THE MUTEX ---------------- */
352 pcp = (INT8U)(pevent->OSEventCnt >> 8u); /* Get PCP of mutex */
\ ??OSMutexDel_6:
\ 000000BE BBF80800 LDRH R0,[R11, #+8]
\ 000000C2 80B2 UXTH R0,R0 ;; ZeroExt R0,R0,#+16,#+16
\ 000000C4 000A LSRS R0,R0,#+8
\ 000000C6 8046 MOV R8,R0
353 if (pcp != OS_PRIO_MUTEX_CEIL_DIS) {
\ 000000C8 5FFA88F8 UXTB R8,R8 ;; ZeroExt R8,R8,#+24,#+24
\ 000000CC B8F1FF0F CMP R8,#+255
\ 000000D0 14D0 BEQ.N ??OSMutexDel_12
354 prio = (INT8U)(pevent->OSEventCnt & OS_MUTEX_KEEP_LOWER_8); /* Get owner's orig prio */
\ 000000D2 BBF80800 LDRH R0,[R11, #+8]
\ 000000D6 8DF80000 STRB R0,[SP, #+0]
355 ptcb = (OS_TCB *)pevent->OSEventPtr;
\ 000000DA DBF80400 LDR R0,[R11, #+4]
\ 000000DE 8146 MOV R9,R0
356 if (ptcb != (OS_TCB *)0) { /* See if any task owns the mutex */
\ 000000E0 B9F1000F CMP R9,#+0
\ 000000E4 0AD0 BEQ.N ??OSMutexDel_12
357 if (ptcb->OSTCBPrio == pcp) { /* See if original prio was changed */
\ 000000E6 99F83600 LDRB R0,[R9, #+54]
\ 000000EA 5FFA88F8 UXTB R8,R8 ;; ZeroExt R8,R8,#+24,#+24
\ 000000EE 4045 CMP R0,R8
\ 000000F0 04D1 BNE.N ??OSMutexDel_12
358 OSMutex_RdyAtPrio(ptcb, prio); /* Yes, Restore the task's original prio */
\ 000000F2 9DF80010 LDRB R1,[SP, #+0]
\ 000000F6 4846 MOV R0,R9
\ 000000F8 ........ BL OSMutex_RdyAtPrio
359 }
360 }
361 }
362 while (pevent->OSEventGrp != 0u) { /* Ready ALL tasks waiting for mutex */
\ ??OSMutexDel_12:
\ 000000FC 9BF80A00 LDRB R0,[R11, #+10]
\ 00000100 0028 CMP R0,#+0
\ 00000102 06D0 BEQ.N ??OSMutexDel_13
363 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MUTEX, OS_STAT_PEND_OK);
\ 00000104 0023 MOVS R3,#+0
\ 00000106 1022 MOVS R2,#+16
\ 00000108 0021 MOVS R1,#+0
\ 0000010A 5846 MOV R0,R11
\ 0000010C ........ BL OS_EventTaskRdy
\ 00000110 F4E7 B.N ??OSMutexDel_12
364 }
365 #if OS_EVENT_NAME_EN > 0u
366 pevent->OSEventName = (INT8U *)(void *)"?";
\ ??OSMutexDel_13:
\ 00000112 .... ADR.N R0,??DataTable3 ;; "\?"
\ 00000114 CBF81400 STR R0,[R11, #+20]
367 #endif
368 pcp = (INT8U)(pevent->OSEventCnt >> 8u);
\ 00000118 BBF80800 LDRH R0,[R11, #+8]
\ 0000011C 80B2 UXTH R0,R0 ;; ZeroExt R0,R0,#+16,#+16
\ 0000011E 000A LSRS R0,R0,#+8
\ 00000120 8046 MOV R8,R0
369 if (pcp != OS_PRIO_MUTEX_CEIL_DIS) {
\ 00000122 5FFA88F8 UXTB R8,R8 ;; ZeroExt R8,R8,#+24,#+24
\ 00000126 B8F1FF0F CMP R8,#+255
\ 0000012A 06D0 BEQ.N ??OSMutexDel_14
370 OSTCBPrioTbl[pcp] = (OS_TCB *)0; /* Free up the PCP */
\ 0000012C 5FFA88F8 UXTB R8,R8 ;; ZeroExt R8,R8,#+24,#+24
\ 00000130 ........ LDR.W R0,??DataTable7_2
\ 00000134 0021 MOVS R1,#+0
\ 00000136 40F82810 STR R1,[R0, R8, LSL #+2]
371 }
372 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
\ ??OSMutexDel_14:
\ 0000013A 0020 MOVS R0,#+0
\ 0000013C 8BF80000 STRB R0,[R11, #+0]
373 pevent->OSEventPtr = OSEventFreeList; /* Return Event Control Block to free list */
\ 00000140 ........ LDR.W R0,??DataTable7_3
\ 00000144 0068 LDR R0,[R0, #+0]
\ 00000146 CBF80400 STR R0,[R11, #+4]
374 pevent->OSEventCnt = 0u;
\ 0000014A 0020 MOVS R0,#+0
\ 0000014C ABF80800 STRH R0,[R11, #+8]
375 OSEventFreeList = pevent; /* Get next free event control block */
\ 00000150 ........ LDR.W R0,??DataTable7_3
\ 00000154 C0F800B0 STR R11,[R0, #+0]
376 OS_EXIT_CRITICAL();
\ 00000158 5046 MOV R0,R10
\ 0000015A ........ BL OS_CPU_SR_Restore
377 if (tasks_waiting == OS_TRUE) { /* Reschedule only if task(s) were waiting */
\ 0000015E F6B2 UXTB R6,R6 ;; ZeroExt R6,R6,#+24,#+24
\ 00000160 012E CMP R6,#+1
\ 00000162 01D1 BNE.N ??OSMutexDel_15
378 OS_Sched(); /* Find highest priority task ready to run */
\ 00000164 ........ BL OS_Sched
379 }
380 *perr = OS_ERR_NONE;
\ ??OSMutexDel_15:
\ 00000168 0020 MOVS R0,#+0
\ 0000016A 2870 STRB R0,[R5, #+0]
381 pevent_return = (OS_EVENT *)0; /* Mutex has been deleted */
\ 0000016C 0020 MOVS R0,#+0
\ 0000016E 0700 MOVS R7,R0
382 break;
\ 00000170 05E0 B.N ??OSMutexDel_11
383
384 default:
385 OS_EXIT_CRITICAL();
\ ??OSMutexDel_7:
\ 00000172 5046 MOV R0,R10
\ 00000174 ........ BL OS_CPU_SR_Restore
386 *perr = OS_ERR_INVALID_OPT;
\ 00000178 0720 MOVS R0,#+7
\ 0000017A 2870 STRB R0,[R5, #+0]
387 pevent_return = pevent;
\ 0000017C 5F46 MOV R7,R11
388 break;
389 }
390 return (pevent_return);
\ ??OSMutexDel_11:
\ 0000017E 3800 MOVS R0,R7
\ ??OSMutexDel_1:
\ 00000180 BDE8F28F POP {R1,R4-R11,PC} ;; return
391 }
392 #endif
393
394 /*$PAGE*/
395 /*
396 *********************************************************************************************************
397 * PEND ON MUTUAL EXCLUSION SEMAPHORE
398 *
399 * Description: This function waits for a mutual exclusion semaphore.
400 *
401 * Arguments : pevent is a pointer to the event control block associated with the desired
402 * mutex.
403 *
404 * timeout is an optional timeout period (in clock ticks). If non-zero, your task will
405 * wait for the resource up to the amount of time specified by this argument.
406 * If you specify 0, however, your task will wait forever at the specified
407 * mutex or, until the resource becomes available.
408 *
409 * perr is a pointer to where an error message will be deposited. Possible error
410 * messages are:
411 * OS_ERR_NONE The call was successful and your task owns the mutex
412 * OS_ERR_TIMEOUT The mutex was not available within the specified 'timeout'.
413 * OS_ERR_PEND_ABORT The wait on the mutex was aborted.
414 * OS_ERR_EVENT_TYPE If you didn't pass a pointer to a mutex
415 * OS_ERR_PEVENT_NULL 'pevent' is a NULL pointer
416 * OS_ERR_PEND_ISR If you called this function from an ISR and the result
417 * would lead to a suspension.
418 * OS_ERR_PCP_LOWER If the priority of the task that owns the Mutex is
419 * HIGHER (i.e. a lower number) than the PCP. This error
420 * indicates that you did not set the PCP higher (lower
421 * number) than ALL the tasks that compete for the Mutex.
422 * Unfortunately, this is something that could not be
423 * detected when the Mutex is created because we don't know
424 * what tasks will be using the Mutex.
425 * OS_ERR_PEND_LOCKED If you called this function when the scheduler is locked
426 *
427 * Returns : none
428 *
429 * Note(s) : 1) The task that owns the Mutex MUST NOT pend on any other event while it owns the mutex.
430 *
431 * 2) You MUST NOT change the priority of the task that owns the mutex
432 *********************************************************************************************************
433 */
434
\ In section .text, align 2, keep-with-next
435 void OSMutexPend (OS_EVENT *pevent,
436 INT32U timeout,
437 INT8U *perr)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -