]> git.sur5r.net Git - freertos/blobdiff - Source/tasks.c
Update version numbers to V4.8.0
[freertos] / Source / tasks.c
index ad65c144e22f7e331b033ed9c42ee1cf4436425e..bd8d82fdf0b0a7c944b4ddfd1ddf6003533a26ca 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-       FreeRTOS.org V4.7.2 - Copyright (C) 2003-2008 Richard Barry.\r
+       FreeRTOS.org V4.8.0 - Copyright (C) 2003-2008 Richard Barry.\r
 \r
        This file is part of the FreeRTOS.org distribution.\r
 \r
        of http://www.FreeRTOS.org for full details of how and when the exception\r
        can be applied.\r
 \r
+       ***************************************************************************\r
+       ***************************************************************************\r
+       *                                                                                                                                                 *\r
+       * SAVE TIME AND MONEY!  Why not get us to quote to get FreeRTOS.org               *\r
+       * running on your hardware - or even write all or part of your application*\r
+       * for you?  See http://www.OpenRTOS.com for details.                                      *\r
+       *                                                                                                                                                 *\r
+       ***************************************************************************\r
        ***************************************************************************\r
 \r
        Please ensure to read the configuration and relevant port sections of the\r
        online documentation.\r
 \r
-       +++ http://www.FreeRTOS.org +++\r
-       Documentation, latest information, license and contact details.\r
+       http://www.FreeRTOS.org - Documentation, latest information, license and \r
+       contact details.\r
 \r
-       +++ http://www.SafeRTOS.com +++\r
-       A version that is certified for use in safety critical systems.\r
+       http://www.SafeRTOS.com - A version that is certified for use in safety \r
+       critical systems.\r
 \r
-       +++ http://www.OpenRTOS.com +++\r
-       Commercial support, development, porting, licensing and training services.\r
-\r
-       ***************************************************************************\r
+       http://www.OpenRTOS.com - Commercial support, development, porting, \r
+       licensing and training services.\r
 */\r
 \r
 \r
@@ -268,7 +274,7 @@ register tskTCB *pxTCB;                                                                                                                                                                                             \
  * the stack limit.  Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1\r
  * will also cause the last few stack bytes to be checked to ensure the value\r
  * to which the bytes were set when the task was created have not been \r
- * overwritten.  Note this second test does not guarantee that an overflown\r
+ * overwritten.  Note this second test does not guarantee that an overflowed\r
  * stack will always be recognised.\r
  */\r
 \r
@@ -296,7 +302,7 @@ register tskTCB *pxTCB;                                                                                                                                                                                             \
                /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
                if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )                                                                               \\r
                {                                                                                                                                                                                               \\r
-                       vApplicationStackOverflowHook( pxCurrentTCB, pxCurrentTCB->pcTaskName );                                        \\r
+                       vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );        \\r
                }                                                                                                                                                                                               \\r
        }\r
 \r
@@ -317,17 +323,18 @@ register tskTCB *pxTCB;                                                                                                                                                                                           \
                /* Is the currently saved stack pointer within the stack limit? */                                                                                                                                                      \\r
                if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )                                                                                                                                                                       \\r
                {                                                                                                                                                                                                                                                                                       \\r
-                       vApplicationStackOverflowHook( pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                                                                                \\r
+                       vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                                                \\r
                }                                                                                                                                                                                                                                                                                       \\r
                                                                                                                                                                                                                                                                                                        \\r
                /* Has the extremity of the task stack ever been written over? */                                                                                                                                                       \\r
-               if( memcmp( pxCurrentTCB->pxStack, ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                                                                                        \\r
+               if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                                          \\r
                {                                                                                                                                                                                                                                                                                       \\r
-                       vApplicationStackOverflowHook( pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                                                                                \\r
+                       vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                                                \\r
                }                                                                                                                                                                                                                                                                                       \\r
        }\r
 \r
 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
@@ -1559,36 +1566,40 @@ portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType
 {\r
 portBASE_TYPE xReturn;\r
 \r
-       #if ( INCLUDE_vTaskSuspend == 1 )\r
-               /* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is\r
-               the maximum block time then the task should block indefinitely, and\r
-               therefore never time out. */\r
-               if( *pxTicksToWait == portMAX_DELAY )\r
+       portENTER_CRITICAL();\r
+       {\r
+               #if ( INCLUDE_vTaskSuspend == 1 )\r
+                       /* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is\r
+                       the maximum block time then the task should block indefinitely, and\r
+                       therefore never time out. */\r
+                       if( *pxTicksToWait == portMAX_DELAY )\r
+                       {\r
+                               xReturn = pdFALSE;\r
+                       }\r
+                       else /* We are not blocking indefinitely, perform the checks below. */\r
+               #endif\r
+\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
+                       It must have wrapped all the way around and gone past us again. This\r
+                       passed since vTaskSetTimeout() was called. */\r
+                       xReturn = pdTRUE;\r
+               }\r
+               else if( ( xTickCount - pxTimeOut->xTimeOnEntering ) < *pxTicksToWait )\r
                {\r
+                       /* Not a genuine timeout. Adjust parameters for time remaining. */\r
+                       *pxTicksToWait -= ( xTickCount - pxTimeOut->xTimeOnEntering );\r
+                       vTaskSetTimeOutState( pxTimeOut );\r
                        xReturn = pdFALSE;\r
                }\r
-               else /* We are not blocking indefinitely, perform the checks below. */\r
-       #endif\r
-\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
-        It must have wrapped all the way around and gone past us again. This\r
-        passed since vTaskSetTimeout() was called. */\r
-        xReturn = pdTRUE;\r
-    }\r
-    else if( ( xTickCount - pxTimeOut->xTimeOnEntering ) < *pxTicksToWait )\r
-    {\r
-        /* Not a genuine timeout. Adjust parameters for time remaining. */\r
-        *pxTicksToWait -= ( xTickCount - pxTimeOut->xTimeOnEntering );\r
-        vTaskSetTimeOutState( pxTimeOut );\r
-        xReturn = pdFALSE;\r
-    }\r
-    else\r
-    {\r
-        xReturn = pdTRUE;\r
-    }\r
+               else\r
+               {\r
+                       xReturn = pdTRUE;\r
+               }\r
+       }\r
+       portEXIT_CRITICAL();\r
 \r
     return xReturn;\r
 }\r
@@ -1857,9 +1868,12 @@ tskTCB *pxNewTCB;
 \r
 #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )\r
 \r
-       unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( void )\r
+       unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask )\r
        {\r
-               return usTaskCheckFreeStackSpace( pxCurrentTCB->pxStack );\r
+       tskTCB *pxTCB;\r
+\r
+               pxTCB = prvGetTCBFromHandle( xTask );\r
+               return usTaskCheckFreeStackSpace( ( unsigned portCHAR * ) pxTCB->pxStack );\r
        }\r
 \r
 #endif\r