/*\r
- FreeRTOS.org V4.1.2 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
See http://www.FreeRTOS.org for documentation, latest information, license\r
and contact details. Please ensure to read the configuration and relevant\r
port sections of the online documentation.\r
+\r
+ Also see http://www.SafeRTOS.com for an IEC 61508 compliant version, along\r
+ with development and support options.\r
***************************************************************************\r
*/\r
\r
\r
Changes from V4.1.2\r
\r
- + Tasks that block with a timeout of portMAX_DELAY are now blocked \r
- indefinitely. Previously portMAX_DELAY was just the longest block time\r
- possible.\r
+ + Tasks that block on events with a timeout of portMAX_DELAY are now\r
+ blocked indefinitely if configINCLUDE_vTaskSuspend is defined. \r
+ Previously portMAX_DELAY was just the longest block time possible.\r
+\r
+Changes from V4.1.3\r
+\r
+ + Very small change made to xTaskCheckForTimeout() as a result of the \r
+ SafeRTOS testing. This corrects the case where the function can return an\r
+ invalid value - but only in an extremely unlikely scenario.\r
*/\r
\r
#include <stdio.h>\r
exclusive access to the ready lists as the scheduler is locked. */\r
vListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
\r
- if( xTicksToWait == portMAX_DELAY )\r
- {\r
- /* Add ourselves to the suspended task list instead of a delayed task\r
- list to ensure we are not woken by a timing event. We will block\r
- indefinitely. */\r
- vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
- }\r
- else\r
- {\r
- /* Calculate the time at which the task should be woken if the event does\r
- not occur. This may overflow but this doesn't matter. */\r
- xTimeToWake = xTickCount + xTicksToWait;\r
- \r
- listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );\r
- \r
- if( xTimeToWake < xTickCount )\r
+\r
+ #if ( INCLUDE_vTaskSuspend == 1 )\r
+ { \r
+ if( xTicksToWait == portMAX_DELAY )\r
{\r
- /* Wake time has overflowed. Place this item in the overflow list. */\r
- vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+ /* Add ourselves to the suspended task list instead of a delayed task\r
+ list to ensure we are not woken by a timing event. We will block\r
+ indefinitely. */\r
+ vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
}\r
else\r
{\r
- /* The wake time has not overflowed, so we can use the current block list. */\r
- vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+ /* Calculate the time at which the task should be woken if the event does\r
+ not occur. This may overflow but this doesn't matter. */\r
+ xTimeToWake = xTickCount + xTicksToWait;\r
+ \r
+ listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );\r
+ \r
+ if( xTimeToWake < xTickCount )\r
+ {\r
+ /* Wake time has overflowed. Place this item in the overflow list. */\r
+ vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+ }\r
+ else\r
+ {\r
+ /* The wake time has not overflowed, so we can use the current block list. */\r
+ vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+ }\r
}\r
}\r
+ #else\r
+ {\r
+ /* Calculate the time at which the task should be woken if the event does\r
+ not occur. This may overflow but this doesn't matter. */\r
+ xTimeToWake = xTickCount + xTicksToWait;\r
+ \r
+ listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xGenericListItem ), xTimeToWake );\r
+ \r
+ if( xTimeToWake < xTickCount )\r
+ {\r
+ /* Wake time has overflowed. Place this item in the overflow list. */\r
+ vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+ }\r
+ else\r
+ {\r
+ /* The wake time has not overflowed, so we can use the current block list. */\r
+ vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+ }\r
+ }\r
+ #endif\r
}\r
/*-----------------------------------------------------------*/\r
\r
{\r
portBASE_TYPE xReturn;\r
\r
- if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( xTickCount > pxTimeOut->xTimeOnEntering ) )\r
+ if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( xTickCount >= pxTimeOut->xTimeOnEntering ) )\r
{\r
/* The tick count is greater than the time at which vTaskSetTimeout() \r
was called, but has also overflowed since vTaskSetTimeOut() was called.\r