From: rtel Date: Mon, 30 Dec 2013 19:32:29 +0000 (+0000) Subject: Update FreeRTOS+ more demos that use FreeRTOS+CLI to remove casting to int8_t * from... X-Git-Tag: V8.0.0rc1~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c834d9e46782961951dad8bd60fd8256e7ea3147;p=freertos Update FreeRTOS+ more demos that use FreeRTOS+CLI to remove casting to int8_t * from strings. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2155 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/File-Related-CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/File-Related-CLI-commands.c index 828d7e26c..0f840a688 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/File-Related-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/File-Related-CLI-commands.c @@ -230,7 +230,7 @@ size_t xColumns = 50U; configASSERT( pcParameter ); /* Attempt to open the requested file. */ - pxFile = f_open( ( const char * ) pcParameter, "r" ); + pxFile = f_open( pcParameter, "r" ); } if( pxFile != NULL ) @@ -392,7 +392,7 @@ unsigned char ucReturned; configASSERT( pcParameter ); /* Attempt to delete the file. */ - ucReturned = f_delete( ( const char * ) pcParameter ); + ucReturned = f_delete( pcParameter ); if( ucReturned == F_NO_ERROR ) { @@ -416,23 +416,23 @@ portBASE_TYPE xParameterStringLength; long lSourceLength, lDestinationLength = 0; /* Obtain the name of the destination file. */ - pcDestinationFile = FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - 2, /* Return the second parameter. */ - &xParameterStringLength /* Store the parameter string length. */ - ); + pcDestinationFile = ( char * ) FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + 2, /* Return the second parameter. */ + &xParameterStringLength /* Store the parameter string length. */ + ); /* Sanity check something was returned. */ configASSERT( pcDestinationFile ); /* Obtain the name of the source file. */ - pcSourceFile = FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - 1, /* Return the first parameter. */ - &xParameterStringLength /* Store the parameter string length. */ - ); + pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + 1, /* Return the first parameter. */ + &xParameterStringLength /* Store the parameter string length. */ + ); /* Sanity check something was returned. */ configASSERT( pcSourceFile ); @@ -441,7 +441,7 @@ long lSourceLength, lDestinationLength = 0; pcSourceFile[ xParameterStringLength ] = 0x00; /* See if the source file exists, obtain its length if it does. */ - lSourceLength = f_filelength( ( const char * ) pcSourceFile ); + lSourceLength = f_filelength( pcSourceFile ); if( lSourceLength == 0 ) { @@ -450,7 +450,7 @@ long lSourceLength, lDestinationLength = 0; else { /* See if the destination file exists. */ - lDestinationLength = f_filelength( ( const char * ) pcDestinationFile ); + lDestinationLength = f_filelength( pcDestinationFile ); if( lDestinationLength != 0 ) { @@ -509,7 +509,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the source file, seek past the data that has already been read from the file, read the next block of data, then close the file again so the destination file can be opened. */ - pxFile = f_open( ( const char * ) pcSourceFile, "r" ); + pxFile = f_open( pcSourceFile, "r" ); if( pxFile != NULL ) { f_seek( pxFile, lBytesRead, F_SEEK_SET ); @@ -524,7 +524,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the destination file and write the block of data to the end of the file. */ - pxFile = f_open( ( const char * ) pcDestinationFile, "a" ); + pxFile = f_open( pcDestinationFile, "a" ); if( pxFile != NULL ) { f_write( pxWriteBuffer, lBytesToRead, 1, pxFile ); diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c index 39939347e..194703018 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/Sample-CLI-commands.c @@ -274,7 +274,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* If this is the last of the three parameters then there are no more @@ -340,7 +340,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ @@ -391,7 +391,7 @@ static portBASE_TYPE lParameterNumber = 0; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); @@ -400,7 +400,7 @@ static portBASE_TYPE lParameterNumber = 0; sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" ); } - else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 ) + else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 ) { /* End the trace, if one is running. */ vTraceStop(); diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c index 311e756df..39feb7973 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c @@ -164,7 +164,7 @@ void vRegisterUDPCLICommands( void ) static portBASE_TYPE prvPingCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) { - const char * pcParameter; + char * pcParameter; portBASE_TYPE lParameterStringLength, xReturn; uint32_t ulIPAddress, ulBytesToPing; const uint32_t ulDefaultBytesToPing = 8UL; @@ -181,12 +181,12 @@ void vRegisterUDPCLICommands( void ) pcWriteBuffer[ 0 ] = 0x00; /* Obtain the number of bytes to ping. */ - pcParameter = FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - 2, /* Return the second parameter. */ - &lParameterStringLength /* Store the parameter string length. */ - ); + pcParameter = ( char * ) FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + 2, /* Return the second parameter. */ + &lParameterStringLength /* Store the parameter string length. */ + ); if( pcParameter == NULL ) { @@ -195,16 +195,16 @@ void vRegisterUDPCLICommands( void ) } else { - ulBytesToPing = atol( ( const char * ) pcParameter ); + ulBytesToPing = atol( pcParameter ); } /* Obtain the IP address string. */ - pcParameter = FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - 1, /* Return the first parameter. */ - &lParameterStringLength /* Store the parameter string length. */ - ); + pcParameter = ( char * ) FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + 1, /* Return the first parameter. */ + &lParameterStringLength /* Store the parameter string length. */ + ); /* Sanity check something was returned. */ configASSERT( pcParameter ); @@ -213,7 +213,7 @@ void vRegisterUDPCLICommands( void ) digit, assume the host name has been passed in. */ if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) ) { - ulIPAddress = FreeRTOS_inet_addr( ( const uint8_t * ) pcParameter ); + ulIPAddress = FreeRTOS_inet_addr( pcParameter ); } else { @@ -221,7 +221,7 @@ void vRegisterUDPCLICommands( void ) pcParameter[ lParameterStringLength ] = 0x00; /* Attempt to resolve host. */ - ulIPAddress = FreeRTOS_gethostbyname( ( uint8_t * ) pcParameter ); + ulIPAddress = FreeRTOS_gethostbyname( pcParameter ); } /* Convert IP address, which may have come from a DNS lookup, to string. */ diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_FAT_SL_Demos/CreateExampleFiles/File-system-demo.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_FAT_SL_Demos/CreateExampleFiles/File-system-demo.c index 3d238ad99..6d4627d63 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_FAT_SL_Demos/CreateExampleFiles/File-system-demo.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_FAT_SL_Demos/CreateExampleFiles/File-system-demo.c @@ -285,7 +285,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); @@ -311,7 +311,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcRoot ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcRoot ) == 0 ); } /*-----------------------------------------------------------*/ @@ -328,7 +328,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c index 8446604cb..6119a1a91 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c @@ -333,7 +333,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* If this is the last of the three parameters then there are no more @@ -399,7 +399,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ @@ -459,7 +459,7 @@ static portBASE_TYPE lParameterNumber = 0; } else { - ulBytesToPing = atol( ( const char * ) pcParameter ); + ulBytesToPing = atol( pcParameter ); } /* Obtain the IP address string. */ @@ -477,7 +477,7 @@ static portBASE_TYPE lParameterNumber = 0; digit, assume the host name has been passed in. */ if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) ) { - ulIPAddress = FreeRTOS_inet_addr( ( const uint8_t * ) pcParameter ); + ulIPAddress = FreeRTOS_inet_addr( pcParameter ); } else { @@ -485,7 +485,7 @@ static portBASE_TYPE lParameterNumber = 0; pcParameter[ lParameterStringLength ] = 0x00; /* Attempt to resolve host. */ - ulIPAddress = FreeRTOS_gethostbyname( ( uint8_t * ) pcParameter ); + ulIPAddress = FreeRTOS_gethostbyname( pcParameter ); } /* Convert IP address, which may have come from a DNS lookup, to string. */ @@ -639,7 +639,7 @@ uint32_t ulAddress; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/UDPCommandServer.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/UDPCommandServer.c index 819d13bfb..3677908a3 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/UDPCommandServer.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/UDPCommandServer.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -108,7 +108,7 @@ void vStartUDPCommandInterpreterTask( uint16_t usStackSize, uint32_t ulPort, uns } /*-----------------------------------------------------------*/ -/* +/* * Task that provides the input and output for the FreeRTOS+CLI command * interpreter. In this case a UDP port is used. See the URL in the comments * within main.c for the location of the online documentation. @@ -117,7 +117,7 @@ void vUDPCommandInterpreterTask( void *pvParameters ) { long lBytes, lByte; signed char cInChar, cInputIndex = 0; -static signed char cInputString[ cmdMAX_INPUT_SIZE ], cOutputString[ cmdMAX_OUTPUT_SIZE ], cLocalBuffer[ cmdSOCKET_INPUT_BUFFER_SIZE ]; +static char cInputString[ cmdMAX_INPUT_SIZE ], cOutputString[ cmdMAX_OUTPUT_SIZE ], cLocalBuffer[ cmdSOCKET_INPUT_BUFFER_SIZE ]; portBASE_TYPE xMoreDataToFollow; struct freertos_sockaddr xClient; socklen_t xClientAddressLength = 0; /* This is required as a parameter to maintain the sendto() Berkeley sockets API - but it is not actually used so can take any value. */ @@ -152,25 +152,25 @@ xSocket_t xSocket; string. */ if( cInChar == '\n' ) { - /* Process the input string received prior to the + /* Process the input string received prior to the newline. */ do { /* Pass the string to FreeRTOS+CLI. */ xMoreDataToFollow = FreeRTOS_CLIProcessCommand( cInputString, cOutputString, cmdMAX_OUTPUT_SIZE ); - + /* Send the output generated by the command's implementation. */ - FreeRTOS_sendto( xSocket, cOutputString, strlen( ( const char * ) cOutputString ), 0, &xClient, xClientAddressLength ); + FreeRTOS_sendto( xSocket, cOutputString, strlen( cOutputString ), 0, &xClient, xClientAddressLength ); } while( xMoreDataToFollow != pdFALSE ); /* Until the command does not generate any more output. */ - /* All the strings generated by the command processing - have been sent. Clear the input string ready to receive + /* All the strings generated by the command processing + have been sent. Clear the input string ready to receive the next command. */ cInputIndex = 0; memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); - + /* Transmit a spacer, just to make the command console easier to read. */ FreeRTOS_sendto( xSocket, "\r\n", strlen( "\r\n" ), 0, &xClient, xClientAddressLength ); @@ -179,12 +179,12 @@ xSocket_t xSocket; { if( cInChar == '\r' ) { - /* Ignore the character. Newlines are used to + /* Ignore the character. Newlines are used to detect the end of the input string. */ } else if( cInChar == '\b' ) { - /* Backspace was pressed. Erase the last character + /* Backspace was pressed. Erase the last character in the string - if any. */ if( cInputIndex > 0 ) { @@ -206,7 +206,7 @@ xSocket_t xSocket; } } } - } + } } else { @@ -232,7 +232,7 @@ xSocket_t xSocket = FREERTOS_INVALID_SOCKET; /* Bind the address to the socket. */ if( FreeRTOS_bind( xSocket, &xServer, sizeof( xServer ) ) == -1 ) - { + { FreeRTOS_closesocket( xSocket ); xSocket = FREERTOS_INVALID_SOCKET; } diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c index b772bb868..cd88b535a 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c @@ -156,7 +156,7 @@ static void prvEchoClientTask( void *pvParameters ) { xSocket_t xSocket; struct freertos_sockaddr xEchoServerAddress; -int8_t cTxString[ 25 ], cRxString[ 25 ]; /* Make sure the stack is large enough to hold these. Turn on stack overflow checking during debug to be sure. */ +char cTxString[ 25 ], cRxString[ 25 ]; /* Make sure the stack is large enough to hold these. Turn on stack overflow checking during debug to be sure. */ int32_t lLoopCount = 0UL; const int32_t lMaxLoopCount = 50; volatile uint32_t ulRxCount = 0UL, ulTxCount = 0UL; @@ -188,7 +188,7 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress ); for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ ) { /* Create the string that is sent to the echo server. */ - sprintf( ( char * ) cTxString, "Message number %u\r\n", ( unsigned int ) ulTxCount ); + sprintf( cTxString, "Message number %u\r\n", ( unsigned int ) ulTxCount ); /* Send the string to the socket. ulFlags is set to 0, so the zero copy interface is not used. That means the data from cTxString is @@ -197,7 +197,7 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress ); to ensure the NULL string terminator is sent as part of the message. */ FreeRTOS_sendto( xSocket, /* The socket being sent to. */ ( void * ) cTxString, /* The data being sent. */ - strlen( ( const char * ) cTxString ) + 1, /* The length of the data being sent. */ + strlen( cTxString ) + 1,/* The length of the data being sent. */ 0, /* ulFlags with the FREERTOS_ZERO_COPY bit clear. */ &xEchoServerAddress, /* The destination address. */ sizeof( xEchoServerAddress ) ); @@ -223,7 +223,7 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress ); &xAddressLength ); /* Compare the transmitted string to the received string. */ - if( strcmp( ( char * ) cRxString, ( char * ) cTxString ) == 0 ) + if( strcmp( cRxString, cTxString ) == 0 ) { /* The echo reply was received without error. */ ulRxCount++; @@ -244,7 +244,7 @@ static void prvZeroCopyEchoClientTask( void *pvParameters ) { xSocket_t xSocket; struct freertos_sockaddr xEchoServerAddress; -static int8_t cTxString[ 40 ]; +static char cTxString[ 40 ]; int32_t lLoopCount = 0UL; volatile uint32_t ulRxCount = 0UL, ulTxCount = 0UL; uint32_t xAddressLength = sizeof( xEchoServerAddress ); @@ -252,9 +252,9 @@ int32_t lReturned; uint8_t *pucUDPPayloadBuffer; const int32_t lMaxLoopCount = 50; -const uint8_t * const pucStringToSend = ( const uint8_t * const ) "Zero copy message number"; +const char * const pcStringToSend = "Zero copy message number"; /* The buffer is large enough to hold the string, a number, and the string terminator. */ -const size_t xBufferLength = strlen( ( char * ) pucStringToSend ) + 15; +const size_t xBufferLength = strlen( pcStringToSend ) + 15; #if ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1 { @@ -309,11 +309,11 @@ const size_t xBufferLength = strlen( ( char * ) pucStringToSend ) + 15; /* A buffer was successfully obtained. Create the string that is sent to the echo server. Note the string is written directly into the buffer obtained from the IP stack. */ - sprintf( ( char * ) pucUDPPayloadBuffer, "%s %u\r\n", ( const char * ) "Zero copy message number", ( unsigned int ) ulTxCount ); + sprintf( ( char * ) pucUDPPayloadBuffer, "%s %u\r\n", "Zero copy message number", ( unsigned int ) ulTxCount ); /* Also copy the string into a local buffer so it can be compared with the string that is later received back from the echo server. */ - strcpy( ( char * ) cTxString, ( char * ) pucUDPPayloadBuffer ); + strcpy( cTxString, ( char * ) pucUDPPayloadBuffer ); /* Pass the buffer into the send function. ulFlags has the FREERTOS_ZERO_COPY bit set so the IP stack will take control of @@ -321,7 +321,7 @@ const size_t xBufferLength = strlen( ( char * ) pucStringToSend ) + 15; echoMARK_SEND_IN_TRACE_BUFFER( xZeroCopySendEvent ); lReturned = FreeRTOS_sendto( xSocket, /* The socket being sent to. */ ( void * ) pucUDPPayloadBuffer, /* The buffer being passed into the IP stack. */ - strlen( ( const char * ) cTxString ) + 1, /* The length of the data being sent. Plus 1 to ensure the null terminator is part of the data. */ + strlen( cTxString ) + 1, /* The length of the data being sent. Plus 1 to ensure the null terminator is part of the data. */ FREERTOS_ZERO_COPY, /* ulFlags with the zero copy bit is set. */ &xEchoServerAddress, /* Where the data is being sent. */ sizeof( xEchoServerAddress ) ); @@ -372,7 +372,7 @@ const size_t xBufferLength = strlen( ( char * ) pucStringToSend ) + 15; { /* Compare the string sent to the echo server with the string received back from the echo server. */ - if( strcmp( ( char * ) pucUDPPayloadBuffer, ( char * ) cTxString ) == 0 ) + if( strcmp( ( char * ) pucUDPPayloadBuffer, cTxString ) == 0 ) { /* The strings matched. */ ulRxCount++; diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/CLI-commands.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/CLI-commands.c index ab5fd80ad..4aac2f674 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/CLI-commands.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/CLI-commands.c @@ -257,7 +257,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, lParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, lParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* If this is the last of the three parameters then there are no more @@ -323,7 +323,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, lParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, lParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ @@ -372,7 +372,7 @@ portBASE_TYPE lParameterStringLength; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); @@ -381,7 +381,7 @@ portBASE_TYPE lParameterStringLength; sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" ); } - else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 ) + else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 ) { /* End the trace, if one is running. */ vTraceStop(); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CyaSSL_Windows_Simulator/SecureTCPClientTask.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CyaSSL_Windows_Simulator/SecureTCPClientTask.c index 309877ef2..3c87c1bb5 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CyaSSL_Windows_Simulator/SecureTCPClientTask.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CyaSSL_Windows_Simulator/SecureTCPClientTask.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -94,7 +94,7 @@ struct sockaddr_in xConnection; CYASSL* xCyaSSL_Object; WORD wVersionRequested; WSADATA xWSAData; -uint8_t cString[ 50 ]; +char cString[ 50 ]; portBASE_TYPE lReturned; uint32_t ulCount = 0UL; @@ -128,13 +128,13 @@ uint32_t ulCount = 0UL; /* Connect to the secure server. */ if( connect( xClientSocket, ( SOCKADDR * ) &xConnection, sizeof( xConnection ) ) == 0 ) { - /* The connect was successful. Create a CyaSSL object to associate + /* The connect was successful. Create a CyaSSL object to associate with this connection. */ xCyaSSL_Object = CyaSSL_new( xCyaSSL_ClientContext ); - + if( xCyaSSL_Object != NULL ) { - /* Associate the created CyaSSL object with the connected + /* Associate the created CyaSSL object with the connected socket. */ lReturned = CyaSSL_set_fd( xCyaSSL_Object, xClientSocket ); configASSERT( lReturned == SSL_SUCCESS ); @@ -146,14 +146,14 @@ uint32_t ulCount = 0UL; do { /* Create the string that is sent to the secure server. */ - sprintf( ( char * ) cString, "Message number %lu\r\n", ulCount ); + sprintf( cString, "Message number %lu\r\n", ulCount ); - /* The next line is the secure equivalent of the standard + /* The next line is the secure equivalent of the standard sockets call: lReturned = send( xClientSocket, cString, strlen( cString ) + 1, 0 ); */ - lReturned = CyaSSL_write( xCyaSSL_Object, ( const char * ) cString, strlen( ( const char * ) cString ) + 1 ); - - + lReturned = CyaSSL_write( xCyaSSL_Object, cString, strlen( cString ) + 1 ); + + /* Short delay to prevent the messages streaming up the console too quickly. */ vTaskDelay( 50 ); @@ -161,7 +161,7 @@ uint32_t ulCount = 0UL; } while( ( lReturned != SOCKET_ERROR ) && ( ulCount < 10UL ) ); } - + CyaSSL_free( xCyaSSL_Object ); closesocket( xClientSocket ); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-Releated-CLI-commands.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-Releated-CLI-commands.c index 45d8c074a..7a6445ab3 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-Releated-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-Releated-CLI-commands.c @@ -244,7 +244,7 @@ size_t xColumns = 50U; configASSERT( pcParameter ); /* Attempt to open the requested file. */ - pxFile = f_open( ( const char * ) pcParameter, "r" ); + pxFile = f_open( pcParameter, "r" ); } if( pxFile != NULL ) @@ -305,7 +305,7 @@ size_t xStringLength; if( ucReturned == F_NO_ERROR ) { sprintf( pcWriteBuffer, "In: " ); - xStringLength = strlen( ( const char * ) pcWriteBuffer ); + xStringLength = strlen( pcWriteBuffer ); f_getcwd( &( pcWriteBuffer[ xStringLength ] ), ( unsigned char ) ( xWriteBufferLen - xStringLength ) ); } else @@ -406,7 +406,7 @@ unsigned char ucReturned; configASSERT( pcParameter ); /* Attempt to delete the file. */ - ucReturned = f_delete( ( const char * ) pcParameter ); + ucReturned = f_delete( pcParameter ); if( ucReturned == F_NO_ERROR ) { @@ -483,7 +483,7 @@ long lSourceLength, lDestinationLength = 0; pcSourceFile[ xParameterStringLength ] = 0x00; /* See if the source file exists, obtain its length if it does. */ - lSourceLength = f_filelength( ( const char * ) pcSourceFile ); + lSourceLength = f_filelength( pcSourceFile ); if( lSourceLength == 0 ) { @@ -492,7 +492,7 @@ long lSourceLength, lDestinationLength = 0; else { /* See if the destination file exists. */ - lDestinationLength = f_filelength( ( const char * ) pcDestinationFile ); + lDestinationLength = f_filelength( pcDestinationFile ); if( lDestinationLength != 0 ) { @@ -551,7 +551,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the source file, seek past the data that has already been read from the file, read the next block of data, then close the file again so the destination file can be opened. */ - pxFile = f_open( ( const char * ) pcSourceFile, "r" ); + pxFile = f_open( pcSourceFile, "r" ); if( pxFile != NULL ) { f_seek( pxFile, lBytesRead, F_SEEK_SET ); @@ -566,7 +566,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the destination file and write the block of data to the end of the file. */ - pxFile = f_open( ( const char * ) pcDestinationFile, "a" ); + pxFile = f_open( pcDestinationFile, "a" ); if( pxFile != NULL ) { f_write( pxWriteBuffer, lBytesToRead, 1, pxFile ); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-system-demo.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-system-demo.c index d836c76eb..c6de21142 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-system-demo.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/File-system-demo.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -289,7 +289,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "In directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); @@ -318,7 +318,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "Back in root directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcRoot ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcRoot ) == 0 ); } /*-----------------------------------------------------------*/ @@ -336,7 +336,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "Back in directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/Sample-CLI-commands.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/Sample-CLI-commands.c index ece8e2770..be5653d74 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/Sample-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/Sample-CLI-commands.c @@ -272,7 +272,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* If this is the last of the three parameters then there are no more @@ -338,7 +338,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ @@ -389,7 +389,7 @@ static portBASE_TYPE lParameterNumber = 0; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/CLI-commands.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/CLI-commands.c index 633c120fb..6119a1a91 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/CLI-commands.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/CLI-commands.c @@ -333,7 +333,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* If this is the last of the three parameters then there are no more @@ -399,7 +399,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ @@ -477,7 +477,7 @@ static portBASE_TYPE lParameterNumber = 0; digit, assume the host name has been passed in. */ if( ( *pcParameter >= '0' ) && ( *pcParameter <= '9' ) ) { - ulIPAddress = FreeRTOS_inet_addr( ( const uint8_t * ) pcParameter ); + ulIPAddress = FreeRTOS_inet_addr( pcParameter ); } else { @@ -485,7 +485,7 @@ static portBASE_TYPE lParameterNumber = 0; pcParameter[ lParameterStringLength ] = 0x00; /* Attempt to resolve host. */ - ulIPAddress = FreeRTOS_gethostbyname( ( uint8_t * ) pcParameter ); + ulIPAddress = FreeRTOS_gethostbyname( pcParameter ); } /* Convert IP address, which may have come from a DNS lookup, to string. */ @@ -639,7 +639,7 @@ uint32_t ulAddress; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/Examples/USB_CDC/CDCCommandConsole.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/Examples/USB_CDC/CDCCommandConsole.c index 99d3772b4..b406e10c0 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/Examples/USB_CDC/CDCCommandConsole.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/Examples/USB_CDC/CDCCommandConsole.c @@ -91,7 +91,7 @@ static void prvCDCCommandConsoleTask( void *pvParameters ); * Obtain a character from the CDC input. The calling task will be held in the * Blocked state (so other tasks can execute) until a character is avilable. */ -int8_t cGetCDCChar( void ); +char cGetCDCChar( void ); /* * Initialise the third party virtual comport files driver @@ -109,9 +109,9 @@ task. */ static xSemaphoreHandle xCDCMutex = NULL; /* Const messages output by the command console. */ -static const uint8_t * const pcWelcomeMessage = ( uint8_t * ) "FreeRTOS 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 uint8_t * const pcNewLine = ( uint8_t * ) "\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 char * const pcEndOfOutputMessage = "\r\n[Press ENTER to execute the previous command again]\r\n>"; +static const char * const pcNewLine = "\r\n"; /*-----------------------------------------------------------*/ @@ -140,8 +140,10 @@ void vCDCCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPri static void prvCDCCommandConsoleTask( void *pvParameters ) { -int8_t cRxedChar, cInputIndex = 0, *pcOutputString; -static int8_t cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ]; +char cRxedChar; +uint8_t ucInputIndex = 0; +char *pcOutputString; +static char cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ]; portBASE_TYPE xReturned; ( void ) pvParameters; @@ -156,7 +158,7 @@ portBASE_TYPE xReturned; /* Send the welcome message. This probably won't be seen as the console will not have been connected yet. */ - USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcWelcomeMessage, strlen( ( const char * ) pcWelcomeMessage ) ); + USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcWelcomeMessage, strlen( pcWelcomeMessage ) ); for( ;; ) { @@ -175,14 +177,14 @@ portBASE_TYPE xReturned; if( cRxedChar == '\n' || cRxedChar == '\r' ) { /* Just to space the output from the input. */ - USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcNewLine, strlen( ( const char * ) pcNewLine ) ); + USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcNewLine, strlen( pcNewLine ) ); /* See if the command is empty, indicating that the last command is to be executed again. */ - if( cInputIndex == 0 ) + if( ucInputIndex == 0 ) { /* Copy the last command back into the input string. */ - strcpy( ( char * ) cInputString, ( char * ) cLastInputString ); + strcpy( cInputString, cLastInputString ); } /* Pass the received command to the command interpreter. The @@ -195,7 +197,7 @@ portBASE_TYPE xReturned; xReturned = FreeRTOS_CLIProcessCommand( cInputString, pcOutputString, configCOMMAND_INT_MAX_OUTPUT_SIZE ); /* Write the generated string to the CDC. */ - USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcOutputString, strlen( ( const char * ) pcOutputString ) ); + USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcOutputString, strlen( pcOutputString ) ); vTaskDelay( 1 ); } while( xReturned != pdFALSE ); @@ -204,11 +206,11 @@ portBASE_TYPE xReturned; Clear the input string ready to receive the next command. Remember the command that was just processed first in case it is to be processed again. */ - strcpy( ( char * ) cLastInputString, ( char * ) cInputString ); - cInputIndex = 0; + strcpy( cLastInputString, cInputString ); + ucInputIndex = 0; memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); - USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcEndOfOutputMessage, strlen( ( const char * ) pcEndOfOutputMessage ) ); + USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcEndOfOutputMessage, strlen( pcEndOfOutputMessage ) ); } else { @@ -220,10 +222,10 @@ portBASE_TYPE xReturned; { /* Backspace was pressed. Erase the last character in the string - if any. */ - if( cInputIndex > 0 ) + if( ucInputIndex > 0 ) { - cInputIndex--; - cInputString[ cInputIndex ] = '\0'; + ucInputIndex--; + cInputString[ ucInputIndex ] = '\0'; } } else @@ -233,10 +235,10 @@ portBASE_TYPE xReturned; string will be passed to the command interpreter. */ if( ( cRxedChar >= ' ' ) && ( cRxedChar <= '~' ) ) { - if( cInputIndex < cmdMAX_INPUT_SIZE ) + if( ucInputIndex < cmdMAX_INPUT_SIZE ) { - cInputString[ cInputIndex ] = cRxedChar; - cInputIndex++; + cInputString[ ucInputIndex ] = cRxedChar; + ucInputIndex++; } } } @@ -249,20 +251,20 @@ portBASE_TYPE xReturned; } /*-----------------------------------------------------------*/ -void vOutputString( const uint8_t * const pucMessage ) +void vOutputString( const char * const pcMessage ) { if( xSemaphoreTake( xCDCMutex, cmdMAX_MUTEX_WAIT ) == pdPASS ) { - USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pucMessage, strlen( ( const char * ) pucMessage ) ); + USB_WriteEP( CDC_DEP_IN, ( uint8_t * ) pcMessage, strlen( pcMessage ) ); xSemaphoreGive( xCDCMutex ); } } /*-----------------------------------------------------------*/ -int8_t cGetCDCChar( void ) +char cGetCDCChar( void ) { int32_t lAvailableBytes, xBytes = 0; -int8_t cInputChar; +char cInputChar; do { @@ -274,7 +276,7 @@ int8_t cInputChar; { /* Attempt to read one character. */ xBytes = 1; - xBytes = CDC_RdOutBuf( ( char * ) &cInputChar, &xBytes ); + xBytes = CDC_RdOutBuf( &cInputChar, &xBytes ); xSemaphoreGive( xCDCMutex ); } diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/main.c index 46cc25394..61a20d490 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/main.c @@ -232,24 +232,24 @@ static portBASE_TYPE xTaskAlreadyCreated = pdFALSE; /* Called by FreeRTOS+UDP when a reply is received to an outgoing ping request. */ void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier ) { -static const uint8_t *pucSuccess = ( uint8_t * ) "\r\n\r\nPing reply received - "; -static const uint8_t *pucInvalidChecksum = ( uint8_t * ) "\r\n\r\nPing reply received with invalid checksum - "; -static const uint8_t *pucInvalidData = ( uint8_t * ) "\r\n\r\nPing reply received with invalid data - "; -static uint8_t ucMessage[ 50 ]; -void vOutputString( const uint8_t * const pucMessage ); +static const char *pcSuccess = "\r\n\r\nPing reply received - "; +static const char *pcInvalidChecksum = "\r\n\r\nPing reply received with invalid checksum - "; +static const char *pcInvalidData = "\r\n\r\nPing reply received with invalid data - "; +static char cMessage[ 50 ]; +void vOutputString( const char * const pcMessage ); switch( eStatus ) { case eSuccess : - vOutputString( pucSuccess ); + vOutputString( pcSuccess ); break; case eInvalidChecksum : - vOutputString( pucInvalidChecksum ); + vOutputString( pcInvalidChecksum ); break; case eInvalidData : - vOutputString( pucInvalidData ); + vOutputString( pcInvalidData ); break; default : @@ -258,7 +258,7 @@ void vOutputString( const uint8_t * const pucMessage ); break; } - sprintf( ( char * ) ucMessage, "identifier %d\r\n\r\n", ( int ) usIdentifier ); - vOutputString( ucMessage ); + sprintf( cMessage, "identifier %d\r\n\r\n", ( int ) usIdentifier ); + vOutputString( cMessage ); } diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c index 18564bc1a..7df209455 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -63,7 +63,7 @@ 1 tab == 4 spaces! */ -/* +/* * Creates two transmitting tasks and two receiving tasks. The transmitting * tasks send values that are received by the receiving tasks. One set of tasks * uses the standard API. The other set of tasks uses the zero copy API. @@ -126,7 +126,7 @@ static void prvSimpleClientTask( void *pvParameters ) { xSocket_t xClientSocket; struct freertos_sockaddr xDestinationAddress; -uint8_t cString[ 50 ]; +char cString[ 50 ]; portBASE_TYPE lReturned; uint32_t ulCount = 0UL, ulIPAddress; const uint32_t ulLoopsPerSocket = 10UL; @@ -162,13 +162,13 @@ const portTickType x150ms = 150UL / portTICK_RATE_MS; do { /* Create the string that is sent to the server. */ - sprintf( ( char * ) cString, "Server received (not zero copy): Message number %lu\r\n", ulCount ); + sprintf( cString, "Server received (not zero copy): Message number %lu\r\n", ulCount ); /* Send the string to the socket. ulFlags is set to 0, so the zero copy option is not selected. That means the data from cString[] is copied into a network buffer inside FreeRTOS_sendto(), and cString[] can be reused as soon as FreeRTOS_sendto() has returned. */ - lReturned = FreeRTOS_sendto( xClientSocket, ( void * ) cString, strlen( ( const char * ) cString ), 0, &xDestinationAddress, sizeof( xDestinationAddress ) ); + lReturned = FreeRTOS_sendto( xClientSocket, ( void * ) cString, strlen( cString ), 0, &xDestinationAddress, sizeof( xDestinationAddress ) ); ulCount++; @@ -187,7 +187,7 @@ const portTickType x150ms = 150UL / portTICK_RATE_MS; static void prvSimpleServerTask( void *pvParameters ) { long lBytes; -uint8_t cReceivedString[ 60 ]; +char cReceivedString[ 60 ]; struct freertos_sockaddr xClient, xBindAddress; uint32_t xClientLength = sizeof( xClient ); xSocket_t xListeningSocket; @@ -226,11 +226,11 @@ xSocket_t xListeningSocket; /* Print the received characters. */ if( lBytes > 0 ) { - vOutputString( ( char * ) cReceivedString ); + vOutputString( cReceivedString ); } /* Error check. */ - configASSERT( lBytes == ( portBASE_TYPE ) strlen( ( const char * ) cReceivedString ) ); + configASSERT( lBytes == ( portBASE_TYPE ) strlen( cReceivedString ) ); } } /*-----------------------------------------------------------*/ @@ -243,10 +243,10 @@ struct freertos_sockaddr xDestinationAddress; portBASE_TYPE lReturned; uint32_t ulCount = 0UL, ulIPAddress; const uint32_t ulLoopsPerSocket = 10UL; -const uint8_t *pucStringToSend = ( const uint8_t * ) "Server received (using zero copy): Message number "; +const char *pcStringToSend = "Server received (using zero copy): Message number "; const portTickType x150ms = 150UL / portTICK_RATE_MS; /* 15 is added to ensure the number, \r\n and terminating zero fit. */ -const size_t xStringLength = strlen( ( char * ) pucStringToSend ) + 15; +const size_t xStringLength = strlen( pcStringToSend ) + 15; /* Remove compiler warning about unused parameters. */ ( void ) pvParameters; @@ -296,7 +296,7 @@ const size_t xStringLength = strlen( ( char * ) pucStringToSend ) + 15; end. Note that the string is being written directly into the buffer obtained from the IP stack above. */ memset( ( void * ) pucUDPPayloadBuffer, 0x00, xStringLength ); - sprintf( ( char * ) pucUDPPayloadBuffer, "%s%lu\r\n", ( char * ) pucStringToSend, ulCount ); + sprintf( ( char * ) pucUDPPayloadBuffer, "%s%lu\r\n", pcStringToSend, ulCount ); /* Pass the buffer into the send function. ulFlags has the FREERTOS_ZERO_COPY bit set so the IP stack will take control of the diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/UDPCommandServer.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/UDPCommandServer.c index 4b7198585..d36543e35 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/UDPCommandServer.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/UDPCommandServer.c @@ -163,7 +163,7 @@ extern const uint8_t ucMACAddress[ 6 ]; /* Send the output generated by the command's implementation. */ - FreeRTOS_sendto( xSocket, cOutputString, strlen( ( const char * ) cOutputString ), 0, &xClient, xClientAddressLength ); + FreeRTOS_sendto( xSocket, cOutputString, strlen( cOutputString ), 0, &xClient, xClientAddressLength ); } while( xMoreDataToFollow != pdFALSE ); /* Until the command does not generate any more output. */ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DNS.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DNS.c index 57366eea1..5eb6e2a49 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DNS.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DNS.c @@ -5,11 +5,11 @@ * This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license * terms are different to the FreeRTOS license terms. * - * FreeRTOS+UDP uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. + * FreeRTOS+UDP uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. * Details of both license options follow: * * - Open source licensing - @@ -21,9 +21,9 @@ * * - Commercial licensing - * Businesses and individuals that for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+UDP into proprietary software for distribution in any - * form. Commercial licenses can be purchased from http://shop.freertos.org/udp + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+UDP into proprietary software for distribution in any + * form. Commercial licenses can be purchased from http://shop.freertos.org/udp * and do not require any source files to be changed. * * FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot @@ -99,7 +99,7 @@ static xSocket_t prvCreateDNSSocket( void ); /* * Create the DNS message in the zero copy buffer passed in the first parameter. */ -static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const uint8_t *pcHostName, uint16_t usIdentifier ); +static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const char *pcHostName, uint16_t usIdentifier ); /* * Simple routine that jumps over the NAME field of a resource record. @@ -128,7 +128,7 @@ typedef struct xDNSMessage xDNSMessage_t; /*-----------------------------------------------------------*/ -uint32_t FreeRTOS_gethostbyname( const uint8_t *pcHostName ) +uint32_t FreeRTOS_gethostbyname( const char *pcHostName ) { static uint16_t usIdentifier = 0; struct freertos_sockaddr xAddress; @@ -139,7 +139,7 @@ static uint32_t ulAddressLength; portBASE_TYPE xAttempt; int32_t lBytes; size_t xPayloadLength; -const size_t xExpectedPayloadLength = sizeof( xDNSMessage_t ) + strlen( ( const char * const ) pcHostName ) + sizeof( uint16_t ) + sizeof( uint16_t ) + 2; /* Two for the count of characters in the first subdomain part, and the string end byte */ +const size_t xExpectedPayloadLength = sizeof( xDNSMessage_t ) + strlen( pcHostName ) + sizeof( uint16_t ) + sizeof( uint16_t ) + 2; /* Two for the count of characters in the first subdomain part, and the string end byte */ if( xDNSSocket == NULL ) { @@ -207,7 +207,7 @@ const size_t xExpectedPayloadLength = sizeof( xDNSMessage_t ) + strlen( ( const } /*-----------------------------------------------------------*/ -static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const uint8_t *pcHostName, uint16_t usIdentifier ) +static size_t prvCreateDNSMessage( uint8_t *pucUDPPayloadBuffer, const char *pcHostName, uint16_t usIdentifier ) { xDNSMessage_t *pxDNSMessageHeader; uint8_t *pucStart, *pucByte; @@ -237,10 +237,10 @@ static const xDNSMessage_t xDefaultPartDNSHeader = pucByte = pucStart + 1; /* Copy in the host name. */ - strcpy( ( char * ) pucByte, ( const char * ) pcHostName ); + strcpy( ( char * ) pucByte, pcHostName ); /* Mark the end of the string. */ - pucByte += strlen( ( const char * ) pcHostName ); + pucByte += strlen( pcHostName ); *pucByte = 0x00; /* Walk the string to replace the '.' characters with byte counts. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c index a4e74f272..488018ad8 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c @@ -5,11 +5,11 @@ * This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license * terms are different to the FreeRTOS license terms. * - * FreeRTOS+UDP uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. + * FreeRTOS+UDP uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. * Details of both license options follow: * * - Open source licensing - @@ -21,9 +21,9 @@ * * - Commercial licensing - * Businesses and individuals that for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+UDP into proprietary software for distribution in any - * form. Commercial licenses can be purchased from http://shop.freertos.org/udp + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+UDP into proprietary software for distribution in any + * form. Commercial licenses can be purchased from http://shop.freertos.org/udp * and do not require any source files to be changed. * * FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot @@ -230,7 +230,7 @@ xFreeRTOS_Socket_t *pxSocket; #if ipconfigSUPPORT_SELECT_FUNCTION == 1 - portBASE_TYPE FreeRTOS_FD_CLR( xSocket_t xSocket, xSocketSet_t xSocketSet ) + portBASE_TYPE FreeRTOS_FD_CLR( xSocket_t xSocket, xSocketSet_t xSocketSet ) { xFreeRTOS_Socket_t *pxSocket = ( xFreeRTOS_Socket_t * ) xSocket; portBASE_TYPE xReturn; @@ -881,29 +881,29 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; /* Is the socket a member of a select() group? */ if( pxSocket->xSelectQueue != NULL ) { - /* Can the select group be notified that the socket is + /* Can the select group be notified that the socket is ready to be read? */ if( xQueueSendFromISR( pxSocket->xSelectQueue, &pxSocket, &xHigherPriorityTaskWoken ) != pdPASS ) { /* Could not notify the select group. */ xReturn = pdFAIL; iptraceFAILED_TO_NOTIFY_SELECT_GROUP( pxSocket ); - } + } } } - #endif + #endif if( xReturn == pdPASS ) { taskENTER_CRITICAL(); { - /* Add the network packet to the list of packets to be + /* Add the network packet to the list of packets to be processed by the socket. */ vListInsertEnd( &( pxSocket->xWaitingPacketsList ), &( pxNetworkBuffer->xBufferListItem ) ); } taskEXIT_CRITICAL(); - /* The socket's counting semaphore records how many packets are + /* The socket's counting semaphore records how many packets are waiting to be processed by the socket. */ xSemaphoreGiveFromISR( pxSocket->xWaitingPacketSemaphore, &xHigherPriorityTaskWoken ); } @@ -972,34 +972,34 @@ xListItem *pxIterator, *pxReturn; #if ipconfigINCLUDE_FULL_INET_ADDR == 1 - uint32_t FreeRTOS_inet_addr( const uint8_t * pucIPAddress ) + uint32_t FreeRTOS_inet_addr( const char *pcIPAddress ) { const uint8_t ucDecimalBase = 10; uint8_t ucOctet[ socketMAX_IP_ADDRESS_OCTETS ]; - const uint8_t *pucPointerOnEntering; + const char *pcPointerOnEntering; uint32_t ulReturn = 0UL, ulOctetNumber, ulValue; portBASE_TYPE xResult = pdPASS; for( ulOctetNumber = 0; ulOctetNumber < socketMAX_IP_ADDRESS_OCTETS; ulOctetNumber++ ) { ulValue = 0; - pucPointerOnEntering = pucIPAddress; + pcPointerOnEntering = pcIPAddress; - while( ( *pucIPAddress >= ( uint8_t ) '0' ) && ( *pucIPAddress <= ( uint8_t ) '9' ) ) + while( ( *pcIPAddress >= ( uint8_t ) '0' ) && ( *pcIPAddress <= ( uint8_t ) '9' ) ) { /* Move previous read characters into the next decimal position. */ ulValue *= ucDecimalBase; /* Add the binary value of the ascii character. */ - ulValue += ( *pucIPAddress - ( uint8_t ) '0' ); + ulValue += ( *pcIPAddress - ( uint8_t ) '0' ); /* Move to next character in the string. */ - pucIPAddress++; + pcIPAddress++; } /* Check characters were read. */ - if( pucIPAddress == pucPointerOnEntering ) + if( pcIPAddress == pcPointerOnEntering ) { xResult = pdFAIL; } @@ -1016,14 +1016,14 @@ xListItem *pxIterator, *pxReturn; /* Check the next character is as expected. */ if( ulOctetNumber < ( socketMAX_IP_ADDRESS_OCTETS - 1 ) ) { - if( *pucIPAddress != ( uint8_t ) '.' ) + if( *pcIPAddress != ( uint8_t ) '.' ) { xResult = pdFAIL; } else { /* Move past the dot. */ - pucIPAddress++; + pcIPAddress++; } } } @@ -1035,7 +1035,7 @@ xListItem *pxIterator, *pxReturn; } } - if( *pucIPAddress != ( uint8_t ) 0x00 ) + if( *pcIPAddress != ( uint8_t ) 0x00 ) { /* Expected the end of the string. */ xResult = pdFAIL; diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_DNS.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_DNS.h index 015afce89..0255456bb 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_DNS.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_DNS.h @@ -5,11 +5,11 @@ * This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license * terms are different to the FreeRTOS license terms. * - * FreeRTOS+UDP uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. + * FreeRTOS+UDP uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. * Details of both license options follow: * * - Open source licensing - @@ -21,9 +21,9 @@ * * - Commercial licensing - * Businesses and individuals that for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+UDP into proprietary software for distribution in any - * form. Commercial licenses can be purchased from http://shop.freertos.org/udp + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+UDP into proprietary software for distribution in any + * form. Commercial licenses can be purchased from http://shop.freertos.org/udp * and do not require any source files to be changed. * * FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot @@ -52,7 +52,7 @@ * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/FreeRTOS_UDP_API_Functions.shtml */ -uint32_t FreeRTOS_gethostbyname( const uint8_t *pcHostName ); +uint32_t FreeRTOS_gethostbyname( const char *pcHostName ); #endif /* FREERTOS_DNS_H */ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_Sockets.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_Sockets.h index d1043302d..5946c3247 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_Sockets.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/FreeRTOS_Sockets.h @@ -5,11 +5,11 @@ * This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license * terms are different to the FreeRTOS license terms. * - * FreeRTOS+UDP uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. + * FreeRTOS+UDP uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+UDP is also distributed under the same GPL V2 license terms. * Details of both license options follow: * * - Open source licensing - @@ -21,9 +21,9 @@ * * - Commercial licensing - * Businesses and individuals that for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+UDP into proprietary software for distribution in any - * form. Commercial licenses can be purchased from http://shop.freertos.org/udp + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+UDP into proprietary software for distribution in any + * form. Commercial licenses can be purchased from http://shop.freertos.org/udp * and do not require any source files to be changed. * * FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot @@ -139,7 +139,7 @@ struct freertos_sockaddr /* The socket type itself. */ typedef void *xSocket_t; -/* The xSocketSet_t type is the equivalent to the fd_set type used by the +/* The xSocketSet_t type is the equivalent to the fd_set type used by the Berkeley API. */ typedef void *xSocketSet_t; @@ -154,8 +154,8 @@ int32_t FreeRTOS_sendto( xSocket_t xSocket, const void *pvBuffer, size_t xTotalD portBASE_TYPE FreeRTOS_bind( xSocket_t xSocket, struct freertos_sockaddr *pxAddress, socklen_t xAddressLength ); portBASE_TYPE FreeRTOS_setsockopt( xSocket_t xSocket, int32_t lLevel, int32_t lOptionName, const void *pvOptionValue, size_t xOptionLength ); portBASE_TYPE FreeRTOS_closesocket( xSocket_t xSocket ); -uint32_t FreeRTOS_gethostbyname( const uint8_t *pcHostName ); -uint32_t FreeRTOS_inet_addr( const uint8_t * pucIPAddress ); +uint32_t FreeRTOS_gethostbyname( const char *pcHostName ); +uint32_t FreeRTOS_inet_addr( const char *pcIPAddress ); #if ipconfigSUPPORT_SELECT_FUNCTION == 1 xSocketSet_t FreeRTOS_CreateSocketSet( unsigned portBASE_TYPE uxEventQueueLength ); diff --git a/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-releated-CLI-commands.c b/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-releated-CLI-commands.c index a902846c3..faf456af7 100644 --- a/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-releated-CLI-commands.c +++ b/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-releated-CLI-commands.c @@ -244,7 +244,7 @@ size_t xColumns = 50U; configASSERT( pcParameter ); /* Attempt to open the requested file. */ - pxFile = f_open( ( const char * ) pcParameter, "r" ); + pxFile = f_open( pcParameter, "r" ); } if( pxFile != NULL ) @@ -406,7 +406,7 @@ unsigned char ucReturned; configASSERT( pcParameter ); /* Attempt to delete the file. */ - ucReturned = f_delete( ( const char * ) pcParameter ); + ucReturned = f_delete( pcParameter ); if( ucReturned == F_NO_ERROR ) { @@ -455,7 +455,7 @@ long lSourceLength, lDestinationLength = 0; pcSourceFile[ xParameterStringLength ] = 0x00; /* See if the source file exists, obtain its length if it does. */ - lSourceLength = f_filelength( ( const char * ) pcSourceFile ); + lSourceLength = f_filelength( pcSourceFile ); if( lSourceLength == 0 ) { @@ -464,7 +464,7 @@ long lSourceLength, lDestinationLength = 0; else { /* See if the destination file exists. */ - lDestinationLength = f_filelength( ( const char * ) pcDestinationFile ); + lDestinationLength = f_filelength( pcDestinationFile ); if( lDestinationLength != 0 ) { @@ -523,7 +523,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the source file, seek past the data that has already been read from the file, read the next block of data, then close the file again so the destination file can be opened. */ - pxFile = f_open( ( const char * ) pcSourceFile, "r" ); + pxFile = f_open( pcSourceFile, "r" ); if( pxFile != NULL ) { f_seek( pxFile, lBytesRead, F_SEEK_SET ); @@ -538,7 +538,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the destination file and write the block of data to the end of the file. */ - pxFile = f_open( ( const char * ) pcDestinationFile, "a" ); + pxFile = f_open( pcDestinationFile, "a" ); if( pxFile != NULL ) { f_write( pxWriteBuffer, lBytesToRead, 1, pxFile ); diff --git a/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-system-demo.c b/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-system-demo.c index e42fd1551..e0606f23d 100644 --- a/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-system-demo.c +++ b/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/File-system-demo.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT @@ -302,7 +302,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "In directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); @@ -331,7 +331,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "Back in root directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcRoot ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcRoot ) == 0 ); } /*-----------------------------------------------------------*/ @@ -349,7 +349,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "Back in directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); diff --git a/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/Sample-CLI-commands.c b/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/Sample-CLI-commands.c index 32d56895e..7bae71bec 100644 --- a/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/Sample-CLI-commands.c +++ b/FreeRTOS/Demo/CORTEX_A9_RZ_R7S72100_IAR_DS-5/Source/Full-Demo/Sample-CLI-commands.c @@ -405,7 +405,7 @@ static portBASE_TYPE lParameterNumber = 0; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); @@ -414,7 +414,7 @@ static portBASE_TYPE lParameterNumber = 0; sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" ); } - else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 ) + else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 ) { /* End the trace, if one is running. */ vTraceStop(); diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c index bce7c40dd..9db8cb154 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c @@ -348,7 +348,7 @@ static portBASE_TYPE lParameterNumber = 0; /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ @@ -399,7 +399,7 @@ static portBASE_TYPE lParameterNumber = 0; configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); @@ -408,7 +408,7 @@ static portBASE_TYPE lParameterNumber = 0; sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" ); } - else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 ) + else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 ) { /* End the trace, if one is running. */ vTraceStop(); diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c index b488d016e..f2e1e776b 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -113,14 +113,14 @@ static void prvSendBuffer( struct usart_module *pxCDCUsart, const char * pcBuffe extern void vRegisterSampleCLICommands( void ); /* - * Configure the UART used for IO.and register prvUARTRxNotificationHandler() + * Configure the UART used for IO.and register prvUARTRxNotificationHandler() * to handle UART Rx events. */ static void prvConfigureUART( struct usart_module *pxCDCUsart ); /* - * Callback functions registered with the Atmel UART driver. Both functions - * just 'give' a semaphore to unblock a task that may be waiting for a + * Callback functions registered with the Atmel UART driver. Both functions + * just 'give' a semaphore to unblock a task that may be waiting for a * character to be received, or a transmission to complete. */ static void prvUARTTxNotificationHandler( const struct usart_module *const pxUSART ); @@ -146,7 +146,7 @@ static xSemaphoreHandle xRxCompleteSemaphore = NULL; void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority ) { vRegisterSampleCLICommands(); - + /* Create that task that handles the console itself. */ xTaskCreate( prvUARTCommandConsoleTask, /* The task that implements the command console. */ "CLI", /* Text name assigned to the task. This is just to assist debugging. The kernel does not use this name itself. */ @@ -178,13 +178,13 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s pcOutputString = FreeRTOS_CLIGetOutputBuffer(); /* Send the welcome message. */ - prvSendBuffer( &xCDCUsart, pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) ); + prvSendBuffer( &xCDCUsart, pcWelcomeMessage, strlen( pcWelcomeMessage ) ); for( ;; ) { /* Wait for the next character to arrive. A semaphore is used to ensure no CPU time is used until data has arrived. */ - usart_read_buffer_job( &xCDCUsart, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) ); + usart_read_buffer_job( &xCDCUsart, ( uint8_t * ) &cRxedChar, sizeof( cRxedChar ) ); if( xSemaphoreTake( xRxCompleteSemaphore, portMAX_DELAY ) == pdPASS ) { /* Echo the character back. */ @@ -201,7 +201,7 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s if( ucInputIndex == 0 ) { /* Copy the last command back into the input string. */ - strcpy( ( char * ) cInputString, ( char * ) cLastInputString ); + strcpy( cInputString, cLastInputString ); } /* Pass the received command to the command interpreter. The @@ -222,11 +222,11 @@ static struct usart_module xCDCUsart; /* Static so it doesn't take up too much s Clear the input string ready to receive the next command. Remember the command that was just processed first in case it is to be processed again. */ - strcpy( ( char * ) cLastInputString, ( char * ) cInputString ); + strcpy( cLastInputString, cInputString ); ucInputIndex = 0; memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); - prvSendBuffer( &xCDCUsart, pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) ); + prvSendBuffer( &xCDCUsart, pcEndOfOutputMessage, strlen( pcEndOfOutputMessage ) ); } else { @@ -269,9 +269,9 @@ static void prvSendBuffer( struct usart_module *pxCDCUsart, const char * pcBuffe const portTickType xBlockMax100ms = 100UL / portTICK_RATE_MS; if( xBufferLength > 0 ) - { + { usart_write_buffer_job( pxCDCUsart, ( uint8_t * ) pcBuffer, xBufferLength ); - + /* Wait for the Tx to complete so the buffer can be reused without corrupting the data that is being sent. */ xSemaphoreTake( xTxCompleteSemaphore, xBlockMax100ms ); @@ -287,7 +287,7 @@ struct usart_config xUARTConfig; without wasting any CPU time. */ vSemaphoreCreateBinary( xTxCompleteSemaphore ); configASSERT( xTxCompleteSemaphore ); - + /* This semaphore is used to allow the task to block for an Rx to complete without wasting any CPU time. */ vSemaphoreCreateBinary( xRxCompleteSemaphore ); @@ -307,13 +307,13 @@ struct usart_config xUARTConfig; xUARTConfig.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1; xUARTConfig.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2; xUARTConfig.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3; - while( usart_init( pxCDCUsart, EDBG_CDC_MODULE, &xUARTConfig ) != STATUS_OK ) + while( usart_init( pxCDCUsart, EDBG_CDC_MODULE, &xUARTConfig ) != STATUS_OK ) { /* Nothing to do here. Should include a timeout really but this is init code only. */ } usart_enable( pxCDCUsart ); - + /* Register the driver callbacks. */ usart_register_callback( pxCDCUsart, prvUARTTxNotificationHandler, USART_CALLBACK_BUFFER_TRANSMITTED ); usart_register_callback( pxCDCUsart, prvUARTRxNotificationHandler, USART_CALLBACK_BUFFER_RECEIVED ); diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4E_Atmel_Studio/Read_Me_Instructions.url b/FreeRTOS/Demo/CORTEX_M4_ATSAM4E_Atmel_Studio/Read_Me_Instructions.url new file mode 100644 index 000000000..86d28f180 --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4E_Atmel_Studio/Read_Me_Instructions.url @@ -0,0 +1,5 @@ +[InternetShortcut] +URL=http://www.freertos.org/Atmel_SAM4E_RTOS_Demo.html +IDList= +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 diff --git a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/FreeRTOSConfig.h index 1638770c6..5178443fe 100644 --- a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/FreeRTOSConfig.h @@ -72,7 +72,7 @@ * executed prior to this project being built. Once it has been executed * remove the #error line below. */ -#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. +//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. /* * Set configCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo, diff --git a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-releated-CLI-commands.c b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-releated-CLI-commands.c index 13d5e1bdb..a39dedf7e 100644 --- a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-releated-CLI-commands.c +++ b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-releated-CLI-commands.c @@ -238,7 +238,7 @@ size_t xColumns = 50U; configASSERT( pcParameter ); /* Attempt to open the requested file. */ - pxFile = f_open( ( const char * ) pcParameter, "r" ); + pxFile = f_open( pcParameter, "r" ); } if( pxFile != NULL ) @@ -400,7 +400,7 @@ unsigned char ucReturned; configASSERT( pcParameter ); /* Attempt to delete the file. */ - ucReturned = f_delete( ( const char * ) pcParameter ); + ucReturned = f_delete( pcParameter ); if( ucReturned == F_NO_ERROR ) { @@ -436,12 +436,12 @@ long lSourceLength, lDestinationLength = 0; configASSERT( pcDestinationFile ); /* Obtain the name of the source file. */ - pcSourceFile = FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - 1, /* Return the first parameter. */ - &xParameterStringLength /* Store the parameter string length. */ - ); + pcSourceFile = ( char * ) FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + 1, /* Return the first parameter. */ + &xParameterStringLength /* Store the parameter string length. */ + ); /* Sanity check something was returned. */ configASSERT( pcSourceFile ); @@ -518,7 +518,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the source file, seek past the data that has already been read from the file, read the next block of data, then close the file again so the destination file can be opened. */ - pxFile = f_open( ( const char * ) pcSourceFile, "r" ); + pxFile = f_open( pcSourceFile, "r" ); if( pxFile != NULL ) { f_seek( pxFile, lBytesRead, F_SEEK_SET ); @@ -533,7 +533,7 @@ portBASE_TYPE xReturn = pdPASS; /* Open the destination file and write the block of data to the end of the file. */ - pxFile = f_open( ( const char * ) pcDestinationFile, "a" ); + pxFile = f_open( pcDestinationFile, "a" ); if( pxFile != NULL ) { f_write( pxWriteBuffer, lBytesToRead, 1, pxFile ); diff --git a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-system-demo.c b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-system-demo.c index 31932c799..435143831 100644 --- a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-system-demo.c +++ b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/File-system-demo.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT @@ -302,7 +302,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "In directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); @@ -331,7 +331,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "Back in root directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcRoot ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcRoot ) == 0 ); } /*-----------------------------------------------------------*/ @@ -349,7 +349,7 @@ char cFileName[ fsMAX_FILE_NAME_LEN ]; /* Obtain and print out the working directory. */ f_getcwd( cRAMBuffer, fsRAM_BUFFER_SIZE ); printf( "Back in directory %s\r\n", cRAMBuffer ); - configASSERT( strcmp( ( const char * ) cRAMBuffer, pcFullPath ) == 0 ); + configASSERT( strcmp( cRAMBuffer, pcFullPath ) == 0 ); /* Generate the file name. */ sprintf( cFileName, "%s.txt", pcDirectory2 ); diff --git a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/Sample-CLI-commands.c b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/Sample-CLI-commands.c index 1df4ab16f..025b58b3b 100644 --- a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/Sample-CLI-commands.c +++ b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/Sample-CLI-commands.c @@ -209,8 +209,8 @@ const char *const pcHeader = "Task State Priority Stack #\r\n******** configASSERT( pcWriteBuffer ); /* Generate a table of task stats. */ - strcpy( ( char * ) pcWriteBuffer, pcHeader ); - vTaskList( ( char * ) pcWriteBuffer + strlen( pcHeader ) ); + strcpy( pcWriteBuffer, pcHeader ); + vTaskList( pcWriteBuffer + strlen( pcHeader ) ); /* There is no more data to return after this single string, so return pdFALSE. */ @@ -230,7 +230,7 @@ const char * const pcHeader = "Task Abs Time % Time\r\n********* configASSERT( pcWriteBuffer ); /* Generate a table of task stats. */ - strcpy( ( char * ) pcWriteBuffer, pcHeader ); + strcpy( pcWriteBuffer, pcHeader ); vTaskGetRunTimeStats( ( char * ) pcWriteBuffer + strlen( pcHeader ) ); /* There is no more data to return after this single string, so return @@ -241,7 +241,7 @@ const char * const pcHeader = "Task Abs Time % Time\r\n********* static portBASE_TYPE prvThreeParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) { -int8_t *pcParameter; +const char *pcParameter; portBASE_TYPE xParameterStringLength, xReturn; static portBASE_TYPE lParameterNumber = 0; @@ -256,7 +256,7 @@ static portBASE_TYPE lParameterNumber = 0; { /* The first time the function is called after the command has been entered just a header string is returned. */ - sprintf( ( char * ) pcWriteBuffer, "The three parameters were:\r\n" ); + sprintf( pcWriteBuffer, "The three parameters were:\r\n" ); /* Next time the function is called the first parameter will be echoed back. */ @@ -269,21 +269,21 @@ static portBASE_TYPE lParameterNumber = 0; else { /* Obtain the parameter string. */ - pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - lParameterNumber, /* Return the next parameter. */ - &xParameterStringLength /* Store the parameter string length. */ - ); + pcParameter = FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + lParameterNumber, /* Return the next parameter. */ + &xParameterStringLength /* Store the parameter string length. */ + ); /* Sanity check something was returned. */ configASSERT( pcParameter ); /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); - sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); - strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); + sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* If this is the last of the three parameters then there are no more strings to return after this one. */ @@ -308,7 +308,7 @@ static portBASE_TYPE lParameterNumber = 0; static portBASE_TYPE prvParameterEchoCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) { -int8_t *pcParameter; +const char *pcParameter; portBASE_TYPE xParameterStringLength, xReturn; static portBASE_TYPE lParameterNumber = 0; @@ -323,7 +323,7 @@ static portBASE_TYPE lParameterNumber = 0; { /* The first time the function is called after the command has been entered just a header string is returned. */ - sprintf( ( char * ) pcWriteBuffer, "The parameters were:\r\n" ); + sprintf( pcWriteBuffer, "The parameters were:\r\n" ); /* Next time the function is called the first parameter will be echoed back. */ @@ -336,20 +336,20 @@ static portBASE_TYPE lParameterNumber = 0; else { /* Obtain the parameter string. */ - pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - lParameterNumber, /* Return the next parameter. */ - &xParameterStringLength /* Store the parameter string length. */ - ); + pcParameter = FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + lParameterNumber, /* Return the next parameter. */ + &xParameterStringLength /* Store the parameter string length. */ + ); if( pcParameter != NULL ) { /* Return the parameter string. */ memset( pcWriteBuffer, 0x00, xWriteBufferLen ); - sprintf( ( char * ) pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); - strncat( ( char * ) pcWriteBuffer, ( const char * ) pcParameter, xParameterStringLength ); - strncat( ( char * ) pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); + sprintf( pcWriteBuffer, "%d: ", ( int ) lParameterNumber ); + strncat( pcWriteBuffer, pcParameter, xParameterStringLength ); + strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); /* There might be more parameters to return after this one. */ xReturn = pdTRUE; @@ -377,7 +377,7 @@ static portBASE_TYPE lParameterNumber = 0; static portBASE_TYPE prvStartStopTraceCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) { - int8_t *pcParameter; + const char *pcParameter; portBASE_TYPE lParameterStringLength; /* Remove compile time warnings about unused parameters, and check the @@ -388,35 +388,35 @@ static portBASE_TYPE lParameterNumber = 0; configASSERT( pcWriteBuffer ); /* Obtain the parameter string. */ - pcParameter = ( int8_t * ) FreeRTOS_CLIGetParameter - ( - pcCommandString, /* The command string itself. */ - 1, /* Return the first parameter. */ - &lParameterStringLength /* Store the parameter string length. */ - ); + pcParameter = FreeRTOS_CLIGetParameter + ( + pcCommandString, /* The command string itself. */ + 1, /* Return the first parameter. */ + &lParameterStringLength /* Store the parameter string length. */ + ); /* Sanity check something was returned. */ configASSERT( pcParameter ); /* There are only two valid parameter values. */ - if( strncmp( ( const char * ) pcParameter, "start", strlen( "start" ) ) == 0 ) + if( strncmp( pcParameter, "start", strlen( "start" ) ) == 0 ) { /* Start or restart the trace. */ vTraceStop(); vTraceClear(); vTraceStart(); - sprintf( ( char * ) pcWriteBuffer, "Trace recording (re)started.\r\n" ); + sprintf( pcWriteBuffer, "Trace recording (re)started.\r\n" ); } - else if( strncmp( ( const char * ) pcParameter, "stop", strlen( "stop" ) ) == 0 ) + else if( strncmp( pcParameter, "stop", strlen( "stop" ) ) == 0 ) { /* End the trace, if one is running. */ vTraceStop(); - sprintf( ( char * ) pcWriteBuffer, "Stopping trace recording.\r\n" ); + sprintf( pcWriteBuffer, "Stopping trace recording.\r\n" ); } else { - sprintf( ( char * ) pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" ); + sprintf( pcWriteBuffer, "Valid parameters are 'start' and 'stop'.\r\n" ); } /* There is no more data to return after this single string, so return diff --git a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/UARTCommandConsole.c b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/UARTCommandConsole.c index c5555eff3..e1f4cca3b 100644 --- a/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/UARTCommandConsole.c +++ b/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo/Full-Demo/UARTCommandConsole.c @@ -165,7 +165,7 @@ portBASE_TYPE xReturned; pcOutputString = FreeRTOS_CLIGetOutputBuffer(); /* Send the welcome message. */ - prvSendBuffer( pcWelcomeMessage, strlen( ( char * ) pcWelcomeMessage ) ); + prvSendBuffer( pcWelcomeMessage, strlen( pcWelcomeMessage ) ); for( ;; ) { @@ -179,14 +179,14 @@ portBASE_TYPE xReturned; if( cRxedChar == '\n' || cRxedChar == '\r' ) { /* Just to space the output from the input. */ - prvSendBuffer( pcNewLine, strlen( ( char * ) pcNewLine ) ); + prvSendBuffer( pcNewLine, strlen( pcNewLine ) ); /* See if the command is empty, indicating that the last command is to be executed again. */ if( cInputIndex == 0 ) { /* Copy the last command back into the input string. */ - strcpy( ( char * ) cInputString, ( char * ) cLastInputString ); + strcpy( cInputString, cLastInputString ); } /* Pass the received command to the command interpreter. The @@ -207,11 +207,11 @@ portBASE_TYPE xReturned; Clear the input string ready to receive the next command. Remember the command that was just processed first in case it is to be processed again. */ - strcpy( ( char * ) cLastInputString, ( char * ) cInputString ); + strcpy( cLastInputString, cInputString ); cInputIndex = 0; memset( cInputString, 0x00, cmdMAX_INPUT_SIZE ); - prvSendBuffer( pcEndOfOutputMessage, strlen( ( char * ) pcEndOfOutputMessage ) ); + prvSendBuffer( pcEndOfOutputMessage, strlen( pcEndOfOutputMessage ) ); } else {