]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/tasks.c
+ Update demos that use FreeRTOS+Trace to work with the latest trace recorder library.
[freertos] / FreeRTOS / Source / tasks.c
index 74edf06e1f6598dd08fbe006488707dd4daac153..99c005fcce2b1c1a561b075b7b47fff031fbd759 100644 (file)
@@ -1080,8 +1080,8 @@ TCB_t * pxNewTCB;
 \r
                uxSavedInterruptState = portSET_INTERRUPT_MASK_FROM_ISR();\r
                {\r
-                       /* If null is passed in here then we are changing the\r
-                       priority of the calling function. */\r
+                       /* If null is passed in here then it is the priority of the calling\r
+                       task that is being queried. */\r
                        pxTCB = prvGetTCBFromHandle( xTask );\r
                        uxReturn = pxTCB->uxPriority;\r
                }\r
@@ -1743,11 +1743,11 @@ TickType_t xTaskGetTickCount( void )
 TickType_t xTicks;\r
 \r
        /* Critical section required if running on a 16 bit processor. */\r
-       taskENTER_CRITICAL();\r
+       portTICK_TYPE_ENTER_CRITICAL();\r
        {\r
                xTicks = xTickCount;\r
        }\r
-       taskEXIT_CRITICAL();\r
+       portTICK_TYPE_EXIT_CRITICAL();\r
 \r
        return xTicks;\r
 }\r
@@ -1774,11 +1774,11 @@ UBaseType_t uxSavedInterruptStatus;
        link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
        portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
 \r
-       uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
+       uxSavedInterruptStatus = portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR();\r
        {\r
                xReturn = xTickCount;\r
        }\r
-       portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
+       portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
 \r
        return xReturn;\r
 }\r
@@ -3510,7 +3510,7 @@ TCB_t *pxTCB;
 \r
                /* Pad the end of the string with spaces to ensure columns line up when\r
                printed out. */\r
-               for( x = strlen( pcBuffer ); x < configMAX_TASK_NAME_LEN; x++ )\r
+               for( x = strlen( pcBuffer ); x < ( configMAX_TASK_NAME_LEN - 1 ); x++ )\r
                {\r
                        pcBuffer[ x ] = ' ';\r
                }\r
@@ -3578,22 +3578,22 @@ TCB_t *pxTCB;
                        {\r
                                switch( pxTaskStatusArray[ x ].eCurrentState )\r
                                {\r
-                               case eReady:            cStatus = tskREADY_CHAR;\r
-                                                                       break;\r
+                                       case eReady:            cStatus = tskREADY_CHAR;\r
+                                                                               break;\r
 \r
-                               case eBlocked:          cStatus = tskBLOCKED_CHAR;\r
-                                                                       break;\r
+                                       case eBlocked:          cStatus = tskBLOCKED_CHAR;\r
+                                                                               break;\r
 \r
-                               case eSuspended:        cStatus = tskSUSPENDED_CHAR;\r
-                                                                       break;\r
+                                       case eSuspended:        cStatus = tskSUSPENDED_CHAR;\r
+                                                                               break;\r
 \r
-                               case eDeleted:          cStatus = tskDELETED_CHAR;\r
-                                                                       break;\r
+                                       case eDeleted:          cStatus = tskDELETED_CHAR;\r
+                                                                               break;\r
 \r
-                               default:                        /* Should not get here, but it is included\r
-                                                                       to prevent static checking errors. */\r
-                                                                       cStatus = 0x00;\r
-                                                                       break;\r
+                                       default:                        /* Should not get here, but it is included\r
+                                                                               to prevent static checking errors. */\r
+                                                                               cStatus = 0x00;\r
+                                                                               break;\r
                                }\r
 \r
                                /* Write the task name to the string, padding with spaces so it\r
@@ -3685,13 +3685,13 @@ TCB_t *pxTCB;
                                        ulTotalRunTimeDiv100 has already been divided by 100. */\r
                                        ulStatsAsPercentage = pxTaskStatusArray[ x ].ulRunTimeCounter / ulTotalTime;\r
 \r
+                                       /* Write the task name to the string, padding with\r
+                                       spaces so it can be printed in tabular form more\r
+                                       easily. */\r
+                                       pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );\r
+\r
                                        if( ulStatsAsPercentage > 0UL )\r
                                        {\r
-                                               /* Write the task name to the string, padding with\r
-                                               spaces so it can be printed in tabular form more\r
-                                               easily. */\r
-                                               pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );\r
-\r
                                                #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
                                                {\r
                                                        sprintf( pcWriteBuffer, "\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
@@ -3710,13 +3710,13 @@ TCB_t *pxTCB;
                                                consumed less than 1% of the total run time. */\r
                                                #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
                                                {\r
-                                                       sprintf( pcWriteBuffer, "%s\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );\r
+                                                       sprintf( pcWriteBuffer, "\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );\r
                                                }\r
                                                #else\r
                                                {\r
                                                        /* sizeof( int ) == sizeof( long ) so a smaller\r
                                                        printf() library can be used. */\r
-                                                       sprintf( pcWriteBuffer, "%s\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );\r
+                                                       sprintf( pcWriteBuffer, "\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );\r
                                                }\r
                                                #endif\r
                                        }\r