/*\r
- FreeRTOS V7.5.2 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+ FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+ All rights reserved\r
\r
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT\r
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
/*\r
* Print out information on a single file.\r
*/\r
-static void prvCreateFileInfoString( int8_t *pcBuffer, F_FIND *pxFindStruct );\r
+static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct );\r
\r
/*\r
* Copies an existing file into a newly created file.\r
*/\r
-static portBASE_TYPE prvPerformCopy( int8_t *pcSourceFile,\r
- int32_t lSourceFileLength,\r
- int8_t *pcDestinationFile,\r
- int8_t *pxWriteBuffer,\r
- size_t xWriteBufferLen );\r
+static portBASE_TYPE prvPerformCopy( char *pcSourceFile,\r
+ int32_t lSourceFileLength,\r
+ char *pcDestinationFile,\r
+ char *pxWriteBuffer,\r
+ size_t xWriteBufferLen );\r
\r
/*\r
* Implements the DIR command.\r
*/\r
-static portBASE_TYPE prvDIRCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );\r
+static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
\r
/*\r
* Implements the CD command.\r
*/\r
-static portBASE_TYPE prvCDCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );\r
+static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
\r
/*\r
* Implements the DEL command.\r
*/\r
-static portBASE_TYPE prvDELCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );\r
+static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
\r
/*\r
* Implements the TYPE command.\r
*/\r
-static portBASE_TYPE prvTYPECommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );\r
+static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
\r
/*\r
* Implements the COPY command.\r
*/\r
-static portBASE_TYPE prvCOPYCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );\r
+static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString );\r
\r
/*\r
* Registers the CLI commands that are specific to the files system with the\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static portBASE_TYPE prvTYPECommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )\r
+static portBASE_TYPE prvTYPECommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
-int8_t *pcParameter;\r
+const char *pcParameter;\r
portBASE_TYPE xParameterStringLength, xReturn = pdTRUE;\r
static F_FILE *pxFile = NULL;\r
int iChar;\r
if( pxFile == NULL )\r
{\r
/* The file has not been opened yet. Find the file name. */\r
- pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter\r
- (\r
- pcCommandString, /* The command string itself. */\r
- 1, /* Return the first parameter. */\r
- &xParameterStringLength /* Store the parameter string length. */\r
- );\r
+ pcParameter = FreeRTOS_CLIGetParameter\r
+ (\r
+ pcCommandString, /* The command string itself. */\r
+ 1, /* Return the first parameter. */\r
+ &xParameterStringLength /* Store the parameter string length. */\r
+ );\r
\r
/* Sanity check something was returned. */\r
configASSERT( pcParameter );\r
\r
/* Attempt to open the requested file. */\r
- pxFile = f_open( ( const char * ) pcParameter, "r" );\r
+ pxFile = f_open( pcParameter, "r" );\r
}\r
\r
if( pxFile != NULL )\r
}\r
else\r
{\r
- pcWriteBuffer[ xByte ] = ( int8_t ) iChar;\r
+ pcWriteBuffer[ xByte ] = ( char ) iChar;\r
}\r
}\r
}\r
xReturn = pdFALSE;\r
}\r
\r
- strcat( ( char * ) pcWriteBuffer, cliNEW_LINE );\r
+ strcat( pcWriteBuffer, cliNEW_LINE );\r
\r
return xReturn;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static portBASE_TYPE prvCDCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )\r
+static portBASE_TYPE prvCDCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
-int8_t *pcParameter;\r
+const char *pcParameter;\r
portBASE_TYPE xParameterStringLength;\r
unsigned char ucReturned;\r
size_t xStringLength;\r
\r
/* Obtain the parameter string. */\r
- pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter\r
- (\r
- pcCommandString, /* The command string itself. */\r
- 1, /* Return the first parameter. */\r
- &xParameterStringLength /* Store the parameter string length. */\r
- );\r
+ pcParameter = FreeRTOS_CLIGetParameter\r
+ (\r
+ pcCommandString, /* The command string itself. */\r
+ 1, /* Return the first parameter. */\r
+ &xParameterStringLength /* Store the parameter string length. */\r
+ );\r
\r
/* Sanity check something was returned. */\r
configASSERT( pcParameter );\r
\r
/* Attempt to move to the requested directory. */\r
- ucReturned = f_chdir( ( char * ) pcParameter );\r
+ ucReturned = f_chdir( pcParameter );\r
\r
if( ucReturned == F_NO_ERROR )\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "In: " );\r
- xStringLength = strlen( ( const char * ) pcWriteBuffer );\r
- f_getcwd( ( char * ) &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) );\r
+ sprintf( pcWriteBuffer, "In: " );\r
+ xStringLength = strlen( pcWriteBuffer );\r
+ f_getcwd( &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) );\r
}\r
else\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "Error" );\r
+ sprintf( pcWriteBuffer, "Error" );\r
}\r
\r
- strcat( ( char * ) pcWriteBuffer, cliNEW_LINE );\r
+ strcat( pcWriteBuffer, cliNEW_LINE );\r
\r
return pdFALSE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static portBASE_TYPE prvDIRCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )\r
+static portBASE_TYPE prvDIRCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
static F_FIND *pxFindStruct = NULL;\r
unsigned char ucReturned;\r
}\r
else\r
{\r
- snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." );\r
+ snprintf( pcWriteBuffer, xWriteBufferLen, "Error: f_findfirst() failed." );\r
}\r
}\r
else\r
{\r
- snprintf( ( char * ) pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." );\r
+ snprintf( pcWriteBuffer, xWriteBufferLen, "Failed to allocate RAM (using heap_4.c will prevent fragmentation)." );\r
}\r
}\r
else\r
}\r
}\r
\r
- strcat( ( char * ) pcWriteBuffer, cliNEW_LINE );\r
+ strcat( pcWriteBuffer, cliNEW_LINE );\r
\r
return xReturn;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static portBASE_TYPE prvDELCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )\r
+static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
-int8_t *pcParameter;\r
+const char *pcParameter;\r
portBASE_TYPE xParameterStringLength;\r
unsigned char ucReturned;\r
\r
( void ) xWriteBufferLen;\r
\r
/* Obtain the parameter string. */\r
- pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter\r
- (\r
- pcCommandString, /* The command string itself. */\r
- 1, /* Return the first parameter. */\r
- &xParameterStringLength /* Store the parameter string length. */\r
- );\r
+ pcParameter = FreeRTOS_CLIGetParameter\r
+ (\r
+ pcCommandString, /* The command string itself. */\r
+ 1, /* Return the first parameter. */\r
+ &xParameterStringLength /* Store the parameter string length. */\r
+ );\r
\r
/* Sanity check something was returned. */\r
configASSERT( pcParameter );\r
\r
/* Attempt to delete the file. */\r
- ucReturned = f_delete( ( const char * ) pcParameter );\r
+ ucReturned = f_delete( pcParameter );\r
\r
if( ucReturned == F_NO_ERROR )\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "%s was deleted", pcParameter );\r
+ sprintf( pcWriteBuffer, "%s was deleted", pcParameter );\r
}\r
else\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "Error" );\r
+ sprintf( pcWriteBuffer, "Error" );\r
}\r
\r
- strcat( ( char * ) pcWriteBuffer, cliNEW_LINE );\r
+ strcat( pcWriteBuffer, cliNEW_LINE );\r
\r
return pdFALSE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static portBASE_TYPE prvCOPYCommand( int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )\r
+static portBASE_TYPE prvCOPYCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )\r
{\r
-int8_t *pcSourceFile, *pcDestinationFile;\r
+char *pcSourceFile, *pcDestinationFile;\r
portBASE_TYPE xParameterStringLength;\r
long lSourceLength, lDestinationLength = 0;\r
\r
/* Obtain the name of the destination file. */\r
- pcDestinationFile = ( int8_t * ) FreeRTOS_CLIGetParameter\r
- (\r
- pcCommandString, /* The command string itself. */\r
- 2, /* Return the second parameter. */\r
- &xParameterStringLength /* Store the parameter string length. */\r
- );\r
+ pcDestinationFile = ( char * ) FreeRTOS_CLIGetParameter\r
+ (\r
+ pcCommandString, /* The command string itself. */\r
+ 2, /* Return the second parameter. */\r
+ &xParameterStringLength /* Store the parameter string length. */\r
+ );\r
\r
/* Sanity check something was returned. */\r
configASSERT( pcDestinationFile );\r
\r
/* Obtain the name of the source file. */\r
- pcSourceFile = ( int8_t * ) FreeRTOS_CLIGetParameter\r
- (\r
- pcCommandString, /* The command string itself. */\r
- 1, /* Return the first parameter. */\r
- &xParameterStringLength /* Store the parameter string length. */\r
- );\r
+ pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter\r
+ (\r
+ pcCommandString, /* The command string itself. */\r
+ 1, /* Return the first parameter. */\r
+ &xParameterStringLength /* Store the parameter string length. */\r
+ );\r
\r
/* Sanity check something was returned. */\r
configASSERT( pcSourceFile );\r
pcSourceFile[ xParameterStringLength ] = 0x00;\r
\r
/* See if the source file exists, obtain its length if it does. */\r
- lSourceLength = f_filelength( ( const char * ) pcSourceFile );\r
+ lSourceLength = f_filelength( pcSourceFile );\r
\r
if( lSourceLength == 0 )\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "Source file does not exist" );\r
+ sprintf( pcWriteBuffer, "Source file does not exist" );\r
}\r
else\r
{\r
/* See if the destination file exists. */\r
- lDestinationLength = f_filelength( ( const char * ) pcDestinationFile );\r
+ lDestinationLength = f_filelength( pcDestinationFile );\r
\r
if( lDestinationLength != 0 )\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "Error: Destination file already exists" );\r
+ sprintf( pcWriteBuffer, "Error: Destination file already exists" );\r
}\r
}\r
\r
{\r
if( prvPerformCopy( pcSourceFile, lSourceLength, pcDestinationFile, pcWriteBuffer, xWriteBufferLen ) == pdPASS )\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "Copy made" );\r
+ sprintf( pcWriteBuffer, "Copy made" );\r
}\r
else\r
{\r
- sprintf( ( char * ) pcWriteBuffer, "Error during copy" );\r
+ sprintf( pcWriteBuffer, "Error during copy" );\r
}\r
}\r
\r
- strcat( ( char * ) pcWriteBuffer, cliNEW_LINE );\r
+ strcat( pcWriteBuffer, cliNEW_LINE );\r
\r
return pdFALSE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static portBASE_TYPE prvPerformCopy( int8_t *pcSourceFile,\r
- int32_t lSourceFileLength,\r
- int8_t *pcDestinationFile,\r
- int8_t *pxWriteBuffer,\r
- size_t xWriteBufferLen )\r
+static portBASE_TYPE prvPerformCopy( char *pcSourceFile,\r
+ int32_t lSourceFileLength,\r
+ char *pcDestinationFile,\r
+ char *pxWriteBuffer,\r
+ size_t xWriteBufferLen )\r
{\r
int32_t lBytesRead = 0, lBytesToRead, lBytesRemaining;\r
F_FILE *pxFile;\r
/* Open the source file, seek past the data that has already been\r
read from the file, read the next block of data, then close the\r
file again so the destination file can be opened. */\r
- pxFile = f_open( ( const char * ) pcSourceFile, "r" );\r
+ pxFile = f_open( pcSourceFile, "r" );\r
if( pxFile != NULL )\r
{\r
f_seek( pxFile, lBytesRead, F_SEEK_SET );\r
\r
/* Open the destination file and write the block of data to the end of\r
the file. */\r
- pxFile = f_open( ( const char * ) pcDestinationFile, "a" );\r
+ pxFile = f_open( pcDestinationFile, "a" );\r
if( pxFile != NULL )\r
{\r
f_write( pxWriteBuffer, lBytesToRead, 1, pxFile );\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvCreateFileInfoString( int8_t *pcBuffer, F_FIND *pxFindStruct )\r
+static void prvCreateFileInfoString( char *pcBuffer, F_FIND *pxFindStruct )\r
{\r
const char *pcWritableFile = "writable file", *pcReadOnlyFile = "read only file", *pcDirectory = "directory";\r
const char * pcAttrib;\r
\r
/* Create a string that includes the file name, the file size and the\r
attributes string. */\r
- sprintf( ( char * ) pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, pxFindStruct->filesize );\r
+ sprintf( pcBuffer, "%s [%s] [size=%d]", pxFindStruct->filename, pcAttrib, pxFindStruct->filesize );\r
}\r