]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/croutine.c
Update FreeRTOS version number to V7.5.3
[freertos] / FreeRTOS / Source / croutine.c
index 4903540f4b1661efab17b403fa2e18e365b1747d..b569c4908d9268805214ca8d3e95a8ab2b75f056 100644 (file)
@@ -1,67 +1,66 @@
 /*\r
-    FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+    FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    All rights reserved\r
 \r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
     ***************************************************************************\r
      *                                                                       *\r
-     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
-     *    Complete, revised, and edited pdf reference manuals are also       *\r
-     *    available.                                                         *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
      *                                                                       *\r
-     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
-     *    ensuring you get running as quickly as possible and with an        *\r
-     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
-     *    the FreeRTOS project to continue with its mission of providing     *\r
-     *    professional grade, cross platform, de facto standard solutions    *\r
-     *    for microcontrollers - completely free of charge!                  *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
      *                                                                       *\r
-     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
-     *                                                                       *\r
-     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
+     *    Thank you!                                                         *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-\r
     This file is part of the FreeRTOS distribution.\r
 \r
     FreeRTOS is free software; you can redistribute it and/or modify it under\r
     the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
-    >>>NOTE<<< The modification to the GPL is included to allow you to\r
-    distribute a combined work that includes FreeRTOS without being obliged to\r
-    provide the source code for proprietary components outside of the FreeRTOS\r
-    kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
-    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-    more details. You should have received a copy of the GNU General Public\r
-    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
-    by writing to Richard Barry, contact details for whom are available on the\r
-    FreeRTOS WEB site.\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
+    >>! a combined work that includes FreeRTOS without being obliged to provide\r
+    >>! the source code for proprietary components outside of the FreeRTOS\r
+    >>! kernel.\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    link: http://www.freertos.org/a00114.html\r
 \r
     1 tab == 4 spaces!\r
-    \r
+\r
     ***************************************************************************\r
      *                                                                       *\r
      *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?                                      *\r
+     *    not run, what could be wrong?"                                     *\r
      *                                                                       *\r
      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    \r
-    http://www.FreeRTOS.org - Documentation, training, latest information, \r
-    license and contact details.\r
-    \r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+    license and Real Time Engineers Ltd. contact details.\r
+\r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
-    including FreeRTOS+Trace - an indispensable productivity tool.\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
 \r
-    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
-    the code with commercial support, indemnification, and middleware, under \r
-    the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
-    provide a safety engineered and independently SIL3 certified version under \r
-    the SafeRTOS brand: http://www.SafeRTOS.com.\r
+    1 tab == 4 spaces!\r
 */\r
 \r
 #include "FreeRTOS.h"\r
@@ -83,7 +82,7 @@ static xList xDelayedCoRoutineList1;                                                                  /*< Delayed co-routines. */
 static xList xDelayedCoRoutineList2;                                                                   /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */\r
 static xList * pxDelayedCoRoutineList;                                                                 /*< Points to the delayed co-routine list currently being used. */\r
 static xList * pxOverflowDelayedCoRoutineList;                                                 /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */\r
-static xList xPendingReadyCoRoutineList;                                                                                       /*< Holds co-routines that have been readied by an external event.  They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */\r
+static xList xPendingReadyCoRoutineList;                                                               /*< Holds co-routines that have been readied by an external event.  They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */\r
 \r
 /* Other file private variables. --------------------------------*/\r
 corCRCB * pxCurrentCoRoutine = NULL;\r
@@ -107,7 +106,7 @@ static portTickType xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks =
                uxTopCoRoutineReadyPriority = pxCRCB->uxPriority;                                                                                                                       \\r
        }                                                                                                                                                                                                                               \\r
        vListInsertEnd( ( xList * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) );  \\r
-}      \r
+}\r
 \r
 /*\r
  * Utility to ready all the lists used by the scheduler.  This is called\r
@@ -173,10 +172,10 @@ corCRCB *pxCoRoutine;
                in a list. */\r
                listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );\r
                listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );\r
-       \r
+\r
                /* Event lists are always in priority order. */\r
                listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );\r
-               \r
+\r
                /* Now the co-routine has been initialised it can be added to the ready\r
                list at the correct priority. */\r
                prvAddCoRoutineToReadyQueue( pxCoRoutine );\r
@@ -184,11 +183,11 @@ corCRCB *pxCoRoutine;
                xReturn = pdPASS;\r
        }\r
        else\r
-       {               \r
+       {\r
                xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;\r
        }\r
-       \r
-       return xReturn; \r
+\r
+       return xReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -203,7 +202,7 @@ portTickType xTimeToWake;
        /* We must remove ourselves from the ready list before adding\r
        ourselves to the blocked list as the same list item is used for\r
        both lists. */\r
-       vListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
+       ( void ) uxListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );\r
 \r
        /* The list item will be inserted in wake time order. */\r
        listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );\r
@@ -241,14 +240,14 @@ static void prvCheckPendingReadyList( void )
 \r
                /* The pending ready list can be accessed by an ISR. */\r
                portDISABLE_INTERRUPTS();\r
-               {       \r
-                       pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );                   \r
-                       vListRemove( &( pxUnblockedCRCB->xEventListItem ) );\r
+               {\r
+                       pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) );\r
+                       ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );\r
                }\r
                portENABLE_INTERRUPTS();\r
 \r
-               vListRemove( &( pxUnblockedCRCB->xGenericListItem ) );\r
-               prvAddCoRoutineToReadyQueue( pxUnblockedCRCB ); \r
+               ( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) );\r
+               prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -280,11 +279,11 @@ corCRCB *pxCRCB;
                {\r
                        pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );\r
 \r
-                       if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )                            \r
-                       {                       \r
-                               /* Timeout not yet expired. */                                                                                                                                                  \r
-                               break;                                                                                                                                                          \r
-                       }                                                                                                                                                                               \r
+                       if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )\r
+                       {\r
+                               /* Timeout not yet expired. */\r
+                               break;\r
+                       }\r
 \r
                        portDISABLE_INTERRUPTS();\r
                        {\r
@@ -293,18 +292,18 @@ corCRCB *pxCRCB;
                                have been moved to the pending ready list and the following\r
                                line is still valid.  Also the pvContainer parameter will have\r
                                been set to NULL so the following lines are also valid. */\r
-                               vListRemove( &( pxCRCB->xGenericListItem ) );                                                                                   \r
+                               uxListRemove( &( pxCRCB->xGenericListItem ) );\r
 \r
-                               /* Is the co-routine waiting on an event also? */                                                                                               \r
-                               if( pxCRCB->xEventListItem.pvContainer )                                                                                                        \r
-                               {                                                                                                                       \r
-                                       vListRemove( &( pxCRCB->xEventListItem ) );                                                                                     \r
+                               /* Is the co-routine waiting on an event also? */\r
+                               if( pxCRCB->xEventListItem.pvContainer )\r
+                               {\r
+                                       ( void ) uxListRemove( &( pxCRCB->xEventListItem ) );\r
                                }\r
                        }\r
                        portENABLE_INTERRUPTS();\r
 \r
-                       prvAddCoRoutineToReadyQueue( pxCRCB );                                                                                                  \r
-               }                                                                                                                                                                                                       \r
+                       prvAddCoRoutineToReadyQueue( pxCRCB );\r
+               }\r
        }\r
 \r
        xLastTickCount = xCoRoutineTickCount;\r
@@ -370,7 +369,7 @@ signed portBASE_TYPE xReturn;
        event lists and the pending ready list.  This function assumes that a\r
        check has already been made to ensure pxEventList is not empty. */\r
        pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );\r
-       vListRemove( &( pxUnblockedCRCB->xEventListItem ) );\r
+       ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) );\r
        vListInsertEnd( ( xList * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );\r
 \r
        if( pxUnblockedCRCB->uxPriority >= pxCurrentCoRoutine->uxPriority )\r