mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-24 23:42:10 -04:00
Introduce vTaskInternalSetTimeOutState() which does not have a critical section, and add a critical section to the public version of the same.
This commit is contained in:
parent
9b213e8c34
commit
c3acc441ac
|
@ -2364,6 +2364,13 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;
|
||||||
*/
|
*/
|
||||||
void *pvTaskIncrementMutexHeldCount( 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -548,7 +548,7 @@ void xPortSysTickHandler( void )
|
||||||
void vPortSetupTimerInterrupt( void )
|
void vPortSetupTimerInterrupt( void )
|
||||||
{
|
{
|
||||||
/* Calculate the constants required to configure the tick interrupt. */
|
/* 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 );
|
ulTimerCountsForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ );
|
||||||
xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;
|
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
|
All rights reserved
|
||||||
|
|
||||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
|
@ -132,12 +132,12 @@ FreeRTOS_IRQ_Handler
|
||||||
AND r2, r2, #4
|
AND r2, r2, #4
|
||||||
SUB sp, sp, r2
|
SUB sp, sp, r2
|
||||||
|
|
||||||
PUSH {r0-r3, lr}
|
PUSH {r0-r4, lr}
|
||||||
|
|
||||||
; Call the port part specific handler.
|
; Call the port part specific handler.
|
||||||
LDR r0, =vApplicationIRQHandler
|
LDR r0, =vApplicationIRQHandler
|
||||||
BLX r0
|
BLX r0
|
||||||
POP {r0-r3, lr}
|
POP {r0-r4, lr}
|
||||||
ADD sp, sp, r2
|
ADD sp, sp, r2
|
||||||
|
|
||||||
CPSID i
|
CPSID i
|
||||||
|
|
|
@ -891,7 +891,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
||||||
{
|
{
|
||||||
/* The queue was full and a block time was specified so
|
/* The queue was full and a block time was specified so
|
||||||
configure the timeout structure. */
|
configure the timeout structure. */
|
||||||
vTaskSetTimeOutState( &xTimeOut );
|
vTaskInternalSetTimeOutState( &xTimeOut );
|
||||||
xEntryTimeSet = pdTRUE;
|
xEntryTimeSet = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1346,7 +1346,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
||||||
{
|
{
|
||||||
/* The queue was empty and a block time was specified so
|
/* The queue was empty and a block time was specified so
|
||||||
configure the timeout structure. */
|
configure the timeout structure. */
|
||||||
vTaskSetTimeOutState( &xTimeOut );
|
vTaskInternalSetTimeOutState( &xTimeOut );
|
||||||
xEntryTimeSet = pdTRUE;
|
xEntryTimeSet = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1502,7 +1502,11 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
||||||
/* For inheritance to have occurred there must have been an
|
/* For inheritance to have occurred there must have been an
|
||||||
initial timeout, and an adjusted timeout cannot become 0, as
|
initial timeout, and an adjusted timeout cannot become 0, as
|
||||||
if it were 0 the function would have exited. */
|
if it were 0 the function would have exited. */
|
||||||
|
#if( configUSE_MUTEXES == 1 )
|
||||||
|
{
|
||||||
configASSERT( xInheritanceOccurred == pdFALSE );
|
configASSERT( xInheritanceOccurred == pdFALSE );
|
||||||
|
}
|
||||||
|
#endif /* configUSE_MUTEXES */
|
||||||
|
|
||||||
/* The semaphore count was 0 and no block time is specified
|
/* The semaphore count was 0 and no block time is specified
|
||||||
(or the block time has expired) so exit now. */
|
(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
|
/* The semaphore count was 0 and a block time was specified
|
||||||
so configure the timeout structure ready to block. */
|
so configure the timeout structure ready to block. */
|
||||||
vTaskSetTimeOutState( &xTimeOut );
|
vTaskInternalSetTimeOutState( &xTimeOut );
|
||||||
xEntryTimeSet = pdTRUE;
|
xEntryTimeSet = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1711,7 +1715,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
||||||
/* The queue was empty and a block time was specified so
|
/* The queue was empty and a block time was specified so
|
||||||
configure the timeout structure ready to enter the blocked
|
configure the timeout structure ready to enter the blocked
|
||||||
state. */
|
state. */
|
||||||
vTaskSetTimeOutState( &xTimeOut );
|
vTaskInternalSetTimeOutState( &xTimeOut );
|
||||||
xEntryTimeSet = pdTRUE;
|
xEntryTimeSet = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -3123,6 +3123,18 @@ TCB_t *pxUnblockedTCB;
|
||||||
void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut )
|
void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut )
|
||||||
{
|
{
|
||||||
configASSERT( 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->xOverflowCount = xNumOfOverflows;
|
||||||
pxTimeOut->xTimeOnEntering = xTickCount;
|
pxTimeOut->xTimeOnEntering = xTickCount;
|
||||||
}
|
}
|
||||||
|
@ -3176,7 +3188,7 @@ BaseType_t xReturn;
|
||||||
{
|
{
|
||||||
/* Not a genuine timeout. Adjust parameters for time remaining. */
|
/* Not a genuine timeout. Adjust parameters for time remaining. */
|
||||||
*pxTicksToWait -= xElapsedTime;
|
*pxTicksToWait -= xElapsedTime;
|
||||||
vTaskSetTimeOutState( pxTimeOut );
|
vTaskInternalSetTimeOutState( pxTimeOut );
|
||||||
xReturn = pdFALSE;
|
xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue