]> git.sur5r.net Git - freertos/blobdiff - Source/tasks.c
Add in a couple of extra list macros for use with FreeRTOS+UDP.
[freertos] / Source / tasks.c
index 7950bf49f514aa48cb41540a17493c48b1737985..85e41a05f614bb735dd6ac96f53c89f8d795b15b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+    FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
        \r
 \r
     ***************************************************************************\r
     FreeRTOS WEB site.\r
 \r
     1 tab == 4 spaces!\r
+    \r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?                                      *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
 \r
-    http://www.FreeRTOS.org - Documentation, latest information, license and\r
-    contact details.\r
-\r
-    http://www.SafeRTOS.com - A version that is certified for use in safety\r
-    critical systems.\r
-\r
-    http://www.OpenRTOS.com - Commercial support, development, porting,\r
-    licensing and training services.\r
+    \r
+    http://www.FreeRTOS.org - Documentation, training, latest information, \r
+    license and contact details.\r
+    \r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool.\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
 */\r
 \r
 \r
@@ -100,7 +113,8 @@ typedef struct tskTaskControlBlock
        #endif\r
 \r
        #if ( configUSE_TRACE_FACILITY == 1 )\r
-               unsigned portBASE_TYPE  uxTCBNumber;    /*< This is used for tracing the scheduler and making debugging easier only. */\r
+               unsigned portBASE_TYPE  uxTCBNumber;    /*< This stores a number that increments each time a TCB is created.  It allows debuggers to determine when a task has been deleted and then recreated. */\r
+               unsigned portBASE_TYPE  uxTaskNumber;   /*< This stores a number specifically for use by third party trace code. */\r
        #endif\r
 \r
        #if ( configUSE_MUTEXES == 1 )\r
@@ -204,6 +218,7 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime                                            = ( portTickType )
  * executing task has been rescheduled.\r
  */\r
 #define prvAddTaskToReadyQueue( pxTCB )                                                                                                                                                                        \\r
+       traceMOVED_TASK_TO_READY_STATE( pxTCB )                                                                                                                                                         \\r
        if( ( pxTCB )->uxPriority > uxTopReadyPriority )                                                                                                                                        \\r
        {                                                                                                                                                                                                                                       \\r
                uxTopReadyPriority = ( pxTCB )->uxPriority;                                                                                                                                             \\r
@@ -281,7 +296,7 @@ portTickType xItemValue;                                                                                                                            \
 #define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )\r
 \r
 /* Callback function prototypes. --------------------------*/\r
-extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );\r
+extern void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );\r
 extern void vApplicationTickHook( void );\r
                \r
 /* File private functions. --------------------------------*/\r
@@ -513,6 +528,7 @@ tskTCB * pxNewTCB;
                        prvAddTaskToReadyQueue( pxNewTCB );\r
 \r
                        xReturn = pdPASS;\r
+                       portSETUP_TCB( pxNewTCB );\r
                        traceTASK_CREATE( pxNewTCB );\r
                }\r
                taskEXIT_CRITICAL();\r
@@ -1830,7 +1846,7 @@ void vTaskMissedYield( void )
                if( xTask != NULL )\r
                {\r
                        pxTCB = ( tskTCB * ) xTask;\r
-                       uxReturn = pxTCB->uxTCBNumber;\r
+                       uxReturn = pxTCB->uxTaskNumber;\r
                }\r
                else\r
                {\r
@@ -1850,7 +1866,7 @@ void vTaskMissedYield( void )
                if( xTask != NULL )\r
                {\r
                        pxTCB = ( tskTCB * ) xTask;\r
-                       pxTCB->uxTCBNumber = uxHandle;\r
+                       pxTCB->uxTaskNumber = uxHandle;\r
                }\r
        }\r
 #endif\r
@@ -2149,7 +2165,7 @@ tskTCB *pxNewTCB;
        {\r
        volatile tskTCB *pxNextTCB, *pxFirstTCB;\r
        unsigned short usStackRemaining;\r
-       PRIVILEGED_DATA static char pcStatusString[ 50 ];\r
+       PRIVILEGED_DATA static char pcStatusString[ configMAX_TASK_NAME_LEN + 30 ];\r
 \r
                /* Write the details of all the TCB's in pxList into the buffer. */\r
                listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );\r
@@ -2299,7 +2315,8 @@ tskTCB *pxNewTCB;
        static void prvDeleteTCB( tskTCB *pxTCB )\r
        {\r
                /* This call is required specifically for the TriCore port.  It must be\r
-               above the vPortFree() calls. */\r
+               above the vPortFree() calls.  The call is also used by ports/demos that\r
+               want to allocate and clean RAM statically. */\r
                portCLEAN_UP_TCB( pxTCB );\r
 \r
                /* Free up the memory allocated by the scheduler for the task.  It is up to\r