]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c
Update FreeRTOS+ version number ready for version 9 release candidate 1.
[freertos] / FreeRTOS-Plus / Demo / Common / FreeRTOS_Plus_CLI_Demos / Sample-CLI-commands.c
index 2ecec85360c98821bc051720dfbeba8120cc9d0b..a6a7a32a24e38823134e47fad6152edf2d3a41b9 100644 (file)
@@ -1,60 +1,64 @@
 /*\r
-    FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc1 - Copyright (C) 2016 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 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
-     *    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
-     *    Thank you!                                                         *\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
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
 \r
+    ***************************************************************************\r
     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
     >>!   obliged to provide the source code for proprietary components     !<<\r
     >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\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
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
     link: http://www.freertos.org/a00114.html\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
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
      *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\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
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial 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
@@ -66,8 +70,7 @@
 \r
  /******************************************************************************\r
  *\r
- * See the following URL for information on the commands defined in this file:\r
- * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Examples/Ethernet_Related_CLI_Commands.shtml\r
+ * http://www.FreeRTOS.org/cli\r
  *\r
  ******************************************************************************/\r
 \r
        #define configINCLUDE_TRACE_RELATED_CLI_COMMANDS 0\r
 #endif\r
 \r
+#ifndef configINCLUDE_QUERY_HEAP_COMMAND\r
+       #define configINCLUDE_QUERY_HEAP_COMMAND 0\r
+#endif\r
+\r
+/*\r
+ * The function that registers the commands that are defined within this file.\r
+ */\r
+void vRegisterSampleCLICommands( void );\r
 \r
 /*\r
  * Implements the task-stats command.\r
  */\r
-static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
 \r
 /*\r
  * Implements the run-time-stats command.\r
  */\r
-static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+#if( configGENERATE_RUN_TIME_STATS == 1 )\r
+       static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+#endif /* configGENERATE_RUN_TIME_STATS */\r
 \r
 /*\r
  * Implements the echo-three-parameters command.\r
  */\r
-static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
 \r
 /*\r
  * Implements the echo-parameters command.\r
  */\r
-static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
 \r
 /*\r
- * Implements the "trace start" and "trace stop" commands;\r
+ * Implements the "query heap" command.\r
  */\r
-#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1\r
-       static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+#if( configINCLUDE_QUERY_HEAP_COMMAND == 1 )\r
+       static BaseType_t prvQueryHeapCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
 #endif\r
 \r
-/* Structure that defines the "run-time-stats" command line command.   This\r
-generates a table that shows how much run time each task has */\r
-static const CLI_Command_Definition_t xRunTimeStats =\r
-{\r
-       "run-time-stats", /* The command string to type. */\r
-       "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n",\r
-       prvRunTimeStatsCommand, /* The function to run. */\r
-       0 /* No parameters are expected. */\r
-};\r
+/*\r
+ * Implements the "trace start" and "trace stop" commands;\r
+ */\r
+#if( configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 )\r
+       static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
+#endif\r
 \r
 /* Structure that defines the "task-stats" command line command.  This generates\r
 a table that gives information on each task in the system. */\r
@@ -159,6 +169,29 @@ static const CLI_Command_Definition_t xParameterEcho =
        -1 /* The user can enter any number of commands. */\r
 };\r
 \r
+#if( configGENERATE_RUN_TIME_STATS == 1 )\r
+       /* Structure that defines the "run-time-stats" command line command.   This\r
+       generates a table that shows how much run time each task has */\r
+       static const CLI_Command_Definition_t xRunTimeStats =\r
+       {\r
+               "run-time-stats", /* The command string to type. */\r
+               "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n",\r
+               prvRunTimeStatsCommand, /* The function to run. */\r
+               0 /* No parameters are expected. */\r
+       };\r
+#endif /* configGENERATE_RUN_TIME_STATS */\r
+\r
+#if( configINCLUDE_QUERY_HEAP_COMMAND == 1 )\r
+       /* Structure that defines the "query_heap" command line command. */\r
+       static const CLI_Command_Definition_t xQueryHeap =\r
+       {\r
+               "query-heap",\r
+               "\r\nquery-heap:\r\n Displays the free heap space, and minimum ever free heap space.\r\n",\r
+               prvQueryHeapCommand, /* The function to run. */\r
+               0 /* The user can enter any number of commands. */\r
+       };\r
+#endif /* configQUERY_HEAP_COMMAND */\r
+\r
 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1\r
        /* Structure that defines the "trace" command line command.  This takes a single\r
        parameter, which can be either "start" or "stop". */\r
@@ -176,22 +209,34 @@ static const CLI_Command_Definition_t xParameterEcho =
 void vRegisterSampleCLICommands( void )\r
 {\r
        /* Register all the command line commands defined immediately above. */\r
-       FreeRTOS_CLIRegisterCommand( &xTaskStats );\r
-       FreeRTOS_CLIRegisterCommand( &xRunTimeStats );\r
+       FreeRTOS_CLIRegisterCommand( &xTaskStats );     \r
        FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho );\r
        FreeRTOS_CLIRegisterCommand( &xParameterEcho );\r
 \r
+       #if( configGENERATE_RUN_TIME_STATS == 1 )\r
+       {\r
+               FreeRTOS_CLIRegisterCommand( &xRunTimeStats );\r
+       }\r
+       #endif\r
+       \r
+       #if( configINCLUDE_QUERY_HEAP_COMMAND == 1 )\r
+       {\r
+               FreeRTOS_CLIRegisterCommand( &xQueryHeap );\r
+       }\r
+       #endif\r
+\r
        #if( configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 )\r
        {\r
-               FreeRTOS_CLIRegisterCommand( & xStartStopTrace );\r
+               FreeRTOS_CLIRegisterCommand( &xStartStopTrace );\r
        }\r
        #endif\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
+static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
 {\r
-const char *const pcHeader = "Task          State  Priority  Stack     #\r\n************************************************\r\n";\r
+const char *const pcHeader = "     State   Priority  Stack    #\r\n************************************************\r\n";\r
+BaseType_t xSpacePadding;\r
 \r
        /* Remove compile time warnings about unused parameters, and check the\r
        write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r
@@ -201,6 +246,21 @@ const char *const pcHeader = "Task          State  Priority  Stack #\r\n********
        configASSERT( pcWriteBuffer );\r
 \r
        /* Generate a table of task stats. */\r
+       strcpy( pcWriteBuffer, "Task" );\r
+       pcWriteBuffer += strlen( pcWriteBuffer );\r
+\r
+       /* Minus three for the null terminator and half the number of characters in\r
+       "Task" so the column lines up with the centre of the heading. */\r
+       configASSERT( configMAX_TASK_NAME_LEN > 3 );\r
+       for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )\r
+       {\r
+               /* Add a space to align columns after the task's name. */\r
+               *pcWriteBuffer = ' ';\r
+               pcWriteBuffer++;\r
+\r
+               /* Ensure always terminated. */\r
+               *pcWriteBuffer = 0x00;\r
+       }\r
        strcpy( pcWriteBuffer, pcHeader );\r
        vTaskList( pcWriteBuffer + strlen( pcHeader ) );\r
 \r
@@ -210,32 +270,75 @@ const char *const pcHeader = "Task          State  Priority  Stack        #\r\n********
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
-{\r
-const char * const pcHeader = "Task            Abs Time      % Time\r\n****************************************\r\n";\r
+#if( configINCLUDE_QUERY_HEAP_COMMAND == 1 )\r
 \r
-       /* Remove compile time warnings about unused parameters, and check the\r
-       write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r
-       write buffer length is adequate, so does not check for buffer overflows. */\r
-       ( void ) pcCommandString;\r
-       ( void ) xWriteBufferLen;\r
-       configASSERT( pcWriteBuffer );\r
+       static BaseType_t prvQueryHeapCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
+       {\r
+               /* Remove compile time warnings about unused parameters, and check the\r
+               write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r
+               write buffer length is adequate, so does not check for buffer overflows. */\r
+               ( void ) pcCommandString;\r
+               ( void ) xWriteBufferLen;\r
+               configASSERT( pcWriteBuffer );\r
 \r
-       /* Generate a table of task stats. */\r
-       strcpy( pcWriteBuffer, pcHeader );\r
-       vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );\r
+               sprintf( pcWriteBuffer, "Current free heap %d bytes, minimum ever free heap %d bytes\r\n", ( int ) xPortGetFreeHeapSize(), ( int ) xPortGetMinimumEverFreeHeapSize() );\r
 \r
-       /* There is no more data to return after this single string, so return\r
-       pdFALSE. */\r
-       return pdFALSE;\r
-}\r
+               /* There is no more data to return after this single string, so return\r
+               pdFALSE. */\r
+               return pdFALSE;\r
+       }\r
+\r
+#endif /* configINCLUDE_QUERY_HEAP */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configGENERATE_RUN_TIME_STATS == 1 )\r
+       \r
+       static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
+       {\r
+       const char * const pcHeader = "  Abs Time      % Time\r\n****************************************\r\n";\r
+       BaseType_t xSpacePadding;\r
+\r
+               /* Remove compile time warnings about unused parameters, and check the\r
+               write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r
+               write buffer length is adequate, so does not check for buffer overflows. */\r
+               ( void ) pcCommandString;\r
+               ( void ) xWriteBufferLen;\r
+               configASSERT( pcWriteBuffer );\r
+\r
+               /* Generate a table of task stats. */\r
+               strcpy( pcWriteBuffer, "Task" );\r
+               pcWriteBuffer += strlen( pcWriteBuffer );\r
+\r
+               /* Pad the string "task" with however many bytes necessary to make it the\r
+               length of a task name.  Minus three for the null terminator and half the\r
+               number of characters in "Task" so the column lines up with the centre of\r
+               the heading. */\r
+               for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )\r
+               {\r
+                       /* Add a space to align columns after the task's name. */\r
+                       *pcWriteBuffer = ' ';\r
+                       pcWriteBuffer++;\r
+\r
+                       /* Ensure always terminated. */\r
+                       *pcWriteBuffer = 0x00;\r
+               }\r
+\r
+               strcpy( pcWriteBuffer, pcHeader );\r
+               vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );\r
+\r
+               /* There is no more data to return after this single string, so return\r
+               pdFALSE. */\r
+               return pdFALSE;\r
+       }\r
+       \r
+#endif /* configGENERATE_RUN_TIME_STATS */\r
 /*-----------------------------------------------------------*/\r
 \r
-static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
+static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
 {\r
 const char *pcParameter;\r
-portBASE_TYPE xParameterStringLength, xReturn;\r
-static portBASE_TYPE lParameterNumber = 0;\r
+BaseType_t xParameterStringLength, xReturn;\r
+static UBaseType_t uxParameterNumber = 0;\r
 \r
        /* Remove compile time warnings about unused parameters, and check the\r
        write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r
@@ -244,7 +347,7 @@ static portBASE_TYPE lParameterNumber = 0;
        ( void ) xWriteBufferLen;\r
        configASSERT( pcWriteBuffer );\r
 \r
-       if( lParameterNumber == 0 )\r
+       if( uxParameterNumber == 0 )\r
        {\r
                /* The first time the function is called after the command has been\r
                entered just a header string is returned. */\r
@@ -252,7 +355,7 @@ static portBASE_TYPE lParameterNumber = 0;
 \r
                /* Next time the function is called the first parameter will be echoed\r
                back. */\r
-               lParameterNumber = 1L;\r
+               uxParameterNumber = 1U;\r
 \r
                /* There is more data to be returned as no parameters have been echoed\r
                back yet. */\r
@@ -264,7 +367,7 @@ static portBASE_TYPE lParameterNumber = 0;
                pcParameter = FreeRTOS_CLIGetParameter\r
                                                (\r
                                                        pcCommandString,                /* The command string itself. */\r
-                                                       lParameterNumber,               /* Return the next parameter. */\r
+                                                       uxParameterNumber,              /* Return the next parameter. */\r
                                                        &xParameterStringLength /* Store the parameter string length. */\r
                                                );\r
 \r
@@ -273,24 +376,24 @@ static portBASE_TYPE lParameterNumber = 0;
 \r
                /* Return the parameter string. */\r
                memset( pcWriteBuffer, 0x00, xWriteBufferLen );\r
-               sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );\r
-               strncat( pcWriteBuffer, pcParameter, xParameterStringLength );\r
+               sprintf( pcWriteBuffer, "%d: ", ( int ) uxParameterNumber );\r
+               strncat( pcWriteBuffer, pcParameter, ( size_t ) xParameterStringLength );\r
                strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );\r
 \r
                /* If this is the last of the three parameters then there are no more\r
                strings to return after this one. */\r
-               if( lParameterNumber == 3L )\r
+               if( uxParameterNumber == 3U )\r
                {\r
                        /* If this is the last of the three parameters then there are no more\r
                        strings to return after this one. */\r
                        xReturn = pdFALSE;\r
-                       lParameterNumber = 0L;\r
+                       uxParameterNumber = 0;\r
                }\r
                else\r
                {\r
                        /* There are more parameters to return after this one. */\r
                        xReturn = pdTRUE;\r
-                       lParameterNumber++;\r
+                       uxParameterNumber++;\r
                }\r
        }\r
 \r
@@ -298,11 +401,11 @@ static portBASE_TYPE lParameterNumber = 0;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
+static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
 {\r
 const char *pcParameter;\r
-portBASE_TYPE xParameterStringLength, xReturn;\r
-static portBASE_TYPE lParameterNumber = 0;\r
+BaseType_t xParameterStringLength, xReturn;\r
+static UBaseType_t uxParameterNumber = 0;\r
 \r
        /* Remove compile time warnings about unused parameters, and check the\r
        write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r
@@ -311,7 +414,7 @@ static portBASE_TYPE lParameterNumber = 0;
        ( void ) xWriteBufferLen;\r
        configASSERT( pcWriteBuffer );\r
 \r
-       if( lParameterNumber == 0 )\r
+       if( uxParameterNumber == 0 )\r
        {\r
                /* The first time the function is called after the command has been\r
                entered just a header string is returned. */\r
@@ -319,7 +422,7 @@ static portBASE_TYPE lParameterNumber = 0;
 \r
                /* Next time the function is called the first parameter will be echoed\r
                back. */\r
-               lParameterNumber = 1L;\r
+               uxParameterNumber = 1U;\r
 \r
                /* There is more data to be returned as no parameters have been echoed\r
                back yet. */\r
@@ -331,7 +434,7 @@ static portBASE_TYPE lParameterNumber = 0;
                pcParameter = FreeRTOS_CLIGetParameter\r
                                                (\r
                                                        pcCommandString,                /* The command string itself. */\r
-                                                       lParameterNumber,               /* Return the next parameter. */\r
+                                                       uxParameterNumber,              /* Return the next parameter. */\r
                                                        &xParameterStringLength /* Store the parameter string length. */\r
                                                );\r
 \r
@@ -339,13 +442,13 @@ static portBASE_TYPE lParameterNumber = 0;
                {\r
                        /* Return the parameter string. */\r
                        memset( pcWriteBuffer, 0x00, xWriteBufferLen );\r
-                       sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );\r
-                       strncat( pcWriteBuffer, pcParameter, xParameterStringLength );\r
+                       sprintf( pcWriteBuffer, "%d: ", ( int ) uxParameterNumber );\r
+                       strncat( pcWriteBuffer, ( char * ) pcParameter, ( size_t ) xParameterStringLength );\r
                        strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );\r
 \r
                        /* There might be more parameters to return after this one. */\r
                        xReturn = pdTRUE;\r
-                       lParameterNumber++;\r
+                       uxParameterNumber++;\r
                }\r
                else\r
                {\r
@@ -357,7 +460,7 @@ static portBASE_TYPE lParameterNumber = 0;
                        xReturn = pdFALSE;\r
 \r
                        /* Start over the next time this command is executed. */\r
-                       lParameterNumber = 0;\r
+                       uxParameterNumber = 0;\r
                }\r
        }\r
 \r
@@ -367,10 +470,10 @@ static portBASE_TYPE lParameterNumber = 0;
 \r
 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1\r
 \r
-       static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
+       static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
        {\r
        const char *pcParameter;\r
-       portBASE_TYPE lParameterStringLength;\r
+       BaseType_t lParameterStringLength;\r
 \r
                /* Remove compile time warnings about unused parameters, and check the\r
                write buffer is not NULL.  NOTE - for simplicity, this example assumes the\r