|
|
|
@ -339,25 +339,7 @@ count overflows. */
|
|
|
|
|
pxDelayedTaskList = pxOverflowDelayedTaskList; \
|
|
|
|
|
pxOverflowDelayedTaskList = pxTemp; \
|
|
|
|
|
xNumOfOverflows++; \
|
|
|
|
|
\
|
|
|
|
|
if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE ) \
|
|
|
|
|
{ \
|
|
|
|
|
/* The new current delayed list is empty. Set \
|
|
|
|
|
xNextTaskUnblockTime to the maximum possible value so it is \
|
|
|
|
|
extremely unlikely that the \
|
|
|
|
|
if( xTickCount >= xNextTaskUnblockTime ) test will pass until \
|
|
|
|
|
there is an item in the delayed list. */ \
|
|
|
|
|
xNextTaskUnblockTime = portMAX_DELAY; \
|
|
|
|
|
} \
|
|
|
|
|
else \
|
|
|
|
|
{ \
|
|
|
|
|
/* The new current delayed list is not empty, get the value of \
|
|
|
|
|
the item at the head of the delayed list. This is the time at \
|
|
|
|
|
which the task at the head of the delayed list should be removed \
|
|
|
|
|
from the Blocked state. */ \
|
|
|
|
|
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ); \
|
|
|
|
|
xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) ); \
|
|
|
|
|
} \
|
|
|
|
|
prvResetNextTaskUnblockTime(); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
@ -483,6 +465,14 @@ static tskTCB *prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TY
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Set xNextTaskUnblockTime to the time at which the next Blocked state task
|
|
|
|
|
* will exit the Blocked state.
|
|
|
|
|
*/
|
|
|
|
|
static void prvResetNextTaskUnblockTime( void );
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions )
|
|
|
|
|
{
|
|
|
|
|
signed portBASE_TYPE xReturn;
|
|
|
|
@ -697,10 +687,9 @@ tskTCB * pxNewTCB;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Reset the next expected unblock time in case it referred to the task
|
|
|
|
|
that has just been deleted. */
|
|
|
|
|
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList );
|
|
|
|
|
xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) );
|
|
|
|
|
/* Reset the next expected unblock time in case it referred to
|
|
|
|
|
the task that has just been deleted. */
|
|
|
|
|
prvResetNextTaskUnblockTime();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1124,11 +1113,10 @@ tskTCB * pxNewTCB;
|
|
|
|
|
{
|
|
|
|
|
if( xSchedulerRunning != pdFALSE )
|
|
|
|
|
{
|
|
|
|
|
/* A task other than the currently running task was suspended, reset
|
|
|
|
|
the next expected unblock time in case it referred to the task that
|
|
|
|
|
is now in the Suspended state. */
|
|
|
|
|
pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList );
|
|
|
|
|
xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) );
|
|
|
|
|
/* A task other than the currently running task was suspended,
|
|
|
|
|
reset the next expected unblock time in case it referred to the
|
|
|
|
|
task that is now in the Suspended state. */
|
|
|
|
|
prvResetNextTaskUnblockTime();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2782,6 +2770,31 @@ tskTCB *pxNewTCB;
|
|
|
|
|
#endif /* INCLUDE_vTaskDelete */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
static void prvResetNextTaskUnblockTime( void )
|
|
|
|
|
{
|
|
|
|
|
tskTCB *pxTCB;
|
|
|
|
|
|
|
|
|
|
if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE )
|
|
|
|
|
{
|
|
|
|
|
/* The new current delayed list is empty. Set
|
|
|
|
|
xNextTaskUnblockTime to the maximum possible value so it is
|
|
|
|
|
extremely unlikely that the
|
|
|
|
|
if( xTickCount >= xNextTaskUnblockTime ) test will pass until
|
|
|
|
|
there is an item in the delayed list. */
|
|
|
|
|
xNextTaskUnblockTime = portMAX_DELAY;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The new current delayed list is not empty, get the value of
|
|
|
|
|
the item at the head of the delayed list. This is the time at
|
|
|
|
|
which the task at the head of the delayed list should be removed
|
|
|
|
|
from the Blocked state. */
|
|
|
|
|
( pxTCB ) = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList );
|
|
|
|
|
xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( ( pxTCB )->xGenericListItem ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
|
|
|
|
|
|
|
|
|
|
xTaskHandle xTaskGetCurrentTaskHandle( void )
|
|
|
|
|