2 FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
\r
4 FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
\r
5 http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 ***************************************************************************
\r
9 * FreeRTOS tutorial books are available in pdf and paperback. *
\r
10 * Complete, revised, and edited pdf reference manuals are also *
\r
13 * Purchasing FreeRTOS documentation will not only help you, by *
\r
14 * ensuring you get running as quickly as possible and with an *
\r
15 * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
16 * the FreeRTOS project to continue with its mission of providing *
\r
17 * professional grade, cross platform, de facto standard solutions *
\r
18 * for microcontrollers - completely free of charge! *
\r
20 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
22 * Thank you for using FreeRTOS, and thank you for your support! *
\r
24 ***************************************************************************
\r
27 This file is part of the FreeRTOS distribution.
\r
29 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
30 the terms of the GNU General Public License (version 2) as published by the
\r
31 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
33 >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
\r
34 distribute a combined work that includes FreeRTOS without being obliged to
\r
35 provide the source code for proprietary components outside of the FreeRTOS
\r
38 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
39 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
40 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
\r
41 details. You should have received a copy of the GNU General Public License
\r
42 and the FreeRTOS license exception along with FreeRTOS; if not itcan be
\r
43 viewed here: http://www.freertos.org/a00114.html and also obtained by
\r
44 writing to Real Time Engineers Ltd., contact details for whom are available
\r
45 on the FreeRTOS WEB site.
\r
49 ***************************************************************************
\r
51 * Having a problem? Start by reading the FAQ "My application does *
\r
52 * not run, what could be wrong?" *
\r
54 * http://www.FreeRTOS.org/FAQHelp.html *
\r
56 ***************************************************************************
\r
59 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
60 license and Real Time Engineers Ltd. contact details.
\r
62 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
63 including FreeRTOS+Trace - an indispensable productivity tool, and our new
\r
64 fully thread aware and reentrant UDP/IP stack.
\r
66 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
67 Integrity Systems, who sell the code with commercial support,
\r
68 indemnification and middleware, under the OpenRTOS brand.
\r
70 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
71 engineered and independently SIL3 certified version for use in safety and
\r
72 mission critical applications that require provable dependability.
\r
75 /******************************************************************************
\r
77 * See the following URL for information on the commands defined in this file:
\r
78 * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Examples/Ethernet_Related_CLI_Commands.shtml
\r
80 ******************************************************************************/
\r
83 /* FreeRTOS includes. */
\r
84 #include "FreeRTOS.h"
\r
87 /* Standard includes. */
\r
92 /* FreeRTOS+CLI includes. */
\r
93 #include "FreeRTOS_CLI.h"
\r
95 /* FreeRTOS+UDP includes, just to make the stats available to the CLI
\r
97 #include "FreeRTOS_UDP_IP.h"
\r
98 #include "FreeRTOS_Sockets.h"
\r
100 #ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
\r
101 #define configINCLUDE_TRACE_RELATED_CLI_COMMANDS 0
\r
106 * Implements the run-time-stats command.
\r
108 static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
111 * Implements the task-stats command.
\r
113 static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
116 * Implements the echo-three-parameters command.
\r
118 static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
121 * Implements the echo-parameters command.
\r
123 static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
126 * Defines a command that prints out IP address information.
\r
128 static portBASE_TYPE prvDisplayIPConfig( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
131 * Defines a command that prints out the gathered demo debug stats.
\r
133 static portBASE_TYPE prvDisplayIPDebugStats( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
136 * Defines a command that sends an ICMP ping request to an IP address.
\r
138 static portBASE_TYPE prvPingCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
141 * Implements the "trace start" and "trace stop" commands;
\r
143 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
144 static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
\r
147 /* Structure that defines the "ip-config" command line command. */
\r
148 static const CLI_Command_Definition_t xIPConfig =
\r
150 ( const int8_t * const ) "ip-config",
\r
151 ( const int8_t * const ) "ip-config:\r\n Displays IP address configuration\r\n\r\n",
\r
152 prvDisplayIPConfig,
\r
156 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
157 /* Structure that defines the "ip-debug-stats" command line command. */
\r
158 static const CLI_Command_Definition_t xIPDebugStats =
\r
160 ( const int8_t * const ) "ip-debug-stats", /* The command string to type. */
\r
161 ( const int8_t * const ) "ip-debug-stats:\r\n Shows some IP stack stats useful for debug - an example only.\r\n\r\n",
\r
162 prvDisplayIPDebugStats, /* The function to run. */
\r
163 0 /* No parameters are expected. */
\r
165 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
167 /* Structure that defines the "run-time-stats" command line command. This
\r
168 generates a table that shows how much run time each task has */
\r
169 static const CLI_Command_Definition_t xRunTimeStats =
\r
171 ( const int8_t * const ) "run-time-stats", /* The command string to type. */
\r
172 ( const int8_t * const ) "run-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n\r\n",
\r
173 prvRunTimeStatsCommand, /* The function to run. */
\r
174 0 /* No parameters are expected. */
\r
177 /* Structure that defines the "task-stats" command line command. This generates
\r
178 a table that gives information on each task in the system. */
\r
179 static const CLI_Command_Definition_t xTaskStats =
\r
181 ( const int8_t * const ) "task-stats", /* The command string to type. */
\r
182 ( const int8_t * const ) "task-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n\r\n",
\r
183 prvTaskStatsCommand, /* The function to run. */
\r
184 0 /* No parameters are expected. */
\r
187 /* Structure that defines the "echo_3_parameters" command line command. This
\r
188 takes exactly three parameters that the command simply echos back one at a
\r
190 static const CLI_Command_Definition_t xThreeParameterEcho =
\r
192 ( const int8_t * const ) "echo-3-parameters",
\r
193 ( const int8_t * const ) "echo-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n\r\n",
\r
194 prvThreeParameterEchoCommand, /* The function to run. */
\r
195 3 /* Three parameters are expected, which can take any value. */
\r
198 /* Structure that defines the "echo_parameters" command line command. This
\r
199 takes a variable number of parameters that the command simply echos back one at
\r
201 static const CLI_Command_Definition_t xParameterEcho =
\r
203 ( const int8_t * const ) "echo-parameters",
\r
204 ( const int8_t * const ) "echo-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n\r\n",
\r
205 prvParameterEchoCommand, /* The function to run. */
\r
206 -1 /* The user can enter any number of commands. */
\r
209 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
211 /* Structure that defines the "ping" command line command. This takes an IP
\r
212 address or host name and (optionally) the number of bytes to ping as
\r
214 static const CLI_Command_Definition_t xPing =
\r
216 ( const int8_t * const ) "ping",
\r
217 ( const int8_t * const ) "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
218 prvPingCommand, /* The function to run. */
\r
219 -1 /* Ping can take either one or two parameter, so the number of parameters has to be determined by the ping command implementation. */
\r
222 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
224 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
225 /* Structure that defines the "trace" command line command. This takes a single
\r
226 parameter, which can be either "start" or "stop". */
\r
227 static const CLI_Command_Definition_t xStartStopTrace =
\r
229 ( const int8_t * const ) "trace",
\r
230 ( const int8_t * const ) "trace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n\r\n",
\r
231 prvStartStopTraceCommand, /* The function to run. */
\r
232 1 /* One parameter is expected. Valid values are "start" and "stop". */
\r
234 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r
236 /*-----------------------------------------------------------*/
\r
238 void vRegisterCLICommands( void )
\r
240 /* Register all the command line commands defined immediately above. */
\r
241 FreeRTOS_CLIRegisterCommand( &xTaskStats );
\r
242 FreeRTOS_CLIRegisterCommand( &xRunTimeStats );
\r
243 FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho );
\r
244 FreeRTOS_CLIRegisterCommand( &xParameterEcho );
\r
245 FreeRTOS_CLIRegisterCommand( &xIPDebugStats );
\r
246 FreeRTOS_CLIRegisterCommand( &xIPConfig );
\r
248 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
250 FreeRTOS_CLIRegisterCommand( &xPing );
\r
252 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
254 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
255 FreeRTOS_CLIRegisterCommand( & xStartStopTrace );
\r
258 /*-----------------------------------------------------------*/
\r
260 static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
262 const int8_t *const pcHeader = ( int8_t * ) "Task State Priority Stack #\r\n************************************************\r\n";
\r
264 /* Remove compile time warnings about unused parameters, and check the
\r
265 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
266 write buffer length is adequate, so does not check for buffer overflows. */
\r
267 ( void ) pcCommandString;
\r
268 ( void ) xWriteBufferLen;
\r
269 configASSERT( pcWriteBuffer );
\r
271 /* Generate a table of task stats. */
\r
272 strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
\r
273 vTaskList( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
\r
275 /* There is no more data to return after this single string, so return
\r
279 /*-----------------------------------------------------------*/
\r
281 static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
283 const int8_t * const pcHeader = ( int8_t * ) "Task Abs Time % Time\r\n****************************************\r\n";
\r
285 /* Remove compile time warnings about unused parameters, and check the
\r
286 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
287 write buffer length is adequate, so does not check for buffer overflows. */
\r
288 ( void ) pcCommandString;
\r
289 ( void ) xWriteBufferLen;
\r
290 configASSERT( pcWriteBuffer );
\r
292 /* Generate a table of task stats. */
\r
293 strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader );
\r
294 vTaskGetRunTimeStats( pcWriteBuffer + strlen( ( char * ) pcHeader ) );
\r
296 /* There is no more data to return after this single string, so return
\r
300 /*-----------------------------------------------------------*/
\r
302 static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
304 int8_t *pcParameter;
\r
305 portBASE_TYPE xParameterStringLength, xReturn;
\r
306 static portBASE_TYPE lParameterNumber = 0;
\r
308 /* Remove compile time warnings about unused parameters, and check the
\r
309 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
310 write buffer length is adequate, so does not check for buffer overflows. */
\r
311 ( void ) pcCommandString;
\r
312 ( void ) xWriteBufferLen;
\r
313 configASSERT( pcWriteBuffer );
\r
315 if( lParameterNumber == 0 )
\r
317 /* The first time the function is called after the command has been
\r
318 entered just a header string is returned. */
\r
319 sprintf( ( char * ) pcWriteBuffer, "The three parameters were:\r\n" );
\r
321 /* Next time the function is called the first parameter will be echoed
\r
323 lParameterNumber = 1L;
\r
325 /* There is more data to be returned as no parameters have been echoed
\r
331 /* Obtain the parameter string. */
\r
332 pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
\r
334 pcCommandString, /* The command string itself. */
\r
335 lParameterNumber, /* Return the next parameter. */
\r
336 &xParameterStringLength /* Store the parameter string length. */
\r
339 /* Sanity check something was returned. */
\r
340 configASSERT( pcParameter );
\r
342 /* Return the parameter string. */
\r
343 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
344 sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
\r
345 strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength );
\r
346 strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
348 /* If this is the last of the three parameters then there are no more
\r
349 strings to return after this one. */
\r
350 if( lParameterNumber == 3L )
\r
352 /* If this is the last of the three parameters then there are no more
\r
353 strings to return after this one. */
\r
355 lParameterNumber = 0L;
\r
359 /* There are more parameters to return after this one. */
\r
361 lParameterNumber++;
\r
367 /*-----------------------------------------------------------*/
\r
369 static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
371 int8_t *pcParameter;
\r
372 portBASE_TYPE xParameterStringLength, xReturn;
\r
373 static portBASE_TYPE lParameterNumber = 0;
\r
375 /* Remove compile time warnings about unused parameters, and check the
\r
376 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
377 write buffer length is adequate, so does not check for buffer overflows. */
\r
378 ( void ) pcCommandString;
\r
379 ( void ) xWriteBufferLen;
\r
380 configASSERT( pcWriteBuffer );
\r
382 if( lParameterNumber == 0 )
\r
384 /* The first time the function is called after the command has been
\r
385 entered just a header string is returned. */
\r
386 sprintf( ( char * ) pcWriteBuffer, "The parameters were:\r\n" );
\r
388 /* Next time the function is called the first parameter will be echoed
\r
390 lParameterNumber = 1L;
\r
392 /* There is more data to be returned as no parameters have been echoed
\r
398 /* Obtain the parameter string. */
\r
399 pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
\r
401 pcCommandString, /* The command string itself. */
\r
402 lParameterNumber, /* Return the next parameter. */
\r
403 &xParameterStringLength /* Store the parameter string length. */
\r
406 if( pcParameter != NULL )
\r
408 /* Return the parameter string. */
\r
409 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
410 sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
\r
411 strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength );
\r
412 strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
414 /* There might be more parameters to return after this one. */
\r
416 lParameterNumber++;
\r
420 /* No more parameters were found. Make sure the write buffer does
\r
421 not contain a valid string. */
\r
422 pcWriteBuffer[ 0 ] = 0x00;
\r
424 /* No more data to return. */
\r
427 /* Start over the next time this command is executed. */
\r
428 lParameterNumber = 0;
\r
434 /*-----------------------------------------------------------*/
\r
436 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
438 static portBASE_TYPE prvPingCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
440 int8_t * pcParameter;
\r
441 portBASE_TYPE lParameterStringLength, xReturn;
\r
442 uint32_t ulIPAddress, ulBytesToPing;
\r
443 const uint32_t ulDefaultBytesToPing = 8UL;
\r
444 int8_t cBuffer[ 16 ];
\r
446 /* Remove compile time warnings about unused parameters, and check the
\r
447 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
448 write buffer length is adequate, so does not check for buffer overflows. */
\r
449 ( void ) pcCommandString;
\r
450 ( void ) xWriteBufferLen;
\r
451 configASSERT( pcWriteBuffer );
\r
453 /* Start with an empty string. */
\r
454 pcWriteBuffer[ 0 ] = 0x00;
\r
456 /* Obtain the number of bytes to ping. */
\r
457 pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
\r
459 pcCommandString, /* The command string itself. */
\r
460 2, /* Return the second parameter. */
\r
461 &lParameterStringLength /* Store the parameter string length. */
\r
464 if( pcParameter == NULL )
\r
466 /* The number of bytes was not specified, so default it. */
\r
467 ulBytesToPing = ulDefaultBytesToPing;
\r
471 ulBytesToPing = atol( ( const char * ) pcParameter );
\r
474 /* Obtain the IP address string. */
\r
475 pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
\r
477 pcCommandString, /* The command string itself. */
\r
478 1, /* Return the first parameter. */
\r
479 &lParameterStringLength /* Store the parameter string length. */
\r
482 /* Sanity check something was returned. */
\r
483 configASSERT( pcParameter );
\r
485 /* Attempt to obtain the IP address. If the first character is not a
\r
486 digit, assume the host name has been passed in. */
\r
487 if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) )
\r
489 ulIPAddress = FreeRTOS_inet_addr( ( const uint8_t * ) pcParameter );
\r
493 /* Terminate the host name. */
\r
494 pcParameter[ lParameterStringLength ] = 0x00;
\r
496 /* Attempt to resolve host. */
\r
497 ulIPAddress = FreeRTOS_gethostbyname( ( uint8_t * ) pcParameter );
\r
500 /* Convert IP address, which may have come from a DNS lookup, to string. */
\r
501 FreeRTOS_inet_ntoa( ulIPAddress, ( char * ) cBuffer );
\r
503 if( ulIPAddress != 0 )
\r
505 xReturn = FreeRTOS_SendPingRequest( ulIPAddress, ( uint16_t ) ulBytesToPing, portMAX_DELAY );
\r
512 if( xReturn == pdFALSE )
\r
514 sprintf( ( char * ) pcWriteBuffer, "%s", "Could not send ping request\r\n" );
\r
518 sprintf( ( char * ) pcWriteBuffer, "Ping sent to %s with identifier %d\r\n", cBuffer, xReturn );
\r
523 /*-----------------------------------------------------------*/
\r
525 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
527 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
529 static portBASE_TYPE prvDisplayIPDebugStats( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
531 static portBASE_TYPE xIndex = -1;
\r
532 extern xExampleDebugStatEntry_t xIPTraceValues[];
\r
533 portBASE_TYPE xReturn;
\r
535 /* Remove compile time warnings about unused parameters, and check the
\r
536 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
537 write buffer length is adequate, so does not check for buffer overflows. */
\r
538 ( void ) pcCommandString;
\r
539 ( void ) xWriteBufferLen;
\r
540 configASSERT( pcWriteBuffer );
\r
544 if( xIndex < xExampleDebugStatEntries() )
\r
546 sprintf( ( char * ) pcWriteBuffer, "%s %d\r\n", ( char * ) xIPTraceValues[ xIndex ].pucDescription, ( int ) xIPTraceValues[ xIndex ].ulData );
\r
551 /* Reset the index for the next time it is called. */
\r
554 /* Ensure nothing remains in the write buffer. */
\r
555 pcWriteBuffer[ 0 ] = 0x00;
\r
561 /*-----------------------------------------------------------*/
\r
563 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
565 static portBASE_TYPE prvDisplayIPConfig( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
567 static portBASE_TYPE xIndex = 0;
\r
568 portBASE_TYPE xReturn;
\r
569 uint32_t ulAddress;
\r
571 /* Remove compile time warnings about unused parameters, and check the
\r
572 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
573 write buffer length is adequate, so does not check for buffer overflows. */
\r
574 ( void ) pcCommandString;
\r
575 ( void ) xWriteBufferLen;
\r
576 configASSERT( pcWriteBuffer );
\r
581 FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL );
\r
582 sprintf( ( char * ) pcWriteBuffer, "\r\nIP address " );
\r
588 FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL );
\r
589 sprintf( ( char * ) pcWriteBuffer, "\r\nNet mask " );
\r
595 FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL );
\r
596 sprintf( ( char * ) pcWriteBuffer, "\r\nGateway address " );
\r
602 FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress );
\r
603 sprintf( ( char * ) pcWriteBuffer, "\r\nDNS server address " );
\r
610 sprintf( ( char * ) pcWriteBuffer, "\r\n\r\n" );
\r
616 if( ulAddress != 0 )
\r
618 FreeRTOS_inet_ntoa( ulAddress, ( ( char * ) &( pcWriteBuffer[ strlen( ( char * ) pcWriteBuffer ) ] ) ) );
\r
623 /*-----------------------------------------------------------*/
\r
625 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
627 static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
\r
629 int8_t *pcParameter;
\r
630 portBASE_TYPE lParameterStringLength;
\r
632 /* Remove compile time warnings about unused parameters, and check the
\r
633 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
634 write buffer length is adequate, so does not check for buffer overflows. */
\r
635 ( void ) pcCommandString;
\r
636 ( void ) xWriteBufferLen;
\r
637 configASSERT( pcWriteBuffer );
\r
639 /* Obtain the parameter string. */
\r
640 pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
\r
642 pcCommandString, /* The command string itself. */
\r
643 1, /* Return the first parameter. */
\r
644 &lParameterStringLength /* Store the parameter string length. */
\r
647 /* Sanity check something was returned. */
\r
648 configASSERT( pcParameter );
\r
650 /* There are only two valid parameter values. */
\r
651 if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 )
\r
653 /* Start or restart the trace. */
\r
658 sprintf( ( char * ) pcWriteBuffer, "Trace recording (re)started.\r\n" );
\r
660 else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
\r
662 /* End the trace, if one is running. */
\r
664 sprintf( ( char * ) pcWriteBuffer, "Stopping trace recording.\r\n" );
\r
668 sprintf( ( char * ) pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
\r
671 /* There is no more data to return after this single string, so return
\r
676 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r