]> git.sur5r.net Git - freertos/commitdiff
Introduce the portALT_GET_RUN_TIME_COUNTER_VALUE macro as an alternative to portGET_R...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 6 Jan 2011 10:08:07 +0000 (10:08 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 6 Jan 2011 10:08:07 +0000 (10:08 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1230 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/include/FreeRTOS.h
Source/tasks.c

index 6a4097cc7553fd6f96d6500f74d6c5fadc7adf29..5b0a996090ebf4cfcaa0f0a47ce81b31f5577eff 100644 (file)
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
     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
+    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
 \r
@@ -239,17 +239,17 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
 #endif\r
 \r
 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE\r
-       /* Task is about to block because it cannot read from a \r
+       /* Task is about to block because it cannot read from a\r
        queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
-       upon which the read was attempted.  pxCurrentTCB points to the TCB of the \r
+       upon which the read was attempted.  pxCurrentTCB points to the TCB of the\r
        task that attempted the read. */\r
        #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )\r
 #endif\r
 \r
 #ifndef traceBLOCKING_ON_QUEUE_SEND\r
-       /* Task is about to block because it cannot write to a \r
+       /* Task is about to block because it cannot write to a\r
        queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
-       upon which the write was attempted.  pxCurrentTCB points to the TCB of the \r
+       upon which the write was attempted.  pxCurrentTCB points to the TCB of the\r
        task that attempted the write. */\r
        #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )\r
 #endif\r
@@ -391,7 +391,9 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
        #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */\r
 \r
        #ifndef portGET_RUN_TIME_COUNTER_VALUE\r
-               #error If configGENERATE_RUN_TIME_STATS is defined then portGET_RUN_TIME_COUNTER_VALUE must also be defined.  portGET_RUN_TIME_COUNTER_VALUE should evaluate to the counter value of the timer/counter peripheral used as the run time counter time base.\r
+               #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE\r
+                       #error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined.  See the examples provided and the FreeRTOS web site for more information.\r
+               #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */\r
        #endif /* portGET_RUN_TIME_COUNTER_VALUE */\r
 \r
 #endif /* configGENERATE_RUN_TIME_STATS */\r
index a39200b96fe251405dc9538081efa9f0fc0f43e6..3f8d1aad01655e887ac6410f269cac91aa4c8cdc 100644 (file)
@@ -1284,20 +1284,17 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
        unsigned portBASE_TYPE uxQueue;\r
        unsigned long ulTotalRunTime;\r
 \r
-               /* A critical section is used because portGET_RUN_TIME_COUNTER_VALUE()\r
-               is implemented differently on different ports, so its not known if a\r
-               critical section is needed or not. */\r
-               taskENTER_CRITICAL();\r
-               {\r
-                       ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();\r
-               }\r
-               taskEXIT_CRITICAL();\r
-       \r
                /* This is a VERY costly function that should be used for debug only.\r
                It leaves interrupts disabled for a LONG time. */\r
 \r
                vTaskSuspendAll();\r
                {\r
+                       #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE\r
+                               portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime );\r
+                       #else\r
+                               ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();\r
+                       #endif\r
+\r
                        /* Run through all the lists that could potentially contain a TCB,\r
                        generating a table of run timer percentages in the provided\r
                        buffer. */\r
@@ -1603,7 +1600,13 @@ void vTaskSwitchContext( void )
 \r
        #if ( configGENERATE_RUN_TIME_STATS == 1 )\r
        {\r
-               unsigned long ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();\r
+               unsigned long ulTempCounter;\r
+               \r
+                       #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE\r
+                               portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter );\r
+                       #else\r
+                               ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();\r
+                       #endif\r
 \r
                        /* Add the amount of time the task has been running to the accumulated\r
                        time so far.  The time the task started running was stored in\r