diff --git a/CMSIS/RTOS2/RTX/Include/rtx_evr.h b/CMSIS/RTOS2/RTX/Include/rtx_evr.h index 1dec30a79f..6d59289da0 100644 --- a/CMSIS/RTOS2/RTX/Include/rtx_evr.h +++ b/CMSIS/RTOS2/RTX/Include/rtx_evr.h @@ -872,9 +872,9 @@ extern void EvrRtxDelayUntil (uint32_t ticks); \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value. */ #if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_STARTED_DISABLE)) -extern void EvrRtxDelayStarted (uint32_t ticks); +extern void EvrRtxDelayStarted (uint32_t ticks, osThreadId_t thread_id); #else -#define EvrRtxDelayStarted(ticks) +#define EvrRtxDelayStarted(ticks, thread_id) #endif /** @@ -882,9 +882,9 @@ extern void EvrRtxDelayStarted (uint32_t ticks); \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value. */ #if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_UNTIL_STARTED_DISABLE)) -extern void EvrRtxDelayUntilStarted (uint32_t ticks); +extern void EvrRtxDelayUntilStarted (uint32_t ticks, osThreadId_t thread_id); #else -#define EvrRtxDelayUntilStarted(ticks) +#define EvrRtxDelayUntilStarted(ticks, thread_id) #endif /** diff --git a/CMSIS/RTOS2/RTX/RTX5.scvd b/CMSIS/RTOS2/RTX/RTX5.scvd index 47659b1745..3957ed8a0d 100644 --- a/CMSIS/RTOS2/RTX/RTX5.scvd +++ b/CMSIS/RTOS2/RTX/RTX5.scvd @@ -1,6 +1,6 @@ - + @@ -1468,8 +1468,8 @@ - - + + diff --git a/CMSIS/RTOS2/RTX/Source/rtx_delay.c b/CMSIS/RTOS2/RTX/Source/rtx_delay.c index 9d0cf414bf..3768b8b091 100644 --- a/CMSIS/RTOS2/RTX/Source/rtx_delay.c +++ b/CMSIS/RTOS2/RTX/Source/rtx_delay.c @@ -31,10 +31,14 @@ /// Wait for Timeout (Time Delay). /// \note API identical to osDelay static osStatus_t svcRtxDelay (uint32_t ticks) { + os_thread_t *thread; if (ticks != 0U) { + // Get running thread + thread = osRtxThreadGetRunning(); + if (osRtxThreadWaitEnter(osRtxThreadWaitingDelay, ticks)) { - EvrRtxDelayStarted(ticks); + EvrRtxDelayStarted(ticks, thread); } else { EvrRtxDelayCompleted(osRtxThreadGetRunning()); } @@ -46,6 +50,7 @@ static osStatus_t svcRtxDelay (uint32_t ticks) { /// Wait until specified time. /// \note API identical to osDelayUntil static osStatus_t svcRtxDelayUntil (uint32_t ticks) { + os_thread_t *thread; ticks -= osRtxInfo.kernel.tick; if ((ticks == 0U) || (ticks > 0x7FFFFFFFU)) { @@ -54,8 +59,11 @@ static osStatus_t svcRtxDelayUntil (uint32_t ticks) { return osErrorParameter; } + // Get running thread + thread = osRtxThreadGetRunning(); + if (osRtxThreadWaitEnter(osRtxThreadWaitingDelay, ticks)) { - EvrRtxDelayUntilStarted(ticks); + EvrRtxDelayUntilStarted(ticks, thread); } else { EvrRtxDelayCompleted(osRtxThreadGetRunning()); } diff --git a/CMSIS/RTOS2/RTX/Source/rtx_evr.c b/CMSIS/RTOS2/RTX/Source/rtx_evr.c index 042d254270..9204e5ff81 100644 --- a/CMSIS/RTOS2/RTX/Source/rtx_evr.c +++ b/CMSIS/RTOS2/RTX/Source/rtx_evr.c @@ -1011,9 +1011,9 @@ __WEAK void EvrRtxDelayUntil (uint32_t ticks) { #endif #if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_STARTED_DISABLE)) -__WEAK void EvrRtxDelayStarted (uint32_t ticks) { +__WEAK void EvrRtxDelayStarted (uint32_t ticks, osThreadId_t thread_id) { #if defined(RTE_Compiler_EventRecorder) - (void)EventRecord2(EvtRtxDelayStarted, ticks, 0U); + (void)EventRecord2(EvtRtxDelayStarted, ticks, thread_id); #else (void)ticks; #endif @@ -1021,9 +1021,9 @@ __WEAK void EvrRtxDelayStarted (uint32_t ticks) { #endif #if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_UNTIL_STARTED_DISABLE)) -__WEAK void EvrRtxDelayUntilStarted (uint32_t ticks) { +__WEAK void EvrRtxDelayUntilStarted (uint32_t ticks, osThreadId_t thread_id) { #if defined(RTE_Compiler_EventRecorder) - (void)EventRecord2(EvtRtxDelayUntilStarted, ticks, 0U); + (void)EventRecord2(EvtRtxDelayUntilStarted, ticks, thread_id); #else (void)ticks; #endif