Introduce vTaskInternalSetTimeOutState() which does not have a critical section, and add a critical section to the public version of the same.

pull/4/head
Richard Barry 8 years ago
parent 9b213e8c34
commit c3acc441ac

@ -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

@ -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;

@ -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.

@ -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

@ -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

@ -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

Loading…
Cancel
Save