2 * FreeRTOS Kernel V10.0.0
\r
3 * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software. If you wish to use our Amazon
\r
14 * FreeRTOS name, please do so in a fair use way that does not cause confusion.
\r
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
18 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
19 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
23 * http://www.FreeRTOS.org
\r
24 * http://aws.amazon.com/freertos
\r
26 * 1 tab == 4 spaces!
\r
29 /******************************************************************************
\r
31 * See the following URL for information on the commands defined in this file:
\r
32 * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Examples/Ethernet_Related_CLI_Commands.shtml
\r
34 ******************************************************************************/
\r
37 /* FreeRTOS includes. */
\r
38 #include "FreeRTOS.h"
\r
41 /* Standard includes. */
\r
46 /* FreeRTOS+CLI includes. */
\r
47 #include "FreeRTOS_CLI.h"
\r
49 /* FreeRTOS+UDP includes, just to make the stats available to the CLI
\r
51 #include "FreeRTOS_UDP_IP.h"
\r
52 #include "FreeRTOS_Sockets.h"
\r
54 #ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
\r
55 #define configINCLUDE_TRACE_RELATED_CLI_COMMANDS 0
\r
60 * Implements the run-time-stats command.
\r
62 static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
65 * Implements the task-stats command.
\r
67 static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
70 * Implements the echo-three-parameters command.
\r
72 static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
75 * Implements the echo-parameters command.
\r
77 static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
80 * Defines a command that prints out IP address information.
\r
82 static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
85 * Defines a command that prints out the gathered demo debug stats.
\r
87 static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
90 * Defines a command that sends an ICMP ping request to an IP address.
\r
92 static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
95 * Implements the "trace start" and "trace stop" commands;
\r
97 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
98 static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
101 /* Structure that defines the "ip-config" command line command. */
\r
102 static const CLI_Command_Definition_t xIPConfig =
\r
105 "ip-config:\r\n Displays IP address configuration\r\n\r\n",
\r
106 prvDisplayIPConfig,
\r
110 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
111 /* Structure that defines the "ip-debug-stats" command line command. */
\r
112 static const CLI_Command_Definition_t xIPDebugStats =
\r
114 "ip-debug-stats", /* The command string to type. */
\r
115 "ip-debug-stats:\r\n Shows some IP stack stats useful for debug - an example only.\r\n\r\n",
\r
116 prvDisplayIPDebugStats, /* The function to run. */
\r
117 0 /* No parameters are expected. */
\r
119 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
121 /* Structure that defines the "run-time-stats" command line command. This
\r
122 generates a table that shows how much run time each task has */
\r
123 static const CLI_Command_Definition_t xRunTimeStats =
\r
125 "run-time-stats", /* The command string to type. */
\r
126 "run-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n\r\n",
\r
127 prvRunTimeStatsCommand, /* The function to run. */
\r
128 0 /* No parameters are expected. */
\r
131 /* Structure that defines the "task-stats" command line command. This generates
\r
132 a table that gives information on each task in the system. */
\r
133 static const CLI_Command_Definition_t xTaskStats =
\r
135 "task-stats", /* The command string to type. */
\r
136 "task-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n\r\n",
\r
137 prvTaskStatsCommand, /* The function to run. */
\r
138 0 /* No parameters are expected. */
\r
141 /* Structure that defines the "echo_3_parameters" command line command. This
\r
142 takes exactly three parameters that the command simply echos back one at a
\r
144 static const CLI_Command_Definition_t xThreeParameterEcho =
\r
146 "echo-3-parameters",
\r
147 "echo-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n\r\n",
\r
148 prvThreeParameterEchoCommand, /* The function to run. */
\r
149 3 /* Three parameters are expected, which can take any value. */
\r
152 /* Structure that defines the "echo_parameters" command line command. This
\r
153 takes a variable number of parameters that the command simply echos back one at
\r
155 static const CLI_Command_Definition_t xParameterEcho =
\r
158 "echo-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n\r\n",
\r
159 prvParameterEchoCommand, /* The function to run. */
\r
160 -1 /* The user can enter any number of commands. */
\r
163 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
165 /* Structure that defines the "ping" command line command. This takes an IP
\r
166 address or host name and (optionally) the number of bytes to ping as
\r
168 static const CLI_Command_Definition_t xPing =
\r
171 "ping <ipaddress> <optional:bytes to send>:\r\n for example, ping 192.168.0.3 8, or ping www.example.com\r\n\r\n",
\r
172 prvPingCommand, /* The function to run. */
\r
173 -1 /* Ping can take either one or two parameter, so the number of parameters has to be determined by the ping command implementation. */
\r
176 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
178 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
179 /* Structure that defines the "trace" command line command. This takes a single
\r
180 parameter, which can be either "start" or "stop". */
\r
181 static const CLI_Command_Definition_t xStartStopTrace =
\r
184 "trace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n\r\n",
\r
185 prvStartStopTraceCommand, /* The function to run. */
\r
186 1 /* One parameter is expected. Valid values are "start" and "stop". */
\r
188 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r
190 /*-----------------------------------------------------------*/
\r
192 void vRegisterCLICommands( void )
\r
194 /* Register all the command line commands defined immediately above. */
\r
195 FreeRTOS_CLIRegisterCommand( &xTaskStats );
\r
196 FreeRTOS_CLIRegisterCommand( &xRunTimeStats );
\r
197 FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho );
\r
198 FreeRTOS_CLIRegisterCommand( &xParameterEcho );
\r
199 FreeRTOS_CLIRegisterCommand( &xIPDebugStats );
\r
200 FreeRTOS_CLIRegisterCommand( &xIPConfig );
\r
202 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
204 FreeRTOS_CLIRegisterCommand( &xPing );
\r
206 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
208 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
209 FreeRTOS_CLIRegisterCommand( & xStartStopTrace );
\r
212 /*-----------------------------------------------------------*/
\r
214 static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
216 const char *const pcHeader = " State\tPriority\tStack\t#\r\n************************************************\r\n";
\r
217 BaseType_t xSpacePadding;
\r
219 /* Remove compile time warnings about unused parameters, and check the
\r
220 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
221 write buffer length is adequate, so does not check for buffer overflows. */
\r
222 ( void ) pcCommandString;
\r
223 ( void ) xWriteBufferLen;
\r
224 configASSERT( pcWriteBuffer );
\r
226 /* Generate a table of task stats. */
\r
227 strcpy( pcWriteBuffer, "Task" );
\r
228 pcWriteBuffer += strlen( pcWriteBuffer );
\r
230 /* Pad the string "task" with however many bytes necessary to make it the
\r
231 length of a task name. Minus three for the null terminator and half the
\r
232 number of characters in "Task" so the column lines up with the centre of
\r
234 for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
\r
236 /* Add a space to align columns after the task's name. */
\r
237 *pcWriteBuffer = ' ';
\r
240 /* Ensure always terminated. */
\r
241 *pcWriteBuffer = 0x00;
\r
243 strcpy( pcWriteBuffer, pcHeader );
\r
244 vTaskList( pcWriteBuffer + strlen( pcHeader ) );
\r
246 /* There is no more data to return after this single string, so return
\r
250 /*-----------------------------------------------------------*/
\r
252 static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
254 const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n";
\r
255 BaseType_t xSpacePadding;
\r
257 /* Remove compile time warnings about unused parameters, and check the
\r
258 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
259 write buffer length is adequate, so does not check for buffer overflows. */
\r
260 ( void ) pcCommandString;
\r
261 ( void ) xWriteBufferLen;
\r
262 configASSERT( pcWriteBuffer );
\r
264 /* Generate a table of task stats. */
\r
265 strcpy( pcWriteBuffer, "Task" );
\r
266 pcWriteBuffer += strlen( pcWriteBuffer );
\r
268 /* Pad the string "task" with however many bytes necessary to make it the
\r
269 length of a task name. Minus three for the null terminator and half the
\r
270 number of characters in "Task" so the column lines up with the centre of
\r
272 for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
\r
274 /* Add a space to align columns after the task's name. */
\r
275 *pcWriteBuffer = ' ';
\r
278 /* Ensure always terminated. */
\r
279 *pcWriteBuffer = 0x00;
\r
282 strcpy( pcWriteBuffer, pcHeader );
\r
283 vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
\r
285 /* There is no more data to return after this single string, so return
\r
289 /*-----------------------------------------------------------*/
\r
291 static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
293 const char *pcParameter;
\r
294 BaseType_t xParameterStringLength, xReturn;
\r
295 static BaseType_t lParameterNumber = 0;
\r
297 /* Remove compile time warnings about unused parameters, and check the
\r
298 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
299 write buffer length is adequate, so does not check for buffer overflows. */
\r
300 ( void ) pcCommandString;
\r
301 ( void ) xWriteBufferLen;
\r
302 configASSERT( pcWriteBuffer );
\r
304 if( lParameterNumber == 0 )
\r
306 /* The first time the function is called after the command has been
\r
307 entered just a header string is returned. */
\r
308 sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
\r
310 /* Next time the function is called the first parameter will be echoed
\r
312 lParameterNumber = 1L;
\r
314 /* There is more data to be returned as no parameters have been echoed
\r
320 /* Obtain the parameter string. */
\r
321 pcParameter = FreeRTOS_CLIGetParameter
\r
323 pcCommandString, /* The command string itself. */
\r
324 lParameterNumber, /* Return the next parameter. */
\r
325 &xParameterStringLength /* Store the parameter string length. */
\r
328 /* Sanity check something was returned. */
\r
329 configASSERT( pcParameter );
\r
331 /* Return the parameter string. */
\r
332 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
333 sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
\r
334 strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
\r
335 strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
337 /* If this is the last of the three parameters then there are no more
\r
338 strings to return after this one. */
\r
339 if( lParameterNumber == 3L )
\r
341 /* If this is the last of the three parameters then there are no more
\r
342 strings to return after this one. */
\r
344 lParameterNumber = 0L;
\r
348 /* There are more parameters to return after this one. */
\r
350 lParameterNumber++;
\r
356 /*-----------------------------------------------------------*/
\r
358 static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
360 const char *pcParameter;
\r
361 BaseType_t xParameterStringLength, xReturn;
\r
362 static BaseType_t lParameterNumber = 0;
\r
364 /* Remove compile time warnings about unused parameters, and check the
\r
365 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
366 write buffer length is adequate, so does not check for buffer overflows. */
\r
367 ( void ) pcCommandString;
\r
368 ( void ) xWriteBufferLen;
\r
369 configASSERT( pcWriteBuffer );
\r
371 if( lParameterNumber == 0 )
\r
373 /* The first time the function is called after the command has been
\r
374 entered just a header string is returned. */
\r
375 sprintf( pcWriteBuffer, "The parameters were:\r\n" );
\r
377 /* Next time the function is called the first parameter will be echoed
\r
379 lParameterNumber = 1L;
\r
381 /* There is more data to be returned as no parameters have been echoed
\r
387 /* Obtain the parameter string. */
\r
388 pcParameter = FreeRTOS_CLIGetParameter
\r
390 pcCommandString, /* The command string itself. */
\r
391 lParameterNumber, /* Return the next parameter. */
\r
392 &xParameterStringLength /* Store the parameter string length. */
\r
395 if( pcParameter != NULL )
\r
397 /* Return the parameter string. */
\r
398 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
399 sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
\r
400 strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
\r
401 strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
403 /* There might be more parameters to return after this one. */
\r
405 lParameterNumber++;
\r
409 /* No more parameters were found. Make sure the write buffer does
\r
410 not contain a valid string. */
\r
411 pcWriteBuffer[ 0 ] = 0x00;
\r
413 /* No more data to return. */
\r
416 /* Start over the next time this command is executed. */
\r
417 lParameterNumber = 0;
\r
423 /*-----------------------------------------------------------*/
\r
425 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
427 static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
429 char * pcParameter;
\r
430 BaseType_t lParameterStringLength, xReturn;
\r
431 uint32_t ulIPAddress, ulBytesToPing;
\r
432 const uint32_t ulDefaultBytesToPing = 8UL;
\r
433 char cBuffer[ 16 ];
\r
435 /* Remove compile time warnings about unused parameters, and check the
\r
436 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
437 write buffer length is adequate, so does not check for buffer overflows. */
\r
438 ( void ) pcCommandString;
\r
439 ( void ) xWriteBufferLen;
\r
440 configASSERT( pcWriteBuffer );
\r
442 /* Start with an empty string. */
\r
443 pcWriteBuffer[ 0 ] = 0x00;
\r
445 /* Obtain the number of bytes to ping. */
\r
446 pcParameter = ( char * ) FreeRTOS_CLIGetParameter
\r
448 pcCommandString, /* The command string itself. */
\r
449 2, /* Return the second parameter. */
\r
450 &lParameterStringLength /* Store the parameter string length. */
\r
453 if( pcParameter == NULL )
\r
455 /* The number of bytes was not specified, so default it. */
\r
456 ulBytesToPing = ulDefaultBytesToPing;
\r
460 ulBytesToPing = atol( pcParameter );
\r
463 /* Obtain the IP address string. */
\r
464 pcParameter = ( char * ) FreeRTOS_CLIGetParameter
\r
466 pcCommandString, /* The command string itself. */
\r
467 1, /* Return the first parameter. */
\r
468 &lParameterStringLength /* Store the parameter string length. */
\r
471 /* Sanity check something was returned. */
\r
472 configASSERT( pcParameter );
\r
474 /* Attempt to obtain the IP address. If the first character is not a
\r
475 digit, assume the host name has been passed in. */
\r
476 if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) )
\r
478 ulIPAddress = FreeRTOS_inet_addr( pcParameter );
\r
482 /* Terminate the host name. */
\r
483 pcParameter[ lParameterStringLength ] = 0x00;
\r
485 /* Attempt to resolve host. */
\r
486 ulIPAddress = FreeRTOS_gethostbyname( pcParameter );
\r
489 /* Convert IP address, which may have come from a DNS lookup, to string. */
\r
490 FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
\r
492 if( ulIPAddress != 0 )
\r
494 xReturn = FreeRTOS_SendPingRequest( ulIPAddress, ( uint16_t ) ulBytesToPing, portMAX_DELAY );
\r
501 if( xReturn == pdFALSE )
\r
503 sprintf( pcWriteBuffer, "%s", "Could not send ping request\r\n" );
\r
507 sprintf( pcWriteBuffer, "Ping sent to %s with identifier %d\r\n", cBuffer, xReturn );
\r
512 /*-----------------------------------------------------------*/
\r
514 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
516 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
518 static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
520 static BaseType_t xIndex = -1;
\r
521 extern xExampleDebugStatEntry_t xIPTraceValues[];
\r
522 BaseType_t xReturn;
\r
524 /* Remove compile time warnings about unused parameters, and check the
\r
525 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
526 write buffer length is adequate, so does not check for buffer overflows. */
\r
527 ( void ) pcCommandString;
\r
528 ( void ) xWriteBufferLen;
\r
529 configASSERT( pcWriteBuffer );
\r
533 if( xIndex < xExampleDebugStatEntries() )
\r
535 sprintf( pcWriteBuffer, "%s %d\r\n", xIPTraceValues[ xIndex ].pucDescription, ( int ) xIPTraceValues[ xIndex ].ulData );
\r
540 /* Reset the index for the next time it is called. */
\r
543 /* Ensure nothing remains in the write buffer. */
\r
544 pcWriteBuffer[ 0 ] = 0x00;
\r
550 /*-----------------------------------------------------------*/
\r
552 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
554 static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
556 static BaseType_t xIndex = 0;
\r
557 BaseType_t xReturn;
\r
558 uint32_t ulAddress;
\r
560 /* Remove compile time warnings about unused parameters, and check the
\r
561 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
562 write buffer length is adequate, so does not check for buffer overflows. */
\r
563 ( void ) pcCommandString;
\r
564 ( void ) xWriteBufferLen;
\r
565 configASSERT( pcWriteBuffer );
\r
570 FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL );
\r
571 sprintf( pcWriteBuffer, "\r\nIP address " );
\r
577 FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL );
\r
578 sprintf( pcWriteBuffer, "\r\nNet mask " );
\r
584 FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL );
\r
585 sprintf( pcWriteBuffer, "\r\nGateway address " );
\r
591 FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress );
\r
592 sprintf( pcWriteBuffer, "\r\nDNS server address " );
\r
599 sprintf( pcWriteBuffer, "\r\n\r\n" );
\r
605 if( ulAddress != 0 )
\r
607 FreeRTOS_inet_ntoa( ulAddress, &( pcWriteBuffer[ strlen( pcWriteBuffer ) ] ) );
\r
612 /*-----------------------------------------------------------*/
\r
614 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
616 static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
618 const char *pcParameter;
\r
619 BaseType_t lParameterStringLength;
\r
621 /* Remove compile time warnings about unused parameters, and check the
\r
622 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
623 write buffer length is adequate, so does not check for buffer overflows. */
\r
624 ( void ) pcCommandString;
\r
625 ( void ) xWriteBufferLen;
\r
626 configASSERT( pcWriteBuffer );
\r
628 /* Obtain the parameter string. */
\r
629 pcParameter = FreeRTOS_CLIGetParameter
\r
631 pcCommandString, /* The command string itself. */
\r
632 1, /* Return the first parameter. */
\r
633 &lParameterStringLength /* Store the parameter string length. */
\r
636 /* Sanity check something was returned. */
\r
637 configASSERT( pcParameter );
\r
639 /* There are only two valid parameter values. */
\r
640 if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
\r
642 /* Start or restart the trace. */
\r
647 sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
\r
649 else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
\r
651 /* End the trace, if one is running. */
\r
653 sprintf( pcWriteBuffer, "Stopping trace recording.\r\n" );
\r
657 sprintf( pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
\r
660 /* There is no more data to return after this single string, so return
\r
665 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r