2 FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
\r
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 This file is part of the FreeRTOS distribution.
\r
9 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
10 the terms of the GNU General Public License (version 2) as published by the
\r
11 Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
\r
13 ***************************************************************************
\r
14 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
15 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
16 >>! obliged to provide the source code for proprietary components !<<
\r
17 >>! outside of the FreeRTOS kernel. !<<
\r
18 ***************************************************************************
\r
20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
23 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * FreeRTOS provides completely free yet professionally developed, *
\r
28 * robust, strictly quality controlled, supported, and cross *
\r
29 * platform software that is more than just the market leader, it *
\r
30 * is the industry's de facto standard. *
\r
32 * Help yourself get started quickly while simultaneously helping *
\r
33 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
34 * tutorial book, reference manual, or both: *
\r
35 * http://www.FreeRTOS.org/Documentation *
\r
37 ***************************************************************************
\r
39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
\r
40 the FAQ page "My application does not run, what could be wrong?". Have you
\r
41 defined configASSERT()?
\r
43 http://www.FreeRTOS.org/support - In return for receiving this top quality
\r
44 embedded software for free we request you assist our global community by
\r
45 participating in the support forum.
\r
47 http://www.FreeRTOS.org/training - Investing in training allows your team to
\r
48 be as productive as possible as early as possible. Now you can receive
\r
49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
\r
50 Ltd, and the world's leading authority on the world's leading RTOS.
\r
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
\r
60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
61 licenses offer ticketed support, indemnification and commercial middleware.
\r
63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
64 engineered and independently SIL3 certified version for use in safety and
\r
65 mission critical applications that require provable dependability.
\r
70 /******************************************************************************
\r
72 * See the following URL for information on the commands defined in this file:
\r
73 * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Examples/Ethernet_Related_CLI_Commands.shtml
\r
75 ******************************************************************************/
\r
78 /* FreeRTOS includes. */
\r
79 #include "FreeRTOS.h"
\r
82 /* Standard includes. */
\r
87 /* FreeRTOS+CLI includes. */
\r
88 #include "FreeRTOS_CLI.h"
\r
90 /* FreeRTOS+UDP includes, just to make the stats available to the CLI
\r
92 #include "FreeRTOS_UDP_IP.h"
\r
93 #include "FreeRTOS_Sockets.h"
\r
95 #ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
\r
96 #define configINCLUDE_TRACE_RELATED_CLI_COMMANDS 0
\r
101 * Implements the run-time-stats command.
\r
103 static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
106 * Implements the task-stats command.
\r
108 static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
111 * Implements the echo-three-parameters command.
\r
113 static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
116 * Implements the echo-parameters command.
\r
118 static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
121 * Defines a command that prints out IP address information.
\r
123 static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
126 * Defines a command that prints out the gathered demo debug stats.
\r
128 static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
131 * Defines a command that sends an ICMP ping request to an IP address.
\r
133 static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
136 * Implements the "trace start" and "trace stop" commands;
\r
138 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
139 static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
142 /* Structure that defines the "ip-config" command line command. */
\r
143 static const CLI_Command_Definition_t xIPConfig =
\r
146 "ip-config:\r\n Displays IP address configuration\r\n\r\n",
\r
147 prvDisplayIPConfig,
\r
151 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
152 /* Structure that defines the "ip-debug-stats" command line command. */
\r
153 static const CLI_Command_Definition_t xIPDebugStats =
\r
155 "ip-debug-stats", /* The command string to type. */
\r
156 "ip-debug-stats:\r\n Shows some IP stack stats useful for debug - an example only.\r\n\r\n",
\r
157 prvDisplayIPDebugStats, /* The function to run. */
\r
158 0 /* No parameters are expected. */
\r
160 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
162 /* Structure that defines the "run-time-stats" command line command. This
\r
163 generates a table that shows how much run time each task has */
\r
164 static const CLI_Command_Definition_t xRunTimeStats =
\r
166 "run-time-stats", /* The command string to type. */
\r
167 "run-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n\r\n",
\r
168 prvRunTimeStatsCommand, /* The function to run. */
\r
169 0 /* No parameters are expected. */
\r
172 /* Structure that defines the "task-stats" command line command. This generates
\r
173 a table that gives information on each task in the system. */
\r
174 static const CLI_Command_Definition_t xTaskStats =
\r
176 "task-stats", /* The command string to type. */
\r
177 "task-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n\r\n",
\r
178 prvTaskStatsCommand, /* The function to run. */
\r
179 0 /* No parameters are expected. */
\r
182 /* Structure that defines the "echo_3_parameters" command line command. This
\r
183 takes exactly three parameters that the command simply echos back one at a
\r
185 static const CLI_Command_Definition_t xThreeParameterEcho =
\r
187 "echo-3-parameters",
\r
188 "echo-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n\r\n",
\r
189 prvThreeParameterEchoCommand, /* The function to run. */
\r
190 3 /* Three parameters are expected, which can take any value. */
\r
193 /* Structure that defines the "echo_parameters" command line command. This
\r
194 takes a variable number of parameters that the command simply echos back one at
\r
196 static const CLI_Command_Definition_t xParameterEcho =
\r
199 "echo-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n\r\n",
\r
200 prvParameterEchoCommand, /* The function to run. */
\r
201 -1 /* The user can enter any number of commands. */
\r
204 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
206 /* Structure that defines the "ping" command line command. This takes an IP
\r
207 address or host name and (optionally) the number of bytes to ping as
\r
209 static const CLI_Command_Definition_t xPing =
\r
212 "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
213 prvPingCommand, /* The function to run. */
\r
214 -1 /* Ping can take either one or two parameter, so the number of parameters has to be determined by the ping command implementation. */
\r
217 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
219 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
220 /* Structure that defines the "trace" command line command. This takes a single
\r
221 parameter, which can be either "start" or "stop". */
\r
222 static const CLI_Command_Definition_t xStartStopTrace =
\r
225 "trace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n\r\n",
\r
226 prvStartStopTraceCommand, /* The function to run. */
\r
227 1 /* One parameter is expected. Valid values are "start" and "stop". */
\r
229 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r
231 /*-----------------------------------------------------------*/
\r
233 void vRegisterCLICommands( void )
\r
235 /* Register all the command line commands defined immediately above. */
\r
236 FreeRTOS_CLIRegisterCommand( &xTaskStats );
\r
237 FreeRTOS_CLIRegisterCommand( &xRunTimeStats );
\r
238 FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho );
\r
239 FreeRTOS_CLIRegisterCommand( &xParameterEcho );
\r
240 FreeRTOS_CLIRegisterCommand( &xIPDebugStats );
\r
241 FreeRTOS_CLIRegisterCommand( &xIPConfig );
\r
243 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
245 FreeRTOS_CLIRegisterCommand( &xPing );
\r
247 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
249 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
250 FreeRTOS_CLIRegisterCommand( & xStartStopTrace );
\r
253 /*-----------------------------------------------------------*/
\r
255 static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
257 const char *const pcHeader = " State\tPriority\tStack\t#\r\n************************************************\r\n";
\r
258 BaseType_t xSpacePadding;
\r
260 /* Remove compile time warnings about unused parameters, and check the
\r
261 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
262 write buffer length is adequate, so does not check for buffer overflows. */
\r
263 ( void ) pcCommandString;
\r
264 ( void ) xWriteBufferLen;
\r
265 configASSERT( pcWriteBuffer );
\r
267 /* Generate a table of task stats. */
\r
268 strcpy( pcWriteBuffer, "Task" );
\r
269 pcWriteBuffer += strlen( pcWriteBuffer );
\r
271 /* Pad the string "task" with however many bytes necessary to make it the
\r
272 length of a task name. Minus three for the null terminator and half the
\r
273 number of characters in "Task" so the column lines up with the centre of
\r
275 for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
\r
277 /* Add a space to align columns after the task's name. */
\r
278 *pcWriteBuffer = ' ';
\r
281 /* Ensure always terminated. */
\r
282 *pcWriteBuffer = 0x00;
\r
284 strcpy( pcWriteBuffer, pcHeader );
\r
285 vTaskList( pcWriteBuffer + strlen( pcHeader ) );
\r
287 /* There is no more data to return after this single string, so return
\r
291 /*-----------------------------------------------------------*/
\r
293 static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
295 const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n";
\r
296 BaseType_t xSpacePadding;
\r
298 /* Remove compile time warnings about unused parameters, and check the
\r
299 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
300 write buffer length is adequate, so does not check for buffer overflows. */
\r
301 ( void ) pcCommandString;
\r
302 ( void ) xWriteBufferLen;
\r
303 configASSERT( pcWriteBuffer );
\r
305 /* Generate a table of task stats. */
\r
306 strcpy( pcWriteBuffer, "Task" );
\r
307 pcWriteBuffer += strlen( pcWriteBuffer );
\r
309 /* Pad the string "task" with however many bytes necessary to make it the
\r
310 length of a task name. Minus three for the null terminator and half the
\r
311 number of characters in "Task" so the column lines up with the centre of
\r
313 for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
\r
315 /* Add a space to align columns after the task's name. */
\r
316 *pcWriteBuffer = ' ';
\r
319 /* Ensure always terminated. */
\r
320 *pcWriteBuffer = 0x00;
\r
323 strcpy( pcWriteBuffer, pcHeader );
\r
324 vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
\r
326 /* There is no more data to return after this single string, so return
\r
330 /*-----------------------------------------------------------*/
\r
332 static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
334 const char *pcParameter;
\r
335 BaseType_t xParameterStringLength, xReturn;
\r
336 static BaseType_t lParameterNumber = 0;
\r
338 /* Remove compile time warnings about unused parameters, and check the
\r
339 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
340 write buffer length is adequate, so does not check for buffer overflows. */
\r
341 ( void ) pcCommandString;
\r
342 ( void ) xWriteBufferLen;
\r
343 configASSERT( pcWriteBuffer );
\r
345 if( lParameterNumber == 0 )
\r
347 /* The first time the function is called after the command has been
\r
348 entered just a header string is returned. */
\r
349 sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
\r
351 /* Next time the function is called the first parameter will be echoed
\r
353 lParameterNumber = 1L;
\r
355 /* There is more data to be returned as no parameters have been echoed
\r
361 /* Obtain the parameter string. */
\r
362 pcParameter = FreeRTOS_CLIGetParameter
\r
364 pcCommandString, /* The command string itself. */
\r
365 lParameterNumber, /* Return the next parameter. */
\r
366 &xParameterStringLength /* Store the parameter string length. */
\r
369 /* Sanity check something was returned. */
\r
370 configASSERT( pcParameter );
\r
372 /* Return the parameter string. */
\r
373 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
374 sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
\r
375 strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
\r
376 strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
378 /* If this is the last of the three parameters then there are no more
\r
379 strings to return after this one. */
\r
380 if( lParameterNumber == 3L )
\r
382 /* If this is the last of the three parameters then there are no more
\r
383 strings to return after this one. */
\r
385 lParameterNumber = 0L;
\r
389 /* There are more parameters to return after this one. */
\r
391 lParameterNumber++;
\r
397 /*-----------------------------------------------------------*/
\r
399 static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
401 const char *pcParameter;
\r
402 BaseType_t xParameterStringLength, xReturn;
\r
403 static BaseType_t lParameterNumber = 0;
\r
405 /* Remove compile time warnings about unused parameters, and check the
\r
406 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
407 write buffer length is adequate, so does not check for buffer overflows. */
\r
408 ( void ) pcCommandString;
\r
409 ( void ) xWriteBufferLen;
\r
410 configASSERT( pcWriteBuffer );
\r
412 if( lParameterNumber == 0 )
\r
414 /* The first time the function is called after the command has been
\r
415 entered just a header string is returned. */
\r
416 sprintf( pcWriteBuffer, "The parameters were:\r\n" );
\r
418 /* Next time the function is called the first parameter will be echoed
\r
420 lParameterNumber = 1L;
\r
422 /* There is more data to be returned as no parameters have been echoed
\r
428 /* Obtain the parameter string. */
\r
429 pcParameter = FreeRTOS_CLIGetParameter
\r
431 pcCommandString, /* The command string itself. */
\r
432 lParameterNumber, /* Return the next parameter. */
\r
433 &xParameterStringLength /* Store the parameter string length. */
\r
436 if( pcParameter != NULL )
\r
438 /* Return the parameter string. */
\r
439 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
440 sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
\r
441 strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
\r
442 strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
444 /* There might be more parameters to return after this one. */
\r
446 lParameterNumber++;
\r
450 /* No more parameters were found. Make sure the write buffer does
\r
451 not contain a valid string. */
\r
452 pcWriteBuffer[ 0 ] = 0x00;
\r
454 /* No more data to return. */
\r
457 /* Start over the next time this command is executed. */
\r
458 lParameterNumber = 0;
\r
464 /*-----------------------------------------------------------*/
\r
466 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
468 static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
470 char * pcParameter;
\r
471 BaseType_t lParameterStringLength, xReturn;
\r
472 uint32_t ulIPAddress, ulBytesToPing;
\r
473 const uint32_t ulDefaultBytesToPing = 8UL;
\r
474 char cBuffer[ 16 ];
\r
476 /* Remove compile time warnings about unused parameters, and check the
\r
477 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
478 write buffer length is adequate, so does not check for buffer overflows. */
\r
479 ( void ) pcCommandString;
\r
480 ( void ) xWriteBufferLen;
\r
481 configASSERT( pcWriteBuffer );
\r
483 /* Start with an empty string. */
\r
484 pcWriteBuffer[ 0 ] = 0x00;
\r
486 /* Obtain the number of bytes to ping. */
\r
487 pcParameter = ( char * ) FreeRTOS_CLIGetParameter
\r
489 pcCommandString, /* The command string itself. */
\r
490 2, /* Return the second parameter. */
\r
491 &lParameterStringLength /* Store the parameter string length. */
\r
494 if( pcParameter == NULL )
\r
496 /* The number of bytes was not specified, so default it. */
\r
497 ulBytesToPing = ulDefaultBytesToPing;
\r
501 ulBytesToPing = atol( pcParameter );
\r
504 /* Obtain the IP address string. */
\r
505 pcParameter = ( char * ) FreeRTOS_CLIGetParameter
\r
507 pcCommandString, /* The command string itself. */
\r
508 1, /* Return the first parameter. */
\r
509 &lParameterStringLength /* Store the parameter string length. */
\r
512 /* Sanity check something was returned. */
\r
513 configASSERT( pcParameter );
\r
515 /* Attempt to obtain the IP address. If the first character is not a
\r
516 digit, assume the host name has been passed in. */
\r
517 if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) )
\r
519 ulIPAddress = FreeRTOS_inet_addr( pcParameter );
\r
523 /* Terminate the host name. */
\r
524 pcParameter[ lParameterStringLength ] = 0x00;
\r
526 /* Attempt to resolve host. */
\r
527 ulIPAddress = FreeRTOS_gethostbyname( pcParameter );
\r
530 /* Convert IP address, which may have come from a DNS lookup, to string. */
\r
531 FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
\r
533 if( ulIPAddress != 0 )
\r
535 xReturn = FreeRTOS_SendPingRequest( ulIPAddress, ( uint16_t ) ulBytesToPing, portMAX_DELAY );
\r
542 if( xReturn == pdFALSE )
\r
544 sprintf( pcWriteBuffer, "%s", "Could not send ping request\r\n" );
\r
548 sprintf( pcWriteBuffer, "Ping sent to %s with identifier %d\r\n", cBuffer, xReturn );
\r
553 /*-----------------------------------------------------------*/
\r
555 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
557 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
559 static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
561 static BaseType_t xIndex = -1;
\r
562 extern xExampleDebugStatEntry_t xIPTraceValues[];
\r
563 BaseType_t xReturn;
\r
565 /* Remove compile time warnings about unused parameters, and check the
\r
566 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
567 write buffer length is adequate, so does not check for buffer overflows. */
\r
568 ( void ) pcCommandString;
\r
569 ( void ) xWriteBufferLen;
\r
570 configASSERT( pcWriteBuffer );
\r
574 if( xIndex < xExampleDebugStatEntries() )
\r
576 sprintf( pcWriteBuffer, "%s %d\r\n", xIPTraceValues[ xIndex ].pucDescription, ( int ) xIPTraceValues[ xIndex ].ulData );
\r
581 /* Reset the index for the next time it is called. */
\r
584 /* Ensure nothing remains in the write buffer. */
\r
585 pcWriteBuffer[ 0 ] = 0x00;
\r
591 /*-----------------------------------------------------------*/
\r
593 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
595 static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
597 static BaseType_t xIndex = 0;
\r
598 BaseType_t xReturn;
\r
599 uint32_t ulAddress;
\r
601 /* Remove compile time warnings about unused parameters, and check the
\r
602 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
603 write buffer length is adequate, so does not check for buffer overflows. */
\r
604 ( void ) pcCommandString;
\r
605 ( void ) xWriteBufferLen;
\r
606 configASSERT( pcWriteBuffer );
\r
611 FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL );
\r
612 sprintf( pcWriteBuffer, "\r\nIP address " );
\r
618 FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL );
\r
619 sprintf( pcWriteBuffer, "\r\nNet mask " );
\r
625 FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL );
\r
626 sprintf( pcWriteBuffer, "\r\nGateway address " );
\r
632 FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress );
\r
633 sprintf( pcWriteBuffer, "\r\nDNS server address " );
\r
640 sprintf( pcWriteBuffer, "\r\n\r\n" );
\r
646 if( ulAddress != 0 )
\r
648 FreeRTOS_inet_ntoa( ulAddress, &( pcWriteBuffer[ strlen( pcWriteBuffer ) ] ) );
\r
653 /*-----------------------------------------------------------*/
\r
655 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
657 static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
659 const char *pcParameter;
\r
660 BaseType_t lParameterStringLength;
\r
662 /* Remove compile time warnings about unused parameters, and check the
\r
663 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
664 write buffer length is adequate, so does not check for buffer overflows. */
\r
665 ( void ) pcCommandString;
\r
666 ( void ) xWriteBufferLen;
\r
667 configASSERT( pcWriteBuffer );
\r
669 /* Obtain the parameter string. */
\r
670 pcParameter = FreeRTOS_CLIGetParameter
\r
672 pcCommandString, /* The command string itself. */
\r
673 1, /* Return the first parameter. */
\r
674 &lParameterStringLength /* Store the parameter string length. */
\r
677 /* Sanity check something was returned. */
\r
678 configASSERT( pcParameter );
\r
680 /* There are only two valid parameter values. */
\r
681 if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
\r
683 /* Start or restart the trace. */
\r
688 sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
\r
690 else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
\r
692 /* End the trace, if one is running. */
\r
694 sprintf( pcWriteBuffer, "Stopping trace recording.\r\n" );
\r
698 sprintf( pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
\r
701 /* There is no more data to return after this single string, so return
\r
706 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r