From: rtel Date: Fri, 24 Feb 2017 02:16:54 +0000 (+0000) Subject: Introduce vTaskInternalSetTimeOutState() which does not have a critical section,... X-Git-Tag: V10.0.0~33 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=536ea7c7ffbb091d458c71bef7defc17016db840;p=freertos Introduce vTaskInternalSetTimeOutState() which does not have a critical section, and add a critical section to the public version of the same. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2486 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Source/include/task.h b/FreeRTOS/Source/include/task.h index c8e7c355c..0f979f853 100644 --- a/FreeRTOS/Source/include/task.h +++ b/FreeRTOS/Source/include/task.h @@ -2364,6 +2364,13 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION; */ void *pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION; +/* + * For internal use only. Same as vTaskSetTimeOutState(), but without a critial + * section. + */ +void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION; + + #ifdef __cplusplus } #endif diff --git a/FreeRTOS/Source/portable/CCS/ARM_CM3/port.c b/FreeRTOS/Source/portable/CCS/ARM_CM3/port.c index 83e5e0574..7ec544e04 100644 --- a/FreeRTOS/Source/portable/CCS/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/CCS/ARM_CM3/port.c @@ -548,7 +548,7 @@ void xPortSysTickHandler( void ) void vPortSetupTimerInterrupt( void ) { /* Calculate the constants required to configure the tick interrupt. */ - #if configUSE_TICKLESS_IDLE == 1 + #if( configUSE_TICKLESS_IDLE == 1 ) { ulTimerCountsForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ); xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick; diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c index 856ff0d29..f61ce66ea 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. + FreeRTOS V9.0.1 - Copyright (C) 2017 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/portASM.s b/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/portASM.s index c08875cba..69b6b2f29 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/portASM.s +++ b/FreeRTOS/Source/portable/IAR/ARM_CA5_No_GIC/portASM.s @@ -132,12 +132,12 @@ FreeRTOS_IRQ_Handler AND r2, r2, #4 SUB sp, sp, r2 - PUSH {r0-r3, lr} + PUSH {r0-r4, lr} ; Call the port part specific handler. LDR r0, =vApplicationIRQHandler BLX r0 - POP {r0-r3, lr} + POP {r0-r4, lr} ADD sp, sp, r2 CPSID i diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index 9fbe6ba98..72bdff508 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -891,7 +891,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; { /* The queue was full and a block time was specified so configure the timeout structure. */ - vTaskSetTimeOutState( &xTimeOut ); + vTaskInternalSetTimeOutState( &xTimeOut ); xEntryTimeSet = pdTRUE; } else @@ -1346,7 +1346,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; { /* The queue was empty and a block time was specified so configure the timeout structure. */ - vTaskSetTimeOutState( &xTimeOut ); + vTaskInternalSetTimeOutState( &xTimeOut ); xEntryTimeSet = pdTRUE; } else @@ -1502,7 +1502,11 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* For inheritance to have occurred there must have been an initial timeout, and an adjusted timeout cannot become 0, as if it were 0 the function would have exited. */ - configASSERT( xInheritanceOccurred == pdFALSE ); + #if( configUSE_MUTEXES == 1 ) + { + configASSERT( xInheritanceOccurred == pdFALSE ); + } + #endif /* configUSE_MUTEXES */ /* The semaphore count was 0 and no block time is specified (or the block time has expired) so exit now. */ @@ -1514,7 +1518,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; { /* The semaphore count was 0 and a block time was specified so configure the timeout structure ready to block. */ - vTaskSetTimeOutState( &xTimeOut ); + vTaskInternalSetTimeOutState( &xTimeOut ); xEntryTimeSet = pdTRUE; } else @@ -1711,7 +1715,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue; /* The queue was empty and a block time was specified so configure the timeout structure ready to enter the blocked state. */ - vTaskSetTimeOutState( &xTimeOut ); + vTaskInternalSetTimeOutState( &xTimeOut ); xEntryTimeSet = pdTRUE; } else diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 6cf5ed861..76abb9e7c 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -3123,6 +3123,18 @@ TCB_t *pxUnblockedTCB; void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) { configASSERT( pxTimeOut ); + taskENTER_CRITICAL(); + { + pxTimeOut->xOverflowCount = xNumOfOverflows; + pxTimeOut->xTimeOnEntering = xTickCount; + } + taskEXIT_CRITICAL(); +} +/*-----------------------------------------------------------*/ + +void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) +{ + /* For internal use only as it does not use a critical section. */ pxTimeOut->xOverflowCount = xNumOfOverflows; pxTimeOut->xTimeOnEntering = xTickCount; } @@ -3176,7 +3188,7 @@ BaseType_t xReturn; { /* Not a genuine timeout. Adjust parameters for time remaining. */ *pxTicksToWait -= xElapsedTime; - vTaskSetTimeOutState( pxTimeOut ); + vTaskInternalSetTimeOutState( pxTimeOut ); xReturn = pdFALSE; } else