|
|
@ -1429,32 +1429,56 @@ portTickType xTimeToWake;
|
|
|
|
exclusive access to the ready lists as the scheduler is locked. */
|
|
|
|
exclusive access to the ready lists as the scheduler is locked. */
|
|
|
|
vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
|
|
|
|
|
|
|
|
if( xTicksToWait == portMAX_DELAY )
|
|
|
|
|
|
|
|
{
|
|
|
|
#if ( INCLUDE_vTaskSuspend == 1 )
|
|
|
|
/* Add ourselves to the suspended task list instead of a delayed task
|
|
|
|
{
|
|
|
|
list to ensure we are not woken by a timing event. We will block
|
|
|
|
if( xTicksToWait == portMAX_DELAY )
|
|
|
|
indefinitely. */
|
|
|
|
|
|
|
|
vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Calculate the time at which the task should be woken if the event does
|
|
|
|
|
|
|
|
not occur. This may overflow but this doesn't matter. */
|
|
|
|
|
|
|
|
xTimeToWake = xTickCount + xTicksToWait;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( xTimeToWake < xTickCount )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Wake time has overflowed. Place this item in the overflow list. */
|
|
|
|
/* Add ourselves to the suspended task list instead of a delayed task
|
|
|
|
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
list to ensure we are not woken by a timing event. We will block
|
|
|
|
|
|
|
|
indefinitely. */
|
|
|
|
|
|
|
|
vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* The wake time has not overflowed, so we can use the current block list. */
|
|
|
|
/* Calculate the time at which the task should be woken if the event does
|
|
|
|
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
not occur. This may overflow but this doesn't matter. */
|
|
|
|
|
|
|
|
xTimeToWake = xTickCount + xTicksToWait;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( xTimeToWake < xTickCount )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Wake time has overflowed. Place this item in the overflow list. */
|
|
|
|
|
|
|
|
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* The wake time has not overflowed, so we can use the current block list. */
|
|
|
|
|
|
|
|
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Calculate the time at which the task should be woken if the event does
|
|
|
|
|
|
|
|
not occur. This may overflow but this doesn't matter. */
|
|
|
|
|
|
|
|
xTimeToWake = xTickCount + xTicksToWait;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( xTimeToWake < xTickCount )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Wake time has overflowed. Place this item in the overflow list. */
|
|
|
|
|
|
|
|
vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* The wake time has not overflowed, so we can use the current block list. */
|
|
|
|
|
|
|
|
vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|