mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Update FreeRTOS+ more demos that use FreeRTOS+CLI to remove casting to int8_t * from strings.
This commit is contained in:
parent
31609c7c3e
commit
38e7554138
32 changed files with 304 additions and 297 deletions
|
@ -244,7 +244,7 @@ size_t xColumns = 50U;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* Attempt to open the requested file. */
|
||||
pxFile = f_open( ( const char * ) pcParameter, "r" );
|
||||
pxFile = f_open( pcParameter, "r" );
|
||||
}
|
||||
|
||||
if( pxFile != NULL )
|
||||
|
@ -406,7 +406,7 @@ unsigned char ucReturned;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* Attempt to delete the file. */
|
||||
ucReturned = f_delete( ( const char * ) pcParameter );
|
||||
ucReturned = f_delete( pcParameter );
|
||||
|
||||
if( ucReturned == F_NO_ERROR )
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ long lSourceLength, lDestinationLength = 0;
|
|||
pcSourceFile[ xParameterStringLength ] = 0x00;
|
||||
|
||||
/* See if the source file exists, obtain its length if it does. */
|
||||
lSourceLength = f_filelength( ( const char * ) pcSourceFile );
|
||||
lSourceLength = f_filelength( pcSourceFile );
|
||||
|
||||
if( lSourceLength == 0 )
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ long lSourceLength, lDestinationLength = 0;
|
|||
else
|
||||
{
|
||||
/* See if the destination file exists. */
|
||||
lDestinationLength = f_filelength( ( const char * ) pcDestinationFile );
|
||||
lDestinationLength = f_filelength( pcDestinationFile );
|
||||
|
||||
if( lDestinationLength != 0 )
|
||||
{
|
||||
|
@ -523,7 +523,7 @@ portBASE_TYPE xReturn = pdPASS;
|
|||
/* Open the source file, seek past the data that has already been
|
||||
read from the file, read the next block of data, then close the
|
||||
file again so the destination file can be opened. */
|
||||
pxFile = f_open( ( const char * ) pcSourceFile, "r" );
|
||||
pxFile = f_open( pcSourceFile, "r" );
|
||||
if( pxFile != NULL )
|
||||
{
|
||||
f_seek( pxFile, lBytesRead, F_SEEK_SET );
|
||||
|
@ -538,7 +538,7 @@ portBASE_TYPE xReturn = pdPASS;
|
|||
|
||||
/* Open the destination file and write the block of data to the end of
|
||||
the file. */
|
||||
pxFile = f_open( ( const char * ) pcDestinationFile, "a" );
|
||||
pxFile = f_open( pcDestinationFile, "a" );
|
||||
if( pxFile != NULL )
|
||||
{
|
||||
f_write( pxWriteBuffer, lBytesToRead, 1, pxFile );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
|
@ -302,7 +302,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
printf( "In directory %s\r\n", cRAMBuffer );
|
||||
configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 );
|
||||
configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 );
|
||||
|
||||
/* Generate the file name. */
|
||||
sprintf( cFileName, "%s.txt", pcDirectory2 );
|
||||
|
@ -331,7 +331,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
printf( "Back in root directory %s\r\n", cRAMBuffer );
|
||||
configASSERT( strcmp( ( const char * ) cRAMBuffer, pcRoot ) == 0 );
|
||||
configASSERT( strcmp( cRAMBuffer, pcRoot ) == 0 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -349,7 +349,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
printf( "Back in directory %s\r\n", cRAMBuffer );
|
||||
configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 );
|
||||
configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 );
|
||||
|
||||
/* Generate the file name. */
|
||||
sprintf( cFileName, "%s.txt", pcDirectory2 );
|
||||
|
|
|
@ -405,7 +405,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* There are only two valid parameter values. */
|
||||
if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
{
|
||||
/* Start or restart the trace. */
|
||||
vTraceStop();
|
||||
|
@ -414,7 +414,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
|
||||
sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
|
||||
}
|
||||
else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
{
|
||||
/* End the trace, if one is running. */
|
||||
vTraceStop();
|
||||
|
|
|
@ -348,7 +348,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
/* Return the parameter string. */
|
||||
memset( pcWriteBuffer, 0x00, xWriteBufferLen );
|
||||
sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
|
||||
strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength );
|
||||
strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
|
||||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* There might be more parameters to return after this one. */
|
||||
|
@ -399,7 +399,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* There are only two valid parameter values. */
|
||||
if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
{
|
||||
/* Start or restart the trace. */
|
||||
vTraceStop();
|
||||
|
@ -408,7 +408,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
|
||||
sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
|
||||
}
|
||||
else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
{
|
||||
/* End the trace, if one is running. */
|
||||
vTraceStop();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
@ -113,14 +113,14 @@ static void prvSendBuffer( struct usart_module *pxCDCUsart, const char * pcBuffe
|
|||
extern void vRegisterSampleCLICommands( void );
|
||||
|
||||
/*
|
||||
* Configure the UART used for IO.and register prvUARTRxNotificationHandler()
|
||||
* Configure the UART used for IO.and register prvUARTRxNotificationHandler()
|
||||
* to handle UART Rx events.
|
||||
*/
|
||||
static void prvConfigureUART( struct usart_module *pxCDCUsart );
|
||||
|
||||
/*
|
||||
* Callback functions registered with the Atmel UART driver. Both functions
|
||||
* just 'give' a semaphore to unblock a task that may be waiting for a
|
||||
* Callback functions registered with the Atmel UART driver. Both functions
|
||||
* just 'give' a semaphore to unblock a task that may be waiting for a
|
||||
* character to be received, or a transmission to complete.
|
||||
*/
|
||||
static void prvUARTTxNotificationHandler( const struct usart_module *const pxUSART );
|
||||
|
@ -146,7 +146,7 @@ static xSemaphoreHandle xRxCompleteSemaphore = NULL;
|
|||
void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority )
|
||||
{
|
||||
vRegisterSampleCLICommands();
|
||||
|
||||
|
||||
/* Create that task that handles the console itself. */
|
||||
xTaskCreate( prvUARTCommandConsoleTask, /* The task that implements the command console. */
|
||||
"CLI", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */
|
||||
|
@ -178,13 +178,13 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
|
|||
pcOutputString = FreeRTOS_CLIGetOutputBuffer();
|
||||
|
||||
/* Send the welcome message. */
|
||||
prvSendBuffer( &xCDCUsart, pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) );
|
||||
prvSendBuffer( &xCDCUsart, pcWelcomeMessage, strlen( pcWelcomeMessage ) );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait for the next character to arrive. A semaphore is used to
|
||||
ensure no CPU time is used until data has arrived. */
|
||||
usart_read_buffer_job( &xCDCUsart, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) );
|
||||
usart_read_buffer_job( &xCDCUsart, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) );
|
||||
if( xSemaphoreTake( xRxCompleteSemaphore, portMAX_DELAY ) == pdPASS )
|
||||
{
|
||||
/* Echo the character back. */
|
||||
|
@ -201,7 +201,7 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
|
|||
if( ucInputIndex == 0 )
|
||||
{
|
||||
/* Copy the last command back into the input string. */
|
||||
strcpy( ( char * ) cInputString, ( char * ) cLastInputString );
|
||||
strcpy( cInputString, cLastInputString );
|
||||
}
|
||||
|
||||
/* Pass the received command to the command interpreter. The
|
||||
|
@ -222,11 +222,11 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
|
|||
Clear the input string ready to receive the next command. Remember
|
||||
the command that was just processed first in case it is to be
|
||||
processed again. */
|
||||
strcpy( ( char * ) cLastInputString, ( char * ) cInputString );
|
||||
strcpy( cLastInputString, cInputString );
|
||||
ucInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
prvSendBuffer( &xCDCUsart, pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) );
|
||||
prvSendBuffer( &xCDCUsart, pcEndOfOutputMessage, strlen( pcEndOfOutputMessage ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -269,9 +269,9 @@ static void prvSendBuffer( struct usart_module *pxCDCUsart, const char * pcBuffe
|
|||
const portTickType xBlockMax100ms = 100UL / portTICK_RATE_MS;
|
||||
|
||||
if( xBufferLength > 0 )
|
||||
{
|
||||
{
|
||||
usart_write_buffer_job( pxCDCUsart, ( uint8_t * ) pcBuffer, xBufferLength );
|
||||
|
||||
|
||||
/* Wait for the Tx to complete so the buffer can be reused without
|
||||
corrupting the data that is being sent. */
|
||||
xSemaphoreTake( xTxCompleteSemaphore, xBlockMax100ms );
|
||||
|
@ -287,7 +287,7 @@ struct usart_config xUARTConfig;
|
|||
without wasting any CPU time. */
|
||||
vSemaphoreCreateBinary( xTxCompleteSemaphore );
|
||||
configASSERT( xTxCompleteSemaphore );
|
||||
|
||||
|
||||
/* This semaphore is used to allow the task to block for an Rx to complete
|
||||
without wasting any CPU time. */
|
||||
vSemaphoreCreateBinary( xRxCompleteSemaphore );
|
||||
|
@ -307,13 +307,13 @@ struct usart_config xUARTConfig;
|
|||
xUARTConfig.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
|
||||
xUARTConfig.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
|
||||
xUARTConfig.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
|
||||
while( usart_init( pxCDCUsart, EDBG_CDC_MODULE, &xUARTConfig ) != STATUS_OK )
|
||||
while( usart_init( pxCDCUsart, EDBG_CDC_MODULE, &xUARTConfig ) != STATUS_OK )
|
||||
{
|
||||
/* Nothing to do here. Should include a timeout really but this is
|
||||
init code only. */
|
||||
}
|
||||
usart_enable( pxCDCUsart );
|
||||
|
||||
|
||||
/* Register the driver callbacks. */
|
||||
usart_register_callback( pxCDCUsart, prvUARTTxNotificationHandler, USART_CALLBACK_BUFFER_TRANSMITTED );
|
||||
usart_register_callback( pxCDCUsart, prvUARTRxNotificationHandler, USART_CALLBACK_BUFFER_RECEIVED );
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[InternetShortcut]
|
||||
URL=http://www.freertos.org/Atmel_SAM4E_RTOS_Demo.html
|
||||
IDList=
|
||||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,2
|
|
@ -72,7 +72,7 @@
|
|||
* executed prior to this project being built. Once it has been executed
|
||||
* remove the #error line below.
|
||||
*/
|
||||
#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.
|
||||
//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.
|
||||
|
||||
/*
|
||||
* Set configCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
||||
|
|
|
@ -238,7 +238,7 @@ size_t xColumns = 50U;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* Attempt to open the requested file. */
|
||||
pxFile = f_open( ( const char * ) pcParameter, "r" );
|
||||
pxFile = f_open( pcParameter, "r" );
|
||||
}
|
||||
|
||||
if( pxFile != NULL )
|
||||
|
@ -400,7 +400,7 @@ unsigned char ucReturned;
|
|||
configASSERT( pcParameter );
|
||||
|
||||
/* Attempt to delete the file. */
|
||||
ucReturned = f_delete( ( const char * ) pcParameter );
|
||||
ucReturned = f_delete( pcParameter );
|
||||
|
||||
if( ucReturned == F_NO_ERROR )
|
||||
{
|
||||
|
@ -436,12 +436,12 @@ long lSourceLength, lDestinationLength = 0;
|
|||
configASSERT( pcDestinationFile );
|
||||
|
||||
/* Obtain the name of the source file. */
|
||||
pcSourceFile = FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
1, /* Return the first parameter. */
|
||||
&xParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
1, /* Return the first parameter. */
|
||||
&xParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
/* Sanity check something was returned. */
|
||||
configASSERT( pcSourceFile );
|
||||
|
@ -518,7 +518,7 @@ portBASE_TYPE xReturn = pdPASS;
|
|||
/* Open the source file, seek past the data that has already been
|
||||
read from the file, read the next block of data, then close the
|
||||
file again so the destination file can be opened. */
|
||||
pxFile = f_open( ( const char * ) pcSourceFile, "r" );
|
||||
pxFile = f_open( pcSourceFile, "r" );
|
||||
if( pxFile != NULL )
|
||||
{
|
||||
f_seek( pxFile, lBytesRead, F_SEEK_SET );
|
||||
|
@ -533,7 +533,7 @@ portBASE_TYPE xReturn = pdPASS;
|
|||
|
||||
/* Open the destination file and write the block of data to the end of
|
||||
the file. */
|
||||
pxFile = f_open( ( const char * ) pcDestinationFile, "a" );
|
||||
pxFile = f_open( pcDestinationFile, "a" );
|
||||
if( pxFile != NULL )
|
||||
{
|
||||
f_write( pxWriteBuffer, lBytesToRead, 1, pxFile );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
|
@ -302,7 +302,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
printf( "In directory %s\r\n", cRAMBuffer );
|
||||
configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 );
|
||||
configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 );
|
||||
|
||||
/* Generate the file name. */
|
||||
sprintf( cFileName, "%s.txt", pcDirectory2 );
|
||||
|
@ -331,7 +331,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
printf( "Back in root directory %s\r\n", cRAMBuffer );
|
||||
configASSERT( strcmp( ( const char * ) cRAMBuffer, pcRoot ) == 0 );
|
||||
configASSERT( strcmp( cRAMBuffer, pcRoot ) == 0 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -349,7 +349,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ];
|
|||
/* Obtain and print out the working directory. */
|
||||
f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE );
|
||||
printf( "Back in directory %s\r\n", cRAMBuffer );
|
||||
configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 );
|
||||
configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 );
|
||||
|
||||
/* Generate the file name. */
|
||||
sprintf( cFileName, "%s.txt", pcDirectory2 );
|
||||
|
|
|
@ -209,8 +209,8 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
|
|||
configASSERT( pcWriteBuffer );
|
||||
|
||||
/* Generate a table of task stats. */
|
||||
strcpy( ( char * ) pcWriteBuffer, pcHeader );
|
||||
vTaskList( ( char * ) pcWriteBuffer + strlen( pcHeader ) );
|
||||
strcpy( pcWriteBuffer, pcHeader );
|
||||
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
pdFALSE. */
|
||||
|
@ -230,7 +230,7 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
|
|||
configASSERT( pcWriteBuffer );
|
||||
|
||||
/* Generate a table of task stats. */
|
||||
strcpy( ( char * ) pcWriteBuffer, pcHeader );
|
||||
strcpy( pcWriteBuffer, pcHeader );
|
||||
vTaskGetRunTimeStats( ( char * ) pcWriteBuffer + strlen( pcHeader ) );
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
|
@ -241,7 +241,7 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
|
|||
|
||||
static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
{
|
||||
int8_t *pcParameter;
|
||||
const char *pcParameter;
|
||||
portBASE_TYPE xParameterStringLength, xReturn;
|
||||
static portBASE_TYPE lParameterNumber = 0;
|
||||
|
||||
|
@ -256,7 +256,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
sprintf( ( char * ) pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
sprintf( pcWriteBuffer, "The three parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
|
@ -269,21 +269,21 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
else
|
||||
{
|
||||
/* Obtain the parameter string. */
|
||||
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
lParameterNumber, /* Return the next parameter. */
|
||||
&xParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
pcParameter = FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
lParameterNumber, /* Return the next parameter. */
|
||||
&xParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
/* Sanity check something was returned. */
|
||||
configASSERT( pcParameter );
|
||||
|
||||
/* Return the parameter string. */
|
||||
memset( pcWriteBuffer, 0x00, xWriteBufferLen );
|
||||
sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
|
||||
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength );
|
||||
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
|
||||
strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
|
||||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* If this is the last of the three parameters then there are no more
|
||||
strings to return after this one. */
|
||||
|
@ -308,7 +308,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
|
||||
static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
{
|
||||
int8_t *pcParameter;
|
||||
const char *pcParameter;
|
||||
portBASE_TYPE xParameterStringLength, xReturn;
|
||||
static portBASE_TYPE lParameterNumber = 0;
|
||||
|
||||
|
@ -323,7 +323,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
{
|
||||
/* The first time the function is called after the command has been
|
||||
entered just a header string is returned. */
|
||||
sprintf( ( char * ) pcWriteBuffer, "The parameters were:\r\n" );
|
||||
sprintf( pcWriteBuffer, "The parameters were:\r\n" );
|
||||
|
||||
/* Next time the function is called the first parameter will be echoed
|
||||
back. */
|
||||
|
@ -336,20 +336,20 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
else
|
||||
{
|
||||
/* Obtain the parameter string. */
|
||||
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
lParameterNumber, /* Return the next parameter. */
|
||||
&xParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
pcParameter = FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
lParameterNumber, /* Return the next parameter. */
|
||||
&xParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
if( pcParameter != NULL )
|
||||
{
|
||||
/* Return the parameter string. */
|
||||
memset( pcWriteBuffer, 0x00, xWriteBufferLen );
|
||||
sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
|
||||
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength );
|
||||
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
|
||||
strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
|
||||
strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
|
||||
|
||||
/* There might be more parameters to return after this one. */
|
||||
xReturn = pdTRUE;
|
||||
|
@ -377,7 +377,7 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
|
||||
static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
|
||||
{
|
||||
int8_t *pcParameter;
|
||||
const char *pcParameter;
|
||||
portBASE_TYPE lParameterStringLength;
|
||||
|
||||
/* Remove compile time warnings about unused parameters, and check the
|
||||
|
@ -388,35 +388,35 @@ static portBASE_TYPE lParameterNumber = 0;
|
|||
configASSERT( pcWriteBuffer );
|
||||
|
||||
/* Obtain the parameter string. */
|
||||
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
1, /* Return the first parameter. */
|
||||
&lParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
pcParameter = FreeRTOS_CLIGetParameter
|
||||
(
|
||||
pcCommandString, /* The command string itself. */
|
||||
1, /* Return the first parameter. */
|
||||
&lParameterStringLength /* Store the parameter string length. */
|
||||
);
|
||||
|
||||
/* Sanity check something was returned. */
|
||||
configASSERT( pcParameter );
|
||||
|
||||
/* There are only two valid parameter values. */
|
||||
if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 )
|
||||
{
|
||||
/* Start or restart the trace. */
|
||||
vTraceStop();
|
||||
vTraceClear();
|
||||
vTraceStart();
|
||||
|
||||
sprintf( ( char * ) pcWriteBuffer, "Trace recording (re)started.\r\n" );
|
||||
sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" );
|
||||
}
|
||||
else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 )
|
||||
{
|
||||
/* End the trace, if one is running. */
|
||||
vTraceStop();
|
||||
sprintf( ( char * ) pcWriteBuffer, "Stopping trace recording.\r\n" );
|
||||
sprintf( pcWriteBuffer, "Stopping trace recording.\r\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( ( char * ) pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
|
||||
sprintf( pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" );
|
||||
}
|
||||
|
||||
/* There is no more data to return after this single string, so return
|
||||
|
|
|
@ -165,7 +165,7 @@ portBASE_TYPE xReturned;
|
|||
pcOutputString = FreeRTOS_CLIGetOutputBuffer();
|
||||
|
||||
/* Send the welcome message. */
|
||||
prvSendBuffer( pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) );
|
||||
prvSendBuffer( pcWelcomeMessage, strlen( pcWelcomeMessage ) );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
|
@ -179,14 +179,14 @@ portBASE_TYPE xReturned;
|
|||
if( cRxedChar == '\n' || cRxedChar == '\r' )
|
||||
{
|
||||
/* Just to space the output from the input. */
|
||||
prvSendBuffer( pcNewLine, strlen( ( char * ) pcNewLine ) );
|
||||
prvSendBuffer( pcNewLine, strlen( pcNewLine ) );
|
||||
|
||||
/* See if the command is empty, indicating that the last command is
|
||||
to be executed again. */
|
||||
if( cInputIndex == 0 )
|
||||
{
|
||||
/* Copy the last command back into the input string. */
|
||||
strcpy( ( char * ) cInputString, ( char * ) cLastInputString );
|
||||
strcpy( cInputString, cLastInputString );
|
||||
}
|
||||
|
||||
/* Pass the received command to the command interpreter. The
|
||||
|
@ -207,11 +207,11 @@ portBASE_TYPE xReturned;
|
|||
Clear the input string ready to receive the next command. Remember
|
||||
the command that was just processed first in case it is to be
|
||||
processed again. */
|
||||
strcpy( ( char * ) cLastInputString, ( char * ) cInputString );
|
||||
strcpy( cLastInputString, cInputString );
|
||||
cInputIndex = 0;
|
||||
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
|
||||
|
||||
prvSendBuffer( pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) );
|
||||
prvSendBuffer( pcEndOfOutputMessage, strlen( pcEndOfOutputMessage ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue