2 FreeRTOS V9.0.0 - Copyright (C) 2016 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 /* Standard includes. */
\r
75 /* FreeRTOS includes. */
\r
76 #include "FreeRTOS.h"
\r
79 /* FreeRTOS+CLI includes. */
\r
80 #include "FreeRTOS_CLI.h"
\r
82 /* FreeRTOS+TCP includes, just to make the stats available to the CLI
\r
84 #include "FreeRTOS_IP.h"
\r
85 #include "FreeRTOS_Sockets.h"
\r
87 #ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
\r
88 #define configINCLUDE_TRACE_RELATED_CLI_COMMANDS 0
\r
93 * Implements the run-time-stats command.
\r
95 static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
98 * Implements the task-stats command.
\r
100 static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
103 * Implements the echo-three-parameters command.
\r
105 static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
108 * Implements the echo-parameters command.
\r
110 static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
113 * Defines a command that prints out IP address information.
\r
115 static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
118 * Defines a command that prints out the gathered demo debug stats.
\r
120 static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
123 * Defines a command that sends an ICMP ping request to an IP address.
\r
125 static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
128 * Defines a command that calls FreeRTOS_netstat().
\r
130 static BaseType_t prvNetStatCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
133 * Implements the "trace start" and "trace stop" commands;
\r
135 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
136 static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
\r
139 /* Structure that defines the "ip-config" command line command. */
\r
140 static const CLI_Command_Definition_t xIPConfig =
\r
143 "ip-config:\r\n Displays IP address configuration\r\n\r\n",
\r
144 prvDisplayIPConfig,
\r
148 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
149 /* Structure that defines the "ip-debug-stats" command line command. */
\r
150 static const CLI_Command_Definition_t xIPDebugStats =
\r
152 "ip-debug-stats", /* The command string to type. */
\r
153 "ip-debug-stats:\r\n Shows some IP stack stats useful for debug - an example only.\r\n\r\n",
\r
154 prvDisplayIPDebugStats, /* The function to run. */
\r
155 0 /* No parameters are expected. */
\r
157 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
159 /* Structure that defines the "run-time-stats" command line command. This
\r
160 generates a table that shows how much run time each task has */
\r
161 static const CLI_Command_Definition_t xRunTimeStats =
\r
163 "run-time-stats", /* The command string to type. */
\r
164 "run-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n\r\n",
\r
165 prvRunTimeStatsCommand, /* The function to run. */
\r
166 0 /* No parameters are expected. */
\r
169 /* Structure that defines the "task-stats" command line command. This generates
\r
170 a table that gives information on each task in the system. */
\r
171 static const CLI_Command_Definition_t xTaskStats =
\r
173 "task-stats", /* The command string to type. */
\r
174 "task-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n\r\n",
\r
175 prvTaskStatsCommand, /* The function to run. */
\r
176 0 /* No parameters are expected. */
\r
179 /* Structure that defines the "echo_3_parameters" command line command. This
\r
180 takes exactly three parameters that the command simply echos back one at a
\r
182 static const CLI_Command_Definition_t xThreeParameterEcho =
\r
184 "echo-3-parameters",
\r
185 "echo-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n\r\n",
\r
186 prvThreeParameterEchoCommand, /* The function to run. */
\r
187 3 /* Three parameters are expected, which can take any value. */
\r
190 /* Structure that defines the "echo_parameters" command line command. This
\r
191 takes a variable number of parameters that the command simply echos back one at
\r
193 static const CLI_Command_Definition_t xParameterEcho =
\r
196 "echo-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n\r\n",
\r
197 prvParameterEchoCommand, /* The function to run. */
\r
198 -1 /* The user can enter any number of commands. */
\r
201 #ifdef ipconfigUSE_TCP
\r
202 #if( ipconfigUSE_TCP == 1 )
\r
203 /* Structure that defines the "task-stats" command line command. This generates
\r
204 a table that gives information on each task in the system. */
\r
205 static const CLI_Command_Definition_t xNetStats =
\r
207 "net-stats", /* The command string to type. */
\r
208 "net-stats:\r\n Calls FreeRTOS_netstat()\r\n\r\n",
\r
209 prvNetStatCommand, /* The function to run. */
\r
210 0 /* No parameters are expected. */
\r
212 #endif /* ipconfigUSE_TCP == 1 */
\r
213 #endif /* ifdef ipconfigUSE_TCP */
\r
215 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
217 /* Structure that defines the "ping" command line command. This takes an IP
\r
218 address or host name and (optionally) the number of bytes to ping as
\r
220 static const CLI_Command_Definition_t xPing =
\r
223 "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
224 prvPingCommand, /* The function to run. */
\r
225 -1 /* Ping can take either one or two parameter, so the number of parameters has to be determined by the ping command implementation. */
\r
228 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
230 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
231 /* Structure that defines the "trace" command line command. This takes a single
\r
232 parameter, which can be either "start" or "stop". */
\r
233 static const CLI_Command_Definition_t xStartStopTrace =
\r
236 "trace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n\r\n",
\r
237 prvStartStopTraceCommand, /* The function to run. */
\r
238 1 /* One parameter is expected. Valid values are "start" and "stop". */
\r
240 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r
242 /*-----------------------------------------------------------*/
\r
244 void vRegisterCLICommands( void )
\r
246 static BaseType_t xCommandRegistered = pdFALSE;
\r
248 /* Prevent commands being registered more than once. */
\r
249 if( xCommandRegistered == pdFALSE )
\r
251 /* Register all the command line commands defined immediately above. */
\r
252 FreeRTOS_CLIRegisterCommand( &xTaskStats );
\r
253 FreeRTOS_CLIRegisterCommand( &xRunTimeStats );
\r
254 FreeRTOS_CLIRegisterCommand( &xThreeParameterEcho );
\r
255 FreeRTOS_CLIRegisterCommand( &xParameterEcho );
\r
256 FreeRTOS_CLIRegisterCommand( &xIPDebugStats );
\r
257 FreeRTOS_CLIRegisterCommand( &xIPConfig );
\r
259 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
261 FreeRTOS_CLIRegisterCommand( &xPing );
\r
263 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
265 #ifdef ipconfigUSE_TCP
\r
267 #if ipconfigUSE_TCP == 1
\r
269 FreeRTOS_CLIRegisterCommand( &xNetStats );
\r
271 #endif /* ipconfigUSE_TCP == 1 */
\r
273 #endif /* ifdef ipconfigUSE_TCP */
\r
275 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
277 FreeRTOS_CLIRegisterCommand( & xStartStopTrace );
\r
281 xCommandRegistered = pdTRUE;
\r
284 /*-----------------------------------------------------------*/
\r
286 static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
288 const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
\r
290 /* Remove compile time warnings about unused parameters, and check the
\r
291 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
292 write buffer length is adequate, so does not check for buffer overflows. */
\r
293 ( void ) pcCommandString;
\r
294 ( void ) xWriteBufferLen;
\r
295 configASSERT( pcWriteBuffer );
\r
297 /* Generate a table of task stats. */
\r
298 strcpy( pcWriteBuffer, pcHeader );
\r
299 vTaskList( pcWriteBuffer + strlen( pcHeader ) );
\r
301 /* There is no more data to return after this single string, so return
\r
305 /*-----------------------------------------------------------*/
\r
307 static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
309 const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
\r
311 /* Remove compile time warnings about unused parameters, and check the
\r
312 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
313 write buffer length is adequate, so does not check for buffer overflows. */
\r
314 ( void ) pcCommandString;
\r
315 ( void ) xWriteBufferLen;
\r
316 configASSERT( pcWriteBuffer );
\r
318 /* Generate a table of task stats. */
\r
319 strcpy( pcWriteBuffer, pcHeader );
\r
320 vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
\r
322 /* There is no more data to return after this single string, so return
\r
326 /*-----------------------------------------------------------*/
\r
328 static BaseType_t prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
330 const char *pcParameter;
\r
331 BaseType_t xParameterStringLength, xReturn;
\r
332 static BaseType_t lParameterNumber = 0;
\r
334 /* Remove compile time warnings about unused parameters, and check the
\r
335 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
336 write buffer length is adequate, so does not check for buffer overflows. */
\r
337 ( void ) pcCommandString;
\r
338 configASSERT( pcWriteBuffer );
\r
340 if( lParameterNumber == 0 )
\r
342 /* The first time the function is called after the command has been
\r
343 entered just a header string is returned. */
\r
344 snprintf( pcWriteBuffer, xWriteBufferLen, "The three parameters were:\r\n" );
\r
346 /* Next time the function is called the first parameter will be echoed
\r
348 lParameterNumber = 1L;
\r
350 /* There is more data to be returned as no parameters have been echoed
\r
356 /* Obtain the parameter string. */
\r
357 pcParameter = FreeRTOS_CLIGetParameter
\r
359 pcCommandString, /* The command string itself. */
\r
360 lParameterNumber, /* Return the next parameter. */
\r
361 &xParameterStringLength /* Store the parameter string length. */
\r
364 /* Sanity check something was returned. */
\r
365 configASSERT( pcParameter );
\r
367 /* Return the parameter string. */
\r
368 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
369 snprintf( pcWriteBuffer, xWriteBufferLen, "%d: ", ( int ) lParameterNumber );
\r
370 strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
\r
371 strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
373 /* If this is the last of the three parameters then there are no more
\r
374 strings to return after this one. */
\r
375 if( lParameterNumber == 3L )
\r
377 /* If this is the last of the three parameters then there are no more
\r
378 strings to return after this one. */
\r
380 lParameterNumber = 0L;
\r
384 /* There are more parameters to return after this one. */
\r
386 lParameterNumber++;
\r
392 /*-----------------------------------------------------------*/
\r
394 static BaseType_t prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
396 const char *pcParameter;
\r
397 BaseType_t xParameterStringLength, xReturn;
\r
398 static BaseType_t lParameterNumber = 0;
\r
400 /* Remove compile time warnings about unused parameters, and check the
\r
401 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
402 write buffer length is adequate, so does not check for buffer overflows. */
\r
403 ( void ) pcCommandString;
\r
404 configASSERT( pcWriteBuffer );
\r
406 if( lParameterNumber == 0 )
\r
408 /* The first time the function is called after the command has been
\r
409 entered just a header string is returned. */
\r
410 snprintf( pcWriteBuffer, xWriteBufferLen, "The parameters were:\r\n" );
\r
412 /* Next time the function is called the first parameter will be echoed
\r
414 lParameterNumber = 1L;
\r
416 /* There is more data to be returned as no parameters have been echoed
\r
422 /* Obtain the parameter string. */
\r
423 pcParameter = FreeRTOS_CLIGetParameter
\r
425 pcCommandString, /* The command string itself. */
\r
426 lParameterNumber, /* Return the next parameter. */
\r
427 &xParameterStringLength /* Store the parameter string length. */
\r
430 if( pcParameter != NULL )
\r
432 /* Return the parameter string. */
\r
433 memset( pcWriteBuffer, 0x00, xWriteBufferLen );
\r
434 snprintf( pcWriteBuffer, xWriteBufferLen, "%d: ", ( int ) lParameterNumber );
\r
435 strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
\r
436 strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
\r
438 /* There might be more parameters to return after this one. */
\r
440 lParameterNumber++;
\r
444 /* No more parameters were found. Make sure the write buffer does
\r
445 not contain a valid string. */
\r
446 pcWriteBuffer[ 0 ] = 0x00;
\r
448 /* No more data to return. */
\r
451 /* Start over the next time this command is executed. */
\r
452 lParameterNumber = 0;
\r
458 /*-----------------------------------------------------------*/
\r
460 #ifdef ipconfigUSE_TCP
\r
462 #if ipconfigUSE_TCP == 1
\r
464 static BaseType_t prvNetStatCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
466 ( void ) pcWriteBuffer;
\r
467 ( void ) xWriteBufferLen;
\r
468 ( void ) pcCommandString;
\r
470 FreeRTOS_netstat();
\r
471 snprintf( pcWriteBuffer, xWriteBufferLen, "FreeRTOS_netstat() called - output uses FreeRTOS_printf\r\n" );
\r
475 #endif /* ipconfigUSE_TCP == 1 */
\r
477 #endif /* ifdef ipconfigUSE_TCP */
\r
478 /*-----------------------------------------------------------*/
\r
480 #if ipconfigSUPPORT_OUTGOING_PINGS == 1
\r
482 static BaseType_t prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
484 char * pcParameter;
\r
485 BaseType_t lParameterStringLength, xReturn;
\r
486 uint32_t ulIPAddress, ulBytesToPing;
\r
487 const uint32_t ulDefaultBytesToPing = 8UL;
\r
488 char cBuffer[ 16 ];
\r
490 /* Remove compile time warnings about unused parameters, and check the
\r
491 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
492 write buffer length is adequate, so does not check for buffer overflows. */
\r
493 ( void ) pcCommandString;
\r
494 configASSERT( pcWriteBuffer );
\r
496 /* Start with an empty string. */
\r
497 pcWriteBuffer[ 0 ] = 0x00;
\r
499 /* Obtain the number of bytes to ping. */
\r
500 pcParameter = ( char * ) FreeRTOS_CLIGetParameter
\r
502 pcCommandString, /* The command string itself. */
\r
503 2, /* Return the second parameter. */
\r
504 &lParameterStringLength /* Store the parameter string length. */
\r
507 if( pcParameter == NULL )
\r
509 /* The number of bytes was not specified, so default it. */
\r
510 ulBytesToPing = ulDefaultBytesToPing;
\r
514 ulBytesToPing = atol( pcParameter );
\r
517 /* Obtain the IP address string. */
\r
518 pcParameter = ( char * ) FreeRTOS_CLIGetParameter
\r
520 pcCommandString, /* The command string itself. */
\r
521 1, /* Return the first parameter. */
\r
522 &lParameterStringLength /* Store the parameter string length. */
\r
525 /* Sanity check something was returned. */
\r
526 configASSERT( pcParameter );
\r
528 /* Attempt to obtain the IP address. If the first character is not a
\r
529 digit, assume the host name has been passed in. */
\r
530 if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) )
\r
532 ulIPAddress = FreeRTOS_inet_addr( pcParameter );
\r
536 /* Terminate the host name. */
\r
537 pcParameter[ lParameterStringLength ] = 0x00;
\r
539 /* Attempt to resolve host. */
\r
540 ulIPAddress = FreeRTOS_gethostbyname( pcParameter );
\r
543 /* Convert IP address, which may have come from a DNS lookup, to string. */
\r
544 FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
\r
546 if( ulIPAddress != 0 )
\r
548 xReturn = FreeRTOS_SendPingRequest( ulIPAddress, ( uint16_t ) ulBytesToPing, portMAX_DELAY );
\r
555 if( xReturn == pdFALSE )
\r
557 snprintf( pcWriteBuffer, xWriteBufferLen, "%s", "Could not send ping request\r\n" );
\r
561 snprintf( pcWriteBuffer, xWriteBufferLen, "Ping sent to %s with identifier %d\r\n", cBuffer, xReturn );
\r
566 /*-----------------------------------------------------------*/
\r
568 #endif /* ipconfigSUPPORT_OUTGOING_PINGS */
\r
570 #if configINCLUDE_DEMO_DEBUG_STATS != 0
\r
572 static BaseType_t prvDisplayIPDebugStats( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
574 static BaseType_t xIndex = -1;
\r
575 extern ExampleDebugStatEntry_t xIPTraceValues[];
\r
576 BaseType_t xReturn;
\r
578 /* Remove compile time warnings about unused parameters, and check the
\r
579 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
580 write buffer length is adequate, so does not check for buffer overflows. */
\r
581 ( void ) pcCommandString;
\r
582 configASSERT( pcWriteBuffer );
\r
586 if( xIndex < xExampleDebugStatEntries() )
\r
588 snprintf( pcWriteBuffer, xWriteBufferLen, "%s %d\r\n", xIPTraceValues[ xIndex ].pucDescription, ( int ) xIPTraceValues[ xIndex ].ulData );
\r
593 /* Reset the index for the next time it is called. */
\r
596 /* Ensure nothing remains in the write buffer. */
\r
597 pcWriteBuffer[ 0 ] = 0x00;
\r
603 /*-----------------------------------------------------------*/
\r
605 #endif /* configINCLUDE_DEMO_DEBUG_STATS */
\r
607 static BaseType_t prvDisplayIPConfig( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
609 static BaseType_t xIndex = 0;
\r
610 BaseType_t xReturn;
\r
611 uint32_t ulAddress;
\r
613 /* Remove compile time warnings about unused parameters, and check the
\r
614 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
615 write buffer length is adequate, so does not check for buffer overflows. */
\r
616 ( void ) pcCommandString;
\r
617 configASSERT( pcWriteBuffer );
\r
622 FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL );
\r
623 snprintf( pcWriteBuffer, xWriteBufferLen, "\r\nIP address " );
\r
629 FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL );
\r
630 snprintf( pcWriteBuffer, xWriteBufferLen, "\r\nNet mask " );
\r
636 FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL );
\r
637 snprintf( pcWriteBuffer, xWriteBufferLen, "\r\nGateway address " );
\r
643 FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress );
\r
644 snprintf( pcWriteBuffer, xWriteBufferLen, "\r\nDNS server address " );
\r
651 snprintf( pcWriteBuffer, xWriteBufferLen, "\r\n\r\n" );
\r
657 if( ulAddress != 0 )
\r
659 FreeRTOS_inet_ntoa( ulAddress, &( pcWriteBuffer[ strlen( pcWriteBuffer ) ] ) );
\r
664 /*-----------------------------------------------------------*/
\r
666 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
\r
668 static BaseType_t prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
\r
670 const char *pcParameter;
\r
671 BaseType_t lParameterStringLength;
\r
673 /* Remove compile time warnings about unused parameters, and check the
\r
674 write buffer is not NULL. NOTE - for simplicity, this example assumes the
\r
675 write buffer length is adequate, so does not check for buffer overflows. */
\r
676 ( void ) pcCommandString;
\r
677 configASSERT( pcWriteBuffer );
\r
679 /* Obtain the parameter string. */
\r
680 pcParameter = FreeRTOS_CLIGetParameter
\r
682 pcCommandString, /* The command string itself. */
\r
683 1, /* Return the first parameter. */
\r
684 &lParameterStringLength /* Store the parameter string length. */
\r
687 /* Sanity check something was returned. */
\r
688 configASSERT( pcParameter );
\r
690 /* There are only two valid parameter values. */
\r
691 if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
\r
693 /* Start or restart the trace. */
\r
698 snprintf( pcWriteBuffer, xWriteBufferLen, "Trace recording (re)started.\r\n" );
\r
700 else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
\r
702 /* End the trace, if one is running. */
\r
704 snprintf( pcWriteBuffer, xWriteBufferLen, "Stopping trace recording.\r\n" );
\r
708 snprintf( pcWriteBuffer, xWriteBufferLen, "Valid parameters are 'start' and 'stop'.\r\n" );
\r
711 /* There is no more data to return after this single string, so return
\r
716 #endif /* configINCLUDE_TRACE_RELATED_CLI_COMMANDS */
\r