mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-07-10 13:29:45 -04:00
fix: Add MPU wrapper for xTimerDelete API (#1412)
When using MPU wrappers v2, xTimerDelete needs to be a real function rather than a macro so that the kernel object pool index can be freed after the timer is successfully deleted. Without this, deleting a timer leaks the kernel object pool entry. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
parent
ae46383c90
commit
a50edad08b
4 changed files with 44 additions and 1 deletions
|
|
@ -3890,6 +3890,40 @@
|
|||
#endif /* if ( configUSE_TIMERS == 1 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_TIMERS == 1 )
|
||||
|
||||
BaseType_t MPU_xTimerDelete( TimerHandle_t xTimer, TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */
|
||||
{
|
||||
BaseType_t xReturn = pdFALSE;
|
||||
TimerHandle_t xInternalTimerHandle = NULL;
|
||||
int32_t lIndex;
|
||||
|
||||
lIndex = ( int32_t ) xTimer;
|
||||
|
||||
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
|
||||
{
|
||||
xInternalTimerHandle = MPU_GetTimerHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
|
||||
|
||||
if( xInternalTimerHandle != NULL )
|
||||
{
|
||||
xReturn = xTimerGenericCommandFromTask( xInternalTimerHandle,
|
||||
tmrCOMMAND_DELETE,
|
||||
0U, /* xOptionalValue */
|
||||
NULL, /* pxHigherPriorityTaskWoken */
|
||||
xTicksToWait );
|
||||
if( xReturn != pdFALSE )
|
||||
{
|
||||
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( configUSE_TIMERS == 1 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* MPU wrappers for event group APIs. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue