/*\r
- FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+ FreeRTOS V8.2.2 - Copyright (C) 2015 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
- * 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
/*\r
* Implements the run-time-stats command.\r
*/\r
-static BaseType_t 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
static BaseType_t prvStartStopTraceCommand( 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
/* Structure that defines the "task-stats" command line command. This generates\r
a table that gives information on each task in the system. */\r
static const CLI_Command_Definition_t xTaskStats =\r
-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
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
static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
-const char *const pcHeader = " 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
#endif /* configINCLUDE_QUERY_HEAP */\r
/*-----------------------------------------------------------*/\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
+#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
+ /* 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
+ /* 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
+ /* 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
+ /* Ensure always terminated. */\r
+ *pcWriteBuffer = 0x00;\r
+ }\r
\r
- strcpy( pcWriteBuffer, pcHeader );\r
- vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );\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
+ /* 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 BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
const char *pcParameter;\r
BaseType_t xParameterStringLength, xReturn;\r
-static BaseType_t lParameterNumber = 0;\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
( 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
\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
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
\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
{\r
const char *pcParameter;\r
BaseType_t xParameterStringLength, xReturn;\r
-static BaseType_t lParameterNumber = 0;\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
( 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
\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
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
{\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
xReturn = pdFALSE;\r
\r
/* Start over the next time this command is executed. */\r
- lParameterNumber = 0;\r
+ uxParameterNumber = 0;\r
}\r
}\r
\r