Update demos that use FreeRTOS+CLI to remove casting to int8_t * from strings.

This commit is contained in:
Richard Barry 2013-12-30 14:06:57 +00:00
parent e95b482f56
commit 42a2338f1c
9 changed files with 340 additions and 337 deletions

View file

@ -104,41 +104,41 @@
/* /*
* Print out information on a single file. * Print out information on a single file.
*/ */
static void prvCreateFileInfoString( int8_t *pcBuffer, F_FIND *pxFindStruct ); static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct );
/* /*
* Copies an existing file into a newly created file. * Copies an existing file into a newly created file.
*/ */
static portBASE_TYPE prvPerformCopy( int8_t *pcSourceFile, static portBASE_TYPE prvPerformCopy( char *pcSourceFile,
int32_t lSourceFileLength, int32_t lSourceFileLength,
int8_t *pcDestinationFile, char *pcDestinationFile,
int8_t *pxWriteBuffer, char *pxWriteBuffer,
size_t xWriteBufferLen ); size_t xWriteBufferLen );
/* /*
* Implements the DIR command. * Implements the DIR command.
*/ */
static portBASE_TYPE prvDIRCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the CD command. * Implements the CD command.
*/ */
static portBASE_TYPE prvCDCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the DEL command. * Implements the DEL command.
*/ */
static portBASE_TYPE prvDELCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the TYPE command. * Implements the TYPE command.
*/ */
static portBASE_TYPE prvTYPECommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the COPY command. * Implements the COPY command.
*/ */
static portBASE_TYPE prvCOPYCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Registers the CLI commands that are specific to the files system with the * Registers the CLI commands that are specific to the files system with the
@ -207,9 +207,9 @@ void vRegisterFileSystemCLICommands( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvTYPECommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn = pdTRUE; portBASE_TYPE xParameterStringLength, xReturn = pdTRUE;
static F_FILE *pxFile = NULL; static F_FILE *pxFile = NULL;
int iChar; int iChar;
@ -233,12 +233,12 @@ size_t xColumns = 50U;
if( pxFile == NULL ) if( pxFile == NULL )
{ {
/* The file has not been opened yet. Find the file name. */ /* The file has not been opened yet. Find the file name. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
@ -263,7 +263,7 @@ size_t xColumns = 50U;
} }
else else
{ {
pcWriteBuffer[ xByte ] = ( int8_t ) iChar; pcWriteBuffer[ xByte ] = ( char ) iChar;
} }
} }
} }
@ -275,51 +275,51 @@ size_t xColumns = 50U;
xReturn = pdFALSE; xReturn = pdFALSE;
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvCDCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength; portBASE_TYPE xParameterStringLength;
unsigned char ucReturned; unsigned char ucReturned;
size_t xStringLength; size_t xStringLength;
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
/* Attempt to move to the requested directory. */ /* Attempt to move to the requested directory. */
ucReturned = f_chdir( ( char * ) pcParameter ); ucReturned = f_chdir( pcParameter );
if( ucReturned == F_NO_ERROR ) if( ucReturned == F_NO_ERROR )
{ {
sprintf( ( char * ) pcWriteBuffer, "In: " ); sprintf( pcWriteBuffer, "In: " );
xStringLength = strlen( ( const char * ) pcWriteBuffer ); xStringLength = strlen( pcWriteBuffer );
f_getcwd( ( char * ) &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) ); f_getcwd( &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) );
} }
else else
{ {
sprintf( ( char * ) pcWriteBuffer, "Error" ); sprintf( pcWriteBuffer, "Error" );
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return pdFALSE; return pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvDIRCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
static F_FIND *pxFindStruct = NULL; static F_FIND *pxFindStruct = NULL;
unsigned char ucReturned; unsigned char ucReturned;
@ -349,12 +349,12 @@ portBASE_TYPE xReturn = pdFALSE;
} }
else else
{ {
snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." ); snprintf( pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." );
} }
} }
else else
{ {
snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." ); snprintf( pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." );
} }
} }
else else
@ -379,15 +379,15 @@ portBASE_TYPE xReturn = pdFALSE;
} }
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvDELCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength; portBASE_TYPE xParameterStringLength;
unsigned char ucReturned; unsigned char ucReturned;
@ -395,12 +395,12 @@ unsigned char ucReturned;
( void ) xWriteBufferLen; ( void ) xWriteBufferLen;
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
@ -410,43 +410,43 @@ unsigned char ucReturned;
if( ucReturned == F_NO_ERROR ) if( ucReturned == F_NO_ERROR )
{ {
sprintf( ( char * ) pcWriteBuffer, "%s was deleted", pcParameter ); sprintf( pcWriteBuffer, "%s was deleted", pcParameter );
} }
else else
{ {
sprintf( ( char * ) pcWriteBuffer, "Error" ); sprintf( pcWriteBuffer, "Error" );
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return pdFALSE; return pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvCOPYCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcSourceFile, *pcDestinationFile; char *pcSourceFile, *pcDestinationFile;
portBASE_TYPE xParameterStringLength; portBASE_TYPE xParameterStringLength;
long lSourceLength, lDestinationLength = 0; long lSourceLength, lDestinationLength = 0;
/* Obtain the name of the destination file. */ /* Obtain the name of the destination file. */
pcDestinationFile = ( int8_t * ) FreeRTOS_CLIGetParameter pcDestinationFile = ( char * ) FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
2, /* Return the second parameter. */ 2, /* Return the second parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcDestinationFile ); configASSERT( pcDestinationFile );
/* Obtain the name of the source file. */ /* Obtain the name of the source file. */
pcSourceFile = ( int8_t * ) FreeRTOS_CLIGetParameter pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcSourceFile ); configASSERT( pcSourceFile );
@ -459,7 +459,7 @@ long lSourceLength, lDestinationLength = 0;
if( lSourceLength == 0 ) if( lSourceLength == 0 )
{ {
sprintf( ( char * ) pcWriteBuffer, "Source file does not exist" ); sprintf( pcWriteBuffer, "Source file does not exist" );
} }
else else
{ {
@ -468,7 +468,7 @@ long lSourceLength, lDestinationLength = 0;
if( lDestinationLength != 0 ) if( lDestinationLength != 0 )
{ {
sprintf( ( char * ) pcWriteBuffer, "Error: Destination file already exists" ); sprintf( pcWriteBuffer, "Error: Destination file already exists" );
} }
} }
@ -478,25 +478,25 @@ long lSourceLength, lDestinationLength = 0;
{ {
if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS ) if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS )
{ {
sprintf( ( char * ) pcWriteBuffer, "Copy made" ); sprintf( pcWriteBuffer, "Copy made" );
} }
else else
{ {
sprintf( ( char * ) pcWriteBuffer, "Error during copy" ); sprintf( pcWriteBuffer, "Error during copy" );
} }
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return pdFALSE; return pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvPerformCopy( int8_t *pcSourceFile, static portBASE_TYPE prvPerformCopy( char *pcSourceFile,
int32_t lSourceFileLength, int32_t lSourceFileLength,
int8_t *pcDestinationFile, char *pcDestinationFile,
int8_t *pxWriteBuffer, char *pxWriteBuffer,
size_t xWriteBufferLen ) size_t xWriteBufferLen )
{ {
int32_t lBytesRead = 0, lBytesToRead, lBytesRemaining; int32_t lBytesRead = 0, lBytesToRead, lBytesRemaining;
F_FILE *pxFile; F_FILE *pxFile;
@ -557,7 +557,7 @@ portBASE_TYPE xReturn = pdPASS;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvCreateFileInfoString( int8_t *pcBuffer, F_FIND *pxFindStruct ) static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct )
{ {
const char *pcWritableFile = "writable file", *pcReadOnlyFile = "read only file", *pcDirectory = "directory"; const char *pcWritableFile = "writable file", *pcReadOnlyFile = "read only file", *pcDirectory = "directory";
const char * pcAttrib; const char * pcAttrib;
@ -578,5 +578,5 @@ const char * pcAttrib;
/* Create a string that includes the file name, the file size and the /* Create a string that includes the file name, the file size and the
attributes string. */ attributes string. */
sprintf( ( char * ) pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, pxFindStruct->filesize ); sprintf( pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, pxFindStruct->filesize );
} }

View file

@ -101,22 +101,22 @@
/* /*
* Implements the run-time-stats command. * Implements the run-time-stats command.
*/ */
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the task-stats command. * Implements the task-stats command.
*/ */
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the echo-three-parameters command. * Implements the echo-three-parameters command.
*/ */
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the echo-parameters command. * Implements the echo-parameters command.
*/ */
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Registers the CLI commands defined within this file with the FreeRTOS+CLI * Registers the CLI commands defined within this file with the FreeRTOS+CLI
@ -128,7 +128,7 @@ void vRegisterSampleCLICommands( void );
* Implements the "trace start" and "trace stop" commands; * Implements the "trace start" and "trace stop" commands;
*/ */
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
#endif #endif
/* Structure that defines the "run-time-stats" command line command. This /* Structure that defines the "run-time-stats" command line command. This
@ -203,7 +203,7 @@ void vRegisterSampleCLICommands( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n"; const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
@ -215,8 +215,8 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
configASSERT( pcWriteBuffer ); configASSERT( pcWriteBuffer );
/* Generate a table of task stats. */ /* Generate a table of task stats. */
strcpy( ( char * ) pcWriteBuffer, pcHeader ); strcpy( pcWriteBuffer, pcHeader );
vTaskList( ( char * ) pcWriteBuffer + strlen( pcHeader ) ); vTaskList( pcWriteBuffer + strlen( pcHeader ) );
/* There is no more data to return after this single string, so return /* There is no more data to return after this single string, so return
pdFALSE. */ pdFALSE. */
@ -224,7 +224,7 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n"; const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
@ -236,8 +236,8 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
configASSERT( pcWriteBuffer ); configASSERT( pcWriteBuffer );
/* Generate a table of task stats. */ /* Generate a table of task stats. */
strcpy( ( char * ) pcWriteBuffer, pcHeader ); strcpy( pcWriteBuffer, pcHeader );
vTaskGetRunTimeStats( ( ( char * ) pcWriteBuffer ) + strlen( pcHeader ) ); vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
/* There is no more data to return after this single string, so return /* There is no more data to return after this single string, so return
pdFALSE. */ pdFALSE. */
@ -245,9 +245,9 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn; portBASE_TYPE xParameterStringLength, xReturn;
static portBASE_TYPE lParameterNumber = 0; static portBASE_TYPE lParameterNumber = 0;
@ -262,7 +262,7 @@ static portBASE_TYPE lParameterNumber = 0;
{ {
/* The first time the function is called after the command has been /* The first time the function is called after the command has been
entered just a header string is returned. */ 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 /* Next time the function is called the first parameter will be echoed
back. */ back. */
@ -275,21 +275,21 @@ static portBASE_TYPE lParameterNumber = 0;
else else
{ {
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
lParameterNumber, /* Return the next parameter. */ lParameterNumber, /* Return the next parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
/* Return the parameter string. */ /* Return the parameter string. */
memset( pcWriteBuffer, 0x00, xWriteBufferLen ); memset( pcWriteBuffer, 0x00, xWriteBufferLen );
sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
/* If this is the last of the three parameters then there are no more /* If this is the last of the three parameters then there are no more
strings to return after this one. */ strings to return after this one. */
@ -312,9 +312,9 @@ static portBASE_TYPE lParameterNumber = 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn; portBASE_TYPE xParameterStringLength, xReturn;
static portBASE_TYPE lParameterNumber = 0; static portBASE_TYPE lParameterNumber = 0;
@ -329,7 +329,7 @@ static portBASE_TYPE lParameterNumber = 0;
{ {
/* The first time the function is called after the command has been /* The first time the function is called after the command has been
entered just a header string is returned. */ 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 /* Next time the function is called the first parameter will be echoed
back. */ back. */
@ -342,20 +342,20 @@ static portBASE_TYPE lParameterNumber = 0;
else else
{ {
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
lParameterNumber, /* Return the next parameter. */ lParameterNumber, /* Return the next parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
if( pcParameter != NULL ) if( pcParameter != NULL )
{ {
/* Return the parameter string. */ /* Return the parameter string. */
memset( pcWriteBuffer, 0x00, xWriteBufferLen ); memset( pcWriteBuffer, 0x00, xWriteBufferLen );
sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
/* There might be more parameters to return after this one. */ /* There might be more parameters to return after this one. */
xReturn = pdTRUE; xReturn = pdTRUE;
@ -381,9 +381,9 @@ static portBASE_TYPE lParameterNumber = 0;
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; char *pcParameter;
portBASE_TYPE lParameterStringLength; portBASE_TYPE lParameterStringLength;
/* Remove compile time warnings about unused parameters, and check the /* Remove compile time warnings about unused parameters, and check the
@ -394,12 +394,12 @@ static portBASE_TYPE lParameterNumber = 0;
configASSERT( pcWriteBuffer ); configASSERT( pcWriteBuffer );
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&lParameterStringLength /* Store the parameter string length. */ &lParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
@ -412,17 +412,17 @@ static portBASE_TYPE lParameterNumber = 0;
vTraceClear(); vTraceClear();
vTraceStart(); 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( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
{ {
/* End the trace, if one is running. */ /* End the trace, if one is running. */
vTraceStop(); vTraceStop();
sprintf( ( char * ) pcWriteBuffer, "Stopping trace recording.\r\n" ); sprintf( pcWriteBuffer, "Stopping trace recording.\r\n" );
} }
else 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 /* There is no more data to return after this single string, so return

View file

@ -84,9 +84,9 @@ static void prvUARTCommandConsoleTask( void *pvParameters );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* Const messages output by the command console. */ /* Const messages output by the command console. */
static const signed char * const pcWelcomeMessage = "FreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>"; static const char * const pcWelcomeMessage = "FreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>";
static const signed char * const pcEndOfOutputMessage = "\r\n[Press ENTER to execute the previous command again]\r\n>"; static const char * const pcEndOfOutputMessage = "\r\n[Press ENTER to execute the previous command again]\r\n>";
static const signed char * const pcNewLine = "\r\n"; static const char * const pcNewLine = "\r\n";
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -104,8 +104,8 @@ void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPr
static void prvUARTCommandConsoleTask( void *pvParameters ) static void prvUARTCommandConsoleTask( void *pvParameters )
{ {
int8_t cRxedChar, cInputIndex = 0, *pcOutputString; char cRxedChar, cInputIndex = 0, *pcOutputString;
static int8_t cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ]; static char cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ];
portBASE_TYPE xReturned; portBASE_TYPE xReturned;
( void ) pvParameters; ( void ) pvParameters;
@ -116,12 +116,12 @@ portBASE_TYPE xReturned;
pcOutputString = FreeRTOS_CLIGetOutputBuffer(); pcOutputString = FreeRTOS_CLIGetOutputBuffer();
/* Send the welcome message. */ /* Send the welcome message. */
vSerialPutString( NULL, pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) ); vSerialPutString( NULL, ( const signed char * ) pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) );
for( ;; ) for( ;; )
{ {
/* Only interested in reading one character at a time. */ /* Only interested in reading one character at a time. */
while( xSerialGetChar( NULL, &cRxedChar, portMAX_DELAY ) == pdFALSE ); while( xSerialGetChar( NULL, ( signed char * ) &cRxedChar, portMAX_DELAY ) == pdFALSE );
/* Echo the character back. */ /* Echo the character back. */
xSerialPutChar( NULL, cRxedChar, portMAX_DELAY ); xSerialPutChar( NULL, cRxedChar, portMAX_DELAY );
@ -130,7 +130,7 @@ portBASE_TYPE xReturned;
if( cRxedChar == '\n' || cRxedChar == '\r' ) if( cRxedChar == '\n' || cRxedChar == '\r' )
{ {
/* Just to space the output from the input. */ /* Just to space the output from the input. */
vSerialPutString( NULL, pcNewLine, strlen( ( char * ) pcNewLine ) ); vSerialPutString( NULL, ( const signed char * ) pcNewLine, strlen( ( char * ) pcNewLine ) );
/* See if the command is empty, indicating that the last command is /* See if the command is empty, indicating that the last command is
to be executed again. */ to be executed again. */
@ -150,7 +150,7 @@ portBASE_TYPE xReturned;
xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE ); xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE );
/* Write the generated string to the UART. */ /* Write the generated string to the UART. */
vSerialPutString( NULL, pcOutputString, strlen( ( char * ) pcOutputString ) ); vSerialPutString( NULL, ( const signed char * ) pcOutputString, strlen( ( char * ) pcOutputString ) );
} while( xReturned != pdFALSE ); } while( xReturned != pdFALSE );
@ -161,7 +161,7 @@ portBASE_TYPE xReturned;
strcpy( ( char * ) cLastInputString, ( char * ) cInputString ); strcpy( ( char * ) cLastInputString, ( char * ) cInputString );
cInputIndex = 0; cInputIndex = 0;
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
vSerialPutString( NULL, pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) ); vSerialPutString( NULL, ( const signed char * ) pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) );
} }
else else
{ {

View file

@ -122,8 +122,8 @@ xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned port
/* Create the queues used to hold Rx/Tx characters. Note the comments at /* Create the queues used to hold Rx/Tx characters. Note the comments at
the top of this file regarding the use of queues in this manner. */ the top of this file regarding the use of queues in this manner. */
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( char ) );
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( char ) );
/* If the queues were created correctly then setup the serial port /* If the queues were created correctly then setup the serial port
hardware. */ hardware. */
@ -177,14 +177,14 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedC
void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength ) void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )
{ {
signed char *pxNext; char *pxNext;
/* A couple of parameters that this port does not use. */ /* A couple of parameters that this port does not use. */
( void ) usStringLength; ( void ) usStringLength;
( void ) pxPort; ( void ) pxPort;
/* Send each character in the string, one at a time. */ /* Send each character in the string, one at a time. */
pxNext = ( signed char * ) pcString; pxNext = ( char * ) pcString;
while( *pxNext ) while( *pxNext )
{ {
xSerialPutChar( pxPort, *pxNext, portMAX_DELAY ); xSerialPutChar( pxPort, *pxNext, portMAX_DELAY );

View file

@ -101,36 +101,36 @@
/* /*
* Implements the run-time-stats command. * Implements the run-time-stats command.
*/ */
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the task-stats command. * Implements the task-stats command.
*/ */
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the echo-three-parameters command. * Implements the echo-three-parameters command.
*/ */
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the echo-parameters command. * Implements the echo-parameters command.
*/ */
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the "trace start" and "trace stop" commands; * Implements the "trace start" and "trace stop" commands;
*/ */
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
#endif #endif
/* Structure that defines the "run-time-stats" command line command. This /* Structure that defines the "run-time-stats" command line command. This
generates a table that shows how much run time each task has */ generates a table that shows how much run time each task has */
static const CLI_Command_Definition_t xRunTimeStats = static const CLI_Command_Definition_t xRunTimeStats =
{ {
( const int8_t * const ) "run-time-stats", /* The command string to type. */ "run-time-stats", /* The command string to type. */
( const int8_t * const ) "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n", "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n",
prvRunTimeStatsCommand, /* The function to run. */ prvRunTimeStatsCommand, /* The function to run. */
0 /* No parameters are expected. */ 0 /* No parameters are expected. */
}; };
@ -139,8 +139,8 @@ static const CLI_Command_Definition_t xRunTimeStats =
a table that gives information on each task in the system. */ a table that gives information on each task in the system. */
static const CLI_Command_Definition_t xTaskStats = static const CLI_Command_Definition_t xTaskStats =
{ {
( const int8_t * const ) "task-stats", /* The command string to type. */ "task-stats", /* The command string to type. */
( const int8_t * const ) "\r\ntask-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n", "\r\ntask-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n",
prvTaskStatsCommand, /* The function to run. */ prvTaskStatsCommand, /* The function to run. */
0 /* No parameters are expected. */ 0 /* No parameters are expected. */
}; };
@ -150,8 +150,8 @@ takes exactly three parameters that the command simply echos back one at a
time. */ time. */
static const CLI_Command_Definition_t xThreeParameterEcho = static const CLI_Command_Definition_t xThreeParameterEcho =
{ {
( const int8_t * const ) "echo-3-parameters", "echo-3-parameters",
( const int8_t * const ) "\r\necho-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n", "\r\necho-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n",
prvThreeParameterEchoCommand, /* The function to run. */ prvThreeParameterEchoCommand, /* The function to run. */
3 /* Three parameters are expected, which can take any value. */ 3 /* Three parameters are expected, which can take any value. */
}; };
@ -161,8 +161,8 @@ takes a variable number of parameters that the command simply echos back one at
a time. */ a time. */
static const CLI_Command_Definition_t xParameterEcho = static const CLI_Command_Definition_t xParameterEcho =
{ {
( const int8_t * const ) "echo-parameters", "echo-parameters",
( const int8_t * const ) "\r\necho-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n", "\r\necho-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n",
prvParameterEchoCommand, /* The function to run. */ prvParameterEchoCommand, /* The function to run. */
-1 /* The user can enter any number of commands. */ -1 /* The user can enter any number of commands. */
}; };
@ -172,8 +172,8 @@ static const CLI_Command_Definition_t xParameterEcho =
parameter, which can be either "start" or "stop". */ parameter, which can be either "start" or "stop". */
static const CLI_Command_Definition_t xStartStopTrace = static const CLI_Command_Definition_t xStartStopTrace =
{ {
( const int8_t * const ) "trace", "trace",
( const int8_t * const ) "\r\ntrace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n", "\r\ntrace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n",
prvStartStopTraceCommand, /* The function to run. */ prvStartStopTraceCommand, /* The function to run. */
1 /* One parameter is expected. Valid values are "start" and "stop". */ 1 /* One parameter is expected. Valid values are "start" and "stop". */
}; };
@ -197,7 +197,7 @@ void vRegisterSampleCLICommands( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n"; const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
@ -209,8 +209,8 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
configASSERT( pcWriteBuffer ); configASSERT( pcWriteBuffer );
/* Generate a table of task stats. */ /* Generate a table of task stats. */
strcpy( ( char * ) pcWriteBuffer, pcHeader ); strcpy( pcWriteBuffer, pcHeader );
vTaskList( ( char * ) pcWriteBuffer + strlen( ( char * ) pcHeader ) ); vTaskList( pcWriteBuffer + strlen( pcHeader ) );
/* There is no more data to return after this single string, so return /* There is no more data to return after this single string, so return
pdFALSE. */ pdFALSE. */
@ -218,7 +218,7 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n"; const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
@ -230,8 +230,8 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
configASSERT( pcWriteBuffer ); configASSERT( pcWriteBuffer );
/* Generate a table of task stats. */ /* Generate a table of task stats. */
strcpy( ( char * ) pcWriteBuffer, ( char * ) pcHeader ); strcpy( pcWriteBuffer, pcHeader );
vTaskGetRunTimeStats( ( char * ) pcWriteBuffer + strlen( ( char * ) pcHeader ) ); vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
/* There is no more data to return after this single string, so return /* There is no more data to return after this single string, so return
pdFALSE. */ pdFALSE. */
@ -239,9 +239,9 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn; portBASE_TYPE xParameterStringLength, xReturn;
static portBASE_TYPE lParameterNumber = 0; 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 /* The first time the function is called after the command has been
entered just a header string is returned. */ 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 /* Next time the function is called the first parameter will be echoed
back. */ back. */
@ -269,21 +269,21 @@ static portBASE_TYPE lParameterNumber = 0;
else else
{ {
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
lParameterNumber, /* Return the next parameter. */ lParameterNumber, /* Return the next parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
/* Return the parameter string. */ /* Return the parameter string. */
memset( pcWriteBuffer, 0x00, xWriteBufferLen ); memset( pcWriteBuffer, 0x00, xWriteBufferLen );
sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, pcParameter, xParameterStringLength );
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
/* If this is the last of the three parameters then there are no more /* If this is the last of the three parameters then there are no more
strings to return after this one. */ strings to return after this one. */
@ -306,9 +306,9 @@ static portBASE_TYPE lParameterNumber = 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn; portBASE_TYPE xParameterStringLength, xReturn;
static portBASE_TYPE lParameterNumber = 0; 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 /* The first time the function is called after the command has been
entered just a header string is returned. */ 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 /* Next time the function is called the first parameter will be echoed
back. */ back. */
@ -336,20 +336,20 @@ static portBASE_TYPE lParameterNumber = 0;
else else
{ {
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
lParameterNumber, /* Return the next parameter. */ lParameterNumber, /* Return the next parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
if( pcParameter != NULL ) if( pcParameter != NULL )
{ {
/* Return the parameter string. */ /* Return the parameter string. */
memset( pcWriteBuffer, 0x00, xWriteBufferLen ); memset( pcWriteBuffer, 0x00, xWriteBufferLen );
sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber );
strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength );
strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) );
/* There might be more parameters to return after this one. */ /* There might be more parameters to return after this one. */
xReturn = pdTRUE; xReturn = pdTRUE;
@ -375,9 +375,9 @@ static portBASE_TYPE lParameterNumber = 0;
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE lParameterStringLength; portBASE_TYPE lParameterStringLength;
/* Remove compile time warnings about unused parameters, and check the /* Remove compile time warnings about unused parameters, and check the
@ -388,12 +388,12 @@ static portBASE_TYPE lParameterNumber = 0;
configASSERT( pcWriteBuffer ); configASSERT( pcWriteBuffer );
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&lParameterStringLength /* Store the parameter string length. */ &lParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
@ -406,17 +406,17 @@ static portBASE_TYPE lParameterNumber = 0;
vTraceClear(); vTraceClear();
vTraceStart(); 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( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 )
{ {
/* End the trace, if one is running. */ /* End the trace, if one is running. */
vTraceStop(); vTraceStop();
sprintf( ( char * ) pcWriteBuffer, "Stopping trace recording.\r\n" ); sprintf( pcWriteBuffer, "Stopping trace recording.\r\n" );
} }
else 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 /* There is no more data to return after this single string, so return

View file

@ -105,7 +105,7 @@ static void prvUARTCommandConsoleTask( void *pvParameters );
* Ensure a previous interrupt driven Tx has completed before sending the next * Ensure a previous interrupt driven Tx has completed before sending the next
* data block to the UART. * data block to the UART.
*/ */
static void prvSendBuffer( struct usart_module *pxCDCUsart, uint8_t * pcBuffer, size_t xBufferLength ); static void prvSendBuffer( struct usart_module *pxCDCUsart, const char * pcBuffer, size_t xBufferLength );
/* /*
* Register the 'standard' sample CLI commands with FreeRTOS+CLI. * Register the 'standard' sample CLI commands with FreeRTOS+CLI.
@ -129,9 +129,9 @@ static void prvUARTRxNotificationHandler( const struct usart_module *const pxUSA
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* Const messages output by the command console. */ /* Const messages output by the command console. */
static uint8_t * const pcWelcomeMessage = ( uint8_t * ) "\r\n\r\nFreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>"; static char * const pcWelcomeMessage = "\r\n\r\nFreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>";
static const uint8_t * const pcEndOfOutputMessage = ( uint8_t * ) "\r\n[Press ENTER to execute the previous command again]\r\n>"; static const char * const pcEndOfOutputMessage = "\r\n[Press ENTER to execute the previous command again]\r\n>";
static const uint8_t * const pcNewLine = ( uint8_t * ) "\r\n"; static const char * const pcNewLine = "\r\n";
/* This semaphore is used to allow the task to wait for a Tx to complete /* This semaphore is used to allow the task to wait for a Tx to complete
without wasting any CPU time. */ without wasting any CPU time. */
@ -159,8 +159,9 @@ void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPr
static void prvUARTCommandConsoleTask( void *pvParameters ) static void prvUARTCommandConsoleTask( void *pvParameters )
{ {
uint8_t ucRxedChar, ucInputIndex = 0, *pucOutputString; char cRxedChar, *pcOutputString;
static int8_t cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ]; uint8_t ucInputIndex = 0;
static char cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ];
portBASE_TYPE xReturned; portBASE_TYPE xReturned;
static struct usart_module xCDCUsart; /* Static so it doesn't take up too much stack. */ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much stack. */
@ -174,7 +175,7 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
/* Obtain the address of the output buffer. Note there is no mutual /* Obtain the address of the output buffer. Note there is no mutual
exclusion on this buffer as it is assumed only one command console exclusion on this buffer as it is assumed only one command console
interface will be used at any one time. */ interface will be used at any one time. */
pucOutputString = ( uint8_t * ) FreeRTOS_CLIGetOutputBuffer(); pcOutputString = FreeRTOS_CLIGetOutputBuffer();
/* Send the welcome message. */ /* Send the welcome message. */
prvSendBuffer( &xCDCUsart, pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) ); prvSendBuffer( &xCDCUsart, pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) );
@ -183,17 +184,17 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
{ {
/* Wait for the next character to arrive. A semaphore is used to /* Wait for the next character to arrive. A semaphore is used to
ensure no CPU time is used until data has arrived. */ ensure no CPU time is used until data has arrived. */
usart_read_buffer_job( &xCDCUsart, &ucRxedChar, sizeof( ucRxedChar ) ); usart_read_buffer_job( &xCDCUsart, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) );
if( xSemaphoreTake( xRxCompleteSemaphore, portMAX_DELAY ) == pdPASS ) if( xSemaphoreTake( xRxCompleteSemaphore, portMAX_DELAY ) == pdPASS )
{ {
/* Echo the character back. */ /* Echo the character back. */
prvSendBuffer( &xCDCUsart, ( uint8_t * ) &ucRxedChar, sizeof( ucRxedChar ) ); prvSendBuffer( &xCDCUsart, &cRxedChar, sizeof( cRxedChar ) );
/* Was it the end of the line? */ /* Was it the end of the line? */
if( ucRxedChar == '\n' || ucRxedChar == '\r' ) if( cRxedChar == '\n' || cRxedChar == '\r' )
{ {
/* Just to space the output from the input. */ /* Just to space the output from the input. */
prvSendBuffer( &xCDCUsart, ( uint8_t * ) pcNewLine, strlen( ( char * ) pcNewLine ) ); prvSendBuffer( &xCDCUsart, pcNewLine, strlen( pcNewLine ) );
/* See if the command is empty, indicating that the last command is /* See if the command is empty, indicating that the last command is
to be executed again. */ to be executed again. */
@ -210,10 +211,10 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
do do
{ {
/* Get the next output string from the command interpreter. */ /* Get the next output string from the command interpreter. */
xReturned = FreeRTOS_CLIProcessCommand( cInputString, ( int8_t * ) pucOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE ); xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE );
/* Write the generated string to the UART. */ /* Write the generated string to the UART. */
prvSendBuffer( &xCDCUsart, ( uint8_t * ) pucOutputString, strlen( ( char * ) pucOutputString ) ); prvSendBuffer( &xCDCUsart, pcOutputString, strlen( pcOutputString ) );
} while( xReturned != pdFALSE ); } while( xReturned != pdFALSE );
@ -225,15 +226,15 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
ucInputIndex = 0; ucInputIndex = 0;
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
prvSendBuffer( &xCDCUsart, ( uint8_t * ) pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) ); prvSendBuffer( &xCDCUsart, pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) );
} }
else else
{ {
if( ucRxedChar == '\r' ) if( cRxedChar == '\r' )
{ {
/* Ignore the character. */ /* Ignore the character. */
} }
else if( ( ucRxedChar == '\b' ) || ( ucRxedChar == cmdASCII_DEL ) ) else if( ( cRxedChar == '\b' ) || ( cRxedChar == cmdASCII_DEL ) )
{ {
/* Backspace was pressed. Erase the last character in the /* Backspace was pressed. Erase the last character in the
string - if any. */ string - if any. */
@ -248,11 +249,11 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
/* A character was entered. Add it to the string /* A character was entered. Add it to the string
entered so far. When a \n is entered the complete entered so far. When a \n is entered the complete
string will be passed to the command interpreter. */ string will be passed to the command interpreter. */
if( ( ucRxedChar >= ' ' ) && ( ucRxedChar <= '~' ) ) if( ( cRxedChar >= ' ' ) && ( cRxedChar <= '~' ) )
{ {
if( ucInputIndex < cmdMAX_INPUT_SIZE ) if( ucInputIndex < cmdMAX_INPUT_SIZE )
{ {
cInputString[ ucInputIndex ] = ucRxedChar; cInputString[ ucInputIndex ] = cRxedChar;
ucInputIndex++; ucInputIndex++;
} }
} }
@ -263,13 +264,13 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvSendBuffer( struct usart_module *pxCDCUsart, uint8_t * pcBuffer, size_t xBufferLength ) static void prvSendBuffer( struct usart_module *pxCDCUsart, const char * pcBuffer, size_t xBufferLength )
{ {
const portTickType xBlockMax100ms = 100UL / portTICK_RATE_MS; const portTickType xBlockMax100ms = 100UL / portTICK_RATE_MS;
if( xBufferLength > 0 ) if( xBufferLength > 0 )
{ {
usart_write_buffer_job( pxCDCUsart, pcBuffer, xBufferLength ); usart_write_buffer_job( pxCDCUsart, ( uint8_t * ) pcBuffer, xBufferLength );
/* Wait for the Tx to complete so the buffer can be reused without /* Wait for the Tx to complete so the buffer can be reused without
corrupting the data that is being sent. */ corrupting the data that is being sent. */

View file

@ -104,48 +104,48 @@
/* /*
* Print out information on a single file. * Print out information on a single file.
*/ */
static void prvCreateFileInfoString( int8_t *pcBuffer, F_FIND *pxFindStruct ); static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct );
/* /*
* Copies an existing file into a newly created file. * Copies an existing file into a newly created file.
*/ */
static portBASE_TYPE prvPerformCopy( int8_t *pcSourceFile, static portBASE_TYPE prvPerformCopy( const char *pcSourceFile,
int32_t lSourceFileLength, int32_t lSourceFileLength,
int8_t *pcDestinationFile, const char *pcDestinationFile,
int8_t *pxWriteBuffer, char *pxWriteBuffer,
size_t xWriteBufferLen ); size_t xWriteBufferLen );
/* /*
* Implements the DIR command. * Implements the DIR command.
*/ */
static portBASE_TYPE prvDIRCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the CD command. * Implements the CD command.
*/ */
static portBASE_TYPE prvCDCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the DEL command. * Implements the DEL command.
*/ */
static portBASE_TYPE prvDELCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the TYPE command. * Implements the TYPE command.
*/ */
static portBASE_TYPE prvTYPECommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the COPY command. * Implements the COPY command.
*/ */
static portBASE_TYPE prvCOPYCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* Structure that defines the DIR command line command, which lists all the /* Structure that defines the DIR command line command, which lists all the
files in the current directory. */ files in the current directory. */
static const CLI_Command_Definition_t xDIR = static const CLI_Command_Definition_t xDIR =
{ {
( const int8_t * const ) "dir", /* The command string to type. */ "dir", /* The command string to type. */
( const int8_t * const ) "\r\ndir:\r\n Lists the files in the current directory\r\n", "\r\ndir:\r\n Lists the files in the current directory\r\n",
prvDIRCommand, /* The function to run. */ prvDIRCommand, /* The function to run. */
0 /* No parameters are expected. */ 0 /* No parameters are expected. */
}; };
@ -154,8 +154,8 @@ static const CLI_Command_Definition_t xDIR =
working directory. */ working directory. */
static const CLI_Command_Definition_t xCD = static const CLI_Command_Definition_t xCD =
{ {
( const int8_t * const ) "cd", /* The command string to type. */ "cd", /* The command string to type. */
( const int8_t * const ) "\r\ncd <dir name>:\r\n Changes the working directory\r\n", "\r\ncd <dir name>:\r\n Changes the working directory\r\n",
prvCDCommand, /* The function to run. */ prvCDCommand, /* The function to run. */
1 /* One parameter is expected. */ 1 /* One parameter is expected. */
}; };
@ -164,8 +164,8 @@ static const CLI_Command_Definition_t xCD =
contents of a file to the console. */ contents of a file to the console. */
static const CLI_Command_Definition_t xTYPE = static const CLI_Command_Definition_t xTYPE =
{ {
( const int8_t * const ) "type", /* The command string to type. */ "type", /* The command string to type. */
( const int8_t * const ) "\r\ntype <filename>:\r\n Prints file contents to the terminal\r\n", "\r\ntype <filename>:\r\n Prints file contents to the terminal\r\n",
prvTYPECommand, /* The function to run. */ prvTYPECommand, /* The function to run. */
1 /* One parameter is expected. */ 1 /* One parameter is expected. */
}; };
@ -173,8 +173,8 @@ static const CLI_Command_Definition_t xTYPE =
/* Structure that defines the DEL command line command, which deletes a file. */ /* Structure that defines the DEL command line command, which deletes a file. */
static const CLI_Command_Definition_t xDEL = static const CLI_Command_Definition_t xDEL =
{ {
( const int8_t * const ) "del", /* The command string to type. */ "del", /* The command string to type. */
( const int8_t * const ) "\r\ndel <filename>:\r\n deletes a file or directory\r\n", "\r\ndel <filename>:\r\n deletes a file or directory\r\n",
prvDELCommand, /* The function to run. */ prvDELCommand, /* The function to run. */
1 /* One parameter is expected. */ 1 /* One parameter is expected. */
}; };
@ -182,8 +182,8 @@ static const CLI_Command_Definition_t xDEL =
/* Structure that defines the COPY command line command, which deletes a file. */ /* Structure that defines the COPY command line command, which deletes a file. */
static const CLI_Command_Definition_t xCOPY = static const CLI_Command_Definition_t xCOPY =
{ {
( const int8_t * const ) "copy", /* The command string to type. */ "copy", /* The command string to type. */
( const int8_t * const ) "\r\ncopy <source file> <dest file>:\r\n Copies <source file> to <dest file>\r\n", "\r\ncopy <source file> <dest file>:\r\n Copies <source file> to <dest file>\r\n",
prvCOPYCommand, /* The function to run. */ prvCOPYCommand, /* The function to run. */
2 /* Two parameters are expected. */ 2 /* Two parameters are expected. */
}; };
@ -201,9 +201,9 @@ void vRegisterFileSystemCLICommands( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvTYPECommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn = pdTRUE; portBASE_TYPE xParameterStringLength, xReturn = pdTRUE;
static F_FILE *pxFile = NULL; static F_FILE *pxFile = NULL;
int iChar; int iChar;
@ -227,12 +227,12 @@ size_t xColumns = 50U;
if( pxFile == NULL ) if( pxFile == NULL )
{ {
/* The file has not been opened yet. Find the file name. */ /* The file has not been opened yet. Find the file name. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
@ -257,7 +257,7 @@ size_t xColumns = 50U;
} }
else else
{ {
pcWriteBuffer[ xByte ] = ( int8_t ) iChar; pcWriteBuffer[ xByte ] = ( char ) iChar;
} }
} }
} }
@ -269,51 +269,51 @@ size_t xColumns = 50U;
xReturn = pdFALSE; xReturn = pdFALSE;
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvCDCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength; portBASE_TYPE xParameterStringLength;
unsigned char ucReturned; unsigned char ucReturned;
size_t xStringLength; size_t xStringLength;
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
/* Attempt to move to the requested directory. */ /* Attempt to move to the requested directory. */
ucReturned = f_chdir( ( char * ) pcParameter ); ucReturned = f_chdir( pcParameter );
if( ucReturned == F_NO_ERROR ) if( ucReturned == F_NO_ERROR )
{ {
sprintf( ( char * ) pcWriteBuffer, "In: " ); sprintf( pcWriteBuffer, "In: " );
xStringLength = strlen( ( const char * ) pcWriteBuffer ); xStringLength = strlen( pcWriteBuffer );
f_getcwd( ( char * ) &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) ); f_getcwd( &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) );
} }
else else
{ {
sprintf( ( char * ) pcWriteBuffer, "Error" ); sprintf( pcWriteBuffer, "Error" );
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return pdFALSE; return pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvDIRCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
static F_FIND *pxFindStruct = NULL; static F_FIND *pxFindStruct = NULL;
unsigned char ucReturned; unsigned char ucReturned;
@ -343,12 +343,12 @@ portBASE_TYPE xReturn = pdFALSE;
} }
else else
{ {
snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." ); snprintf( pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." );
} }
} }
else else
{ {
snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." ); snprintf( pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." );
} }
} }
else else
@ -373,15 +373,15 @@ portBASE_TYPE xReturn = pdFALSE;
} }
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return xReturn; return xReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvDELCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; const char *pcParameter;
portBASE_TYPE xParameterStringLength; portBASE_TYPE xParameterStringLength;
unsigned char ucReturned; unsigned char ucReturned;
@ -389,12 +389,12 @@ unsigned char ucReturned;
( void ) xWriteBufferLen; ( void ) xWriteBufferLen;
/* Obtain the parameter string. */ /* Obtain the parameter string. */
pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter pcParameter = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcParameter ); configASSERT( pcParameter );
@ -404,43 +404,44 @@ unsigned char ucReturned;
if( ucReturned == F_NO_ERROR ) if( ucReturned == F_NO_ERROR )
{ {
sprintf( ( char * ) pcWriteBuffer, "%s was deleted", pcParameter ); sprintf( pcWriteBuffer, "%s was deleted", pcParameter );
} }
else else
{ {
sprintf( ( char * ) pcWriteBuffer, "Error" ); sprintf( pcWriteBuffer, "Error" );
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return pdFALSE; return pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvCOPYCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcSourceFile, *pcDestinationFile; const char *pcDestinationFile;
char *pcSourceFile;
portBASE_TYPE xParameterStringLength; portBASE_TYPE xParameterStringLength;
long lSourceLength, lDestinationLength = 0; long lSourceLength, lDestinationLength = 0;
/* Obtain the name of the destination file. */ /* Obtain the name of the destination file. */
pcDestinationFile = ( int8_t * ) FreeRTOS_CLIGetParameter pcDestinationFile = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
2, /* Return the second parameter. */ 2, /* Return the second parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcDestinationFile ); configASSERT( pcDestinationFile );
/* Obtain the name of the source file. */ /* Obtain the name of the source file. */
pcSourceFile = ( int8_t * ) FreeRTOS_CLIGetParameter pcSourceFile = FreeRTOS_CLIGetParameter
( (
pcCommandString, /* The command string itself. */ pcCommandString, /* The command string itself. */
1, /* Return the first parameter. */ 1, /* Return the first parameter. */
&xParameterStringLength /* Store the parameter string length. */ &xParameterStringLength /* Store the parameter string length. */
); );
/* Sanity check something was returned. */ /* Sanity check something was returned. */
configASSERT( pcSourceFile ); configASSERT( pcSourceFile );
@ -449,20 +450,20 @@ long lSourceLength, lDestinationLength = 0;
pcSourceFile[ xParameterStringLength ] = 0x00; pcSourceFile[ xParameterStringLength ] = 0x00;
/* See if the source file exists, obtain its length if it does. */ /* 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 ) if( lSourceLength == 0 )
{ {
sprintf( ( char * ) pcWriteBuffer, "Source file does not exist" ); sprintf( pcWriteBuffer, "Source file does not exist" );
} }
else else
{ {
/* See if the destination file exists. */ /* See if the destination file exists. */
lDestinationLength = f_filelength( ( const char * ) pcDestinationFile ); lDestinationLength = f_filelength( pcDestinationFile );
if( lDestinationLength != 0 ) if( lDestinationLength != 0 )
{ {
sprintf( ( char * ) pcWriteBuffer, "Error: Destination file already exists" ); sprintf( pcWriteBuffer, "Error: Destination file already exists" );
} }
} }
@ -472,25 +473,25 @@ long lSourceLength, lDestinationLength = 0;
{ {
if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS ) if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS )
{ {
sprintf( ( char * ) pcWriteBuffer, "Copy made" ); sprintf( pcWriteBuffer, "Copy made" );
} }
else else
{ {
sprintf( ( char * ) pcWriteBuffer, "Error during copy" ); sprintf( pcWriteBuffer, "Error during copy" );
} }
} }
strcat( ( char * ) pcWriteBuffer, cliNEW_LINE ); strcat( pcWriteBuffer, cliNEW_LINE );
return pdFALSE; return pdFALSE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvPerformCopy( int8_t *pcSourceFile, static portBASE_TYPE prvPerformCopy( const char *pcSourceFile,
int32_t lSourceFileLength, int32_t lSourceFileLength,
int8_t *pcDestinationFile, const char *pcDestinationFile,
int8_t *pxWriteBuffer, char *pxWriteBuffer,
size_t xWriteBufferLen ) size_t xWriteBufferLen )
{ {
int32_t lBytesRead = 0, lBytesToRead, lBytesRemaining; int32_t lBytesRead = 0, lBytesToRead, lBytesRemaining;
F_FILE *pxFile; F_FILE *pxFile;
@ -551,7 +552,7 @@ portBASE_TYPE xReturn = pdPASS;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvCreateFileInfoString( int8_t *pcBuffer, F_FIND *pxFindStruct ) static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct )
{ {
const char *pcWritableFile = "writable file", *pcReadOnlyFile = "read only file", *pcDirectory = "directory"; const char *pcWritableFile = "writable file", *pcReadOnlyFile = "read only file", *pcDirectory = "directory";
const char * pcAttrib; const char * pcAttrib;
@ -572,5 +573,5 @@ const char * pcAttrib;
/* Create a string that includes the file name, the file size and the /* Create a string that includes the file name, the file size and the
attributes string. */ attributes string. */
sprintf( ( char * ) pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, ( int ) pxFindStruct->filesize ); sprintf( pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, ( int ) pxFindStruct->filesize );
} }

View file

@ -101,36 +101,36 @@
/* /*
* Implements the run-time-stats command. * Implements the run-time-stats command.
*/ */
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the task-stats command. * Implements the task-stats command.
*/ */
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the echo-three-parameters command. * Implements the echo-three-parameters command.
*/ */
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the echo-parameters command. * Implements the echo-parameters command.
*/ */
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
/* /*
* Implements the "trace start" and "trace stop" commands; * Implements the "trace start" and "trace stop" commands;
*/ */
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ); static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );
#endif #endif
/* Structure that defines the "run-time-stats" command line command. This /* Structure that defines the "run-time-stats" command line command. This
generates a table that shows how much run time each task has */ generates a table that shows how much run time each task has */
static const CLI_Command_Definition_t xRunTimeStats = static const CLI_Command_Definition_t xRunTimeStats =
{ {
( const int8_t * const ) "run-time-stats", /* The command string to type. */ "run-time-stats", /* The command string to type. */
( const int8_t * const ) "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n", "\r\nrun-time-stats:\r\n Displays a table showing how much processing time each FreeRTOS task has used\r\n",
prvRunTimeStatsCommand, /* The function to run. */ prvRunTimeStatsCommand, /* The function to run. */
0 /* No parameters are expected. */ 0 /* No parameters are expected. */
}; };
@ -139,8 +139,8 @@ static const CLI_Command_Definition_t xRunTimeStats =
a table that gives information on each task in the system. */ a table that gives information on each task in the system. */
static const CLI_Command_Definition_t xTaskStats = static const CLI_Command_Definition_t xTaskStats =
{ {
( const int8_t * const ) "task-stats", /* The command string to type. */ "task-stats", /* The command string to type. */
( const int8_t * const ) "\r\ntask-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n", "\r\ntask-stats:\r\n Displays a table showing the state of each FreeRTOS task\r\n",
prvTaskStatsCommand, /* The function to run. */ prvTaskStatsCommand, /* The function to run. */
0 /* No parameters are expected. */ 0 /* No parameters are expected. */
}; };
@ -150,8 +150,8 @@ takes exactly three parameters that the command simply echos back one at a
time. */ time. */
static const CLI_Command_Definition_t xThreeParameterEcho = static const CLI_Command_Definition_t xThreeParameterEcho =
{ {
( const int8_t * const ) "echo-3-parameters", "echo-3-parameters",
( const int8_t * const ) "\r\necho-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n", "\r\necho-3-parameters <param1> <param2> <param3>:\r\n Expects three parameters, echos each in turn\r\n",
prvThreeParameterEchoCommand, /* The function to run. */ prvThreeParameterEchoCommand, /* The function to run. */
3 /* Three parameters are expected, which can take any value. */ 3 /* Three parameters are expected, which can take any value. */
}; };
@ -161,8 +161,8 @@ takes a variable number of parameters that the command simply echos back one at
a time. */ a time. */
static const CLI_Command_Definition_t xParameterEcho = static const CLI_Command_Definition_t xParameterEcho =
{ {
( const int8_t * const ) "echo-parameters", "echo-parameters",
( const int8_t * const ) "\r\necho-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n", "\r\necho-parameters <...>:\r\n Take variable number of parameters, echos each in turn\r\n",
prvParameterEchoCommand, /* The function to run. */ prvParameterEchoCommand, /* The function to run. */
-1 /* The user can enter any number of commands. */ -1 /* The user can enter any number of commands. */
}; };
@ -172,8 +172,8 @@ static const CLI_Command_Definition_t xParameterEcho =
parameter, which can be either "start" or "stop". */ parameter, which can be either "start" or "stop". */
static const CLI_Command_Definition_t xStartStopTrace = static const CLI_Command_Definition_t xStartStopTrace =
{ {
( const int8_t * const ) "trace", "trace",
( const int8_t * const ) "\r\ntrace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n", "\r\ntrace [start | stop]:\r\n Starts or stops a trace recording for viewing in FreeRTOS+Trace\r\n",
prvStartStopTraceCommand, /* The function to run. */ prvStartStopTraceCommand, /* The function to run. */
1 /* One parameter is expected. Valid values are "start" and "stop". */ 1 /* One parameter is expected. Valid values are "start" and "stop". */
}; };
@ -197,7 +197,7 @@ void vRegisterSampleCLICommands( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvTaskStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n"; const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
@ -218,7 +218,7 @@ const char *const pcHeader = "Task State Priority Stack #\r\n********
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvRunTimeStatsCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n"; const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
@ -239,7 +239,7 @@ const char * const pcHeader = "Task Abs Time % Time\r\n*********
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvThreeParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; int8_t *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn; portBASE_TYPE xParameterStringLength, xReturn;
@ -306,7 +306,7 @@ static portBASE_TYPE lParameterNumber = 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static portBASE_TYPE prvParameterEchoCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; int8_t *pcParameter;
portBASE_TYPE xParameterStringLength, xReturn; portBASE_TYPE xParameterStringLength, xReturn;
@ -375,7 +375,7 @@ static portBASE_TYPE lParameterNumber = 0;
#if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1 #if configINCLUDE_TRACE_RELATED_CLI_COMMANDS == 1
static portBASE_TYPE prvStartStopTraceCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ) static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{ {
int8_t *pcParameter; int8_t *pcParameter;
portBASE_TYPE lParameterStringLength; portBASE_TYPE lParameterStringLength;

View file

@ -101,7 +101,7 @@ static void prvUARTCommandConsoleTask( void *pvParameters );
* Ensure a previous interrupt driven Tx has completed before sending the next * Ensure a previous interrupt driven Tx has completed before sending the next
* data block to the UART. * data block to the UART.
*/ */
static void prvSendBuffer( const uint8_t * pcBuffer, size_t xBufferLength ); static void prvSendBuffer( const char * pcBuffer, size_t xBufferLength );
/* /*
* A UART is used for printf() output and CLI input and output. Configure the * A UART is used for printf() output and CLI input and output. Configure the
@ -113,9 +113,9 @@ static void prvUARTRxNotificationHandler( mss_uart_instance_t * this_uart );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* Const messages output by the command console. */ /* Const messages output by the command console. */
static const uint8_t * const pcWelcomeMessage = ( uint8_t * ) "\r\n\r\nFreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>"; static const char * const pcWelcomeMessage = "\r\n\r\nFreeRTOS command server.\r\nType Help to view a list of registered commands.\r\n\r\n>";
static const uint8_t * const pcEndOfOutputMessage = ( uint8_t * ) "\r\n[Press ENTER to execute the previous command again]\r\n>"; static const char * const pcEndOfOutputMessage = "\r\n[Press ENTER to execute the previous command again]\r\n>";
static const uint8_t * const pcNewLine = ( uint8_t * ) "\r\n"; static const char * const pcNewLine = "\r\n";
/* The UART used by the CLI. */ /* The UART used by the CLI. */
#if configBUILD_FOR_DEVELOPMENT_KIT == 1 #if configBUILD_FOR_DEVELOPMENT_KIT == 1
@ -152,8 +152,9 @@ void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPr
static void prvUARTCommandConsoleTask( void *pvParameters ) static void prvUARTCommandConsoleTask( void *pvParameters )
{ {
int8_t cRxedChar, cInputIndex = 0, *pcOutputString; char cRxedChar, *pcOutputString;
static int8_t cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ]; unsigned char cInputIndex = 0;
static char cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ];
portBASE_TYPE xReturned; portBASE_TYPE xReturned;
( void ) pvParameters; ( void ) pvParameters;
@ -172,13 +173,13 @@ portBASE_TYPE xReturned;
if( xQueueReceive( xRxedChars, &cRxedChar, portMAX_DELAY ) == pdPASS ) if( xQueueReceive( xRxedChars, &cRxedChar, portMAX_DELAY ) == pdPASS )
{ {
/* Echo the character back. */ /* Echo the character back. */
prvSendBuffer( ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) ); prvSendBuffer( &cRxedChar, sizeof( cRxedChar ) );
/* Was it the end of the line? */ /* Was it the end of the line? */
if( cRxedChar == '\n' || cRxedChar == '\r' ) if( cRxedChar == '\n' || cRxedChar == '\r' )
{ {
/* Just to space the output from the input. */ /* Just to space the output from the input. */
prvSendBuffer( ( uint8_t * ) pcNewLine, strlen( ( char * ) pcNewLine ) ); prvSendBuffer( pcNewLine, strlen( ( char * ) pcNewLine ) );
/* See if the command is empty, indicating that the last command is /* See if the command is empty, indicating that the last command is
to be executed again. */ to be executed again. */
@ -198,7 +199,7 @@ portBASE_TYPE xReturned;
xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE ); xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE );
/* Write the generated string to the UART. */ /* Write the generated string to the UART. */
prvSendBuffer( ( uint8_t * ) pcOutputString, strlen( ( char * ) pcOutputString ) ); prvSendBuffer( pcOutputString, strlen( pcOutputString ) );
} while( xReturned != pdFALSE ); } while( xReturned != pdFALSE );
@ -210,7 +211,7 @@ portBASE_TYPE xReturned;
cInputIndex = 0; cInputIndex = 0;
memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); memset( cInputString, 0x00, cmdMAX_INPUT_SIZE );
prvSendBuffer( ( uint8_t * ) pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) ); prvSendBuffer( pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) );
} }
else else
{ {
@ -248,13 +249,13 @@ portBASE_TYPE xReturned;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvSendBuffer( const uint8_t * pcBuffer, size_t xBufferLength ) static void prvSendBuffer( const char * pcBuffer, size_t xBufferLength )
{ {
const portTickType xVeryShortDelay = 2UL; const portTickType xVeryShortDelay = 2UL;
if( xBufferLength > 0 ) if( xBufferLength > 0 )
{ {
MSS_UART_irq_tx( ( mss_uart_instance_t * ) pxUART, pcBuffer, xBufferLength ); MSS_UART_irq_tx( ( mss_uart_instance_t * ) pxUART, ( uint8_t * ) pcBuffer, xBufferLength );
/* Ensure any previous transmissions have completed. The default UART /* Ensure any previous transmissions have completed. The default UART
interrupt does not provide an event based method of signally the end of a Tx interrupt does not provide an event based method of signally the end of a Tx
@ -292,13 +293,13 @@ static void prvConfigureUART( void )
static void prvUARTRxNotificationHandler( mss_uart_instance_t * pxUART ) static void prvUARTRxNotificationHandler( mss_uart_instance_t * pxUART )
{ {
uint8_t cRxed; char cRxed;
portBASE_TYPE xHigherPriorityTaskWoken; portBASE_TYPE xHigherPriorityTaskWoken;
/* The command console receives data very slowly (at the speed of somebody /* The command console receives data very slowly (at the speed of somebody
typing), therefore it is ok to just handle one character at a time and use typing), therefore it is ok to just handle one character at a time and use
a queue to send the characters to the task. */ a queue to send the characters to the task. */
if( MSS_UART_get_rx( pxUART, &cRxed, sizeof( cRxed ) ) == sizeof( cRxed ) ) if( MSS_UART_get_rx( pxUART, ( uint8_t * ) &cRxed, sizeof( cRxed ) ) == sizeof( cRxed ) )
{ {
xHigherPriorityTaskWoken = pdFALSE; xHigherPriorityTaskWoken = pdFALSE;
xQueueSendFromISR( xRxedChars, &cRxed, &xHigherPriorityTaskWoken ); xQueueSendFromISR( xRxedChars, &cRxed, &xHigherPriorityTaskWoken );