--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+\r
+/* Standard includes. */\r
+#include <stdint.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* FreeRTOS+TCP includes. */\r
+#include "FreeRTOS_IP.h"\r
+#include "FreeRTOS_Sockets.h"\r
+#include "FreeRTOS_TCP_server.h"\r
+#include "FreeRTOS_server_private.h"\r
+\r
+/* Remove the entire file if TCP is not being used. */\r
+#if( ipconfigUSE_TCP == 1 ) && ( ( ipconfigUSE_HTTP == 1 ) || ( ipconfigUSE_FTP == 1 ) )\r
+\r
+#if !defined( ARRAY_SIZE )\r
+ #define ARRAY_SIZE(x) ( BaseType_t ) (sizeof( x ) / sizeof( x )[ 0 ] )\r
+#endif\r
+\r
+\r
+static void prvReceiveNewClient( TCPServer_t *pxServer, BaseType_t xIndex, Socket_t xNexSocket );\r
+static char *strnew( const char *pcString );\r
+/* Remove slashes at the end of a path. */\r
+static void prvRemoveSlash( char *pcDir );\r
+\r
+TCPServer_t *FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG *pxConfigs, BaseType_t xCount )\r
+{\r
+TCPServer_t *pxServer;\r
+SocketSet_t xSocketSet;\r
+\r
+ /* Create a new server.\r
+ xPort / xPortAlt : Make the service available on 1 or 2 public port numbers. */\r
+ xSocketSet = FreeRTOS_CreateSocketSet();\r
+\r
+ if( xSocketSet != NULL )\r
+ {\r
+ BaseType_t xSize;\r
+\r
+ xSize = sizeof( *pxServer ) - sizeof( pxServer->xServers ) + xCount * sizeof( pxServer->xServers[ 0 ] );\r
+\r
+ pxServer = ( TCPServer_t * ) pvPortMallocLarge( xSize );\r
+ if( pxServer != NULL )\r
+ {\r
+ struct freertos_sockaddr xAddress;\r
+ BaseType_t xNoTimeout = 0;\r
+ BaseType_t xIndex;\r
+\r
+ memset( pxServer, '\0', xSize );\r
+ pxServer->xServerCount = xCount;\r
+ pxServer->xSocketSet = xSocketSet;\r
+\r
+ for( xIndex = 0; xIndex < xCount; xIndex++ )\r
+ {\r
+ BaseType_t xPortNumber = pxConfigs[ xIndex ].xPortNumber;\r
+\r
+ if( xPortNumber > 0 )\r
+ {\r
+ Socket_t xSocket;\r
+\r
+ xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
+ FreeRTOS_printf( ( "TCP socket on port %d\n", ( int )xPortNumber ) );\r
+\r
+ if( xSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ xAddress.sin_addr = FreeRTOS_GetIPAddress(); // Single NIC, currently not used\r
+ xAddress.sin_port = FreeRTOS_htons( xPortNumber );\r
+\r
+ FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );\r
+ FreeRTOS_listen( xSocket, pxConfigs[ xIndex ].xBackLog );\r
+\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xNoTimeout, sizeof( BaseType_t ) );\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xNoTimeout, sizeof( BaseType_t ) );\r
+\r
+ #if( ipconfigHTTP_RX_BUFSIZE > 0 )\r
+ {\r
+ if( pxConfigs[ xIndex ].eType == eSERVER_HTTP )\r
+ {\r
+ WinProperties_t xWinProps;\r
+\r
+ memset( &xWinProps, '\0', sizeof( xWinProps ) );\r
+ /* The parent socket itself won't get connected. The properties below\r
+ will be inherited by each new child socket. */\r
+ xWinProps.lTxBufSize = ipconfigHTTP_TX_BUFSIZE;\r
+ xWinProps.lTxWinSize = ipconfigHTTP_TX_WINSIZE;\r
+ xWinProps.lRxBufSize = ipconfigHTTP_RX_BUFSIZE;\r
+ xWinProps.lRxWinSize = ipconfigHTTP_RX_WINSIZE;\r
+\r
+ /* Set the window and buffer sizes. */\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );\r
+ }\r
+ }\r
+ #endif\r
+\r
+ FreeRTOS_FD_SET( xSocket, xSocketSet, eSELECT_READ|eSELECT_EXCEPT );\r
+ pxServer->xServers[ xIndex ].xSocket = xSocket;\r
+ pxServer->xServers[ xIndex ].eType = pxConfigs[ xIndex ].eType;\r
+ pxServer->xServers[ xIndex ].pcRootDir = strnew( pxConfigs[ xIndex ].pcRootDir );\r
+ prvRemoveSlash( ( char * ) pxServer->xServers[ xIndex ].pcRootDir );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* Could not allocate the server, delete the socket set */\r
+ FreeRTOS_DeleteSocketSet( xSocketSet );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* Could not create a socket set, return NULL */\r
+ pxServer = NULL;\r
+ }\r
+\r
+ return pxServer;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvReceiveNewClient( TCPServer_t *pxServer, BaseType_t xIndex, Socket_t xNexSocket )\r
+{\r
+TCPClient_t *pxClient = NULL;\r
+BaseType_t xSize = 0;\r
+FTCPWorkFunction fWorkFunc = NULL;\r
+FTCPDeleteFunction fDeleteFunc = NULL;\r
+const char *pcType = "Unknown";\r
+\r
+ /*_RB_ Can the work and delete functions be part of the xSERVER_CONFIG structure\r
+ becomes generic, with no pre-processing required? */\r
+ #if( ipconfigUSE_HTTP != 0 )\r
+ {\r
+ if( pxServer->xServers[ xIndex ].eType == eSERVER_HTTP )\r
+ {\r
+ xSize = sizeof( HTTPClient_t );\r
+ fWorkFunc = xHTTPClientWork;\r
+ fDeleteFunc = vHTTPClientDelete;\r
+ pcType = "HTTP";\r
+ }\r
+ }\r
+ #endif /* ipconfigUSE_HTTP != 0 */\r
+\r
+ #if( ipconfigUSE_FTP != 0 )\r
+ {\r
+ if( pxServer->xServers[ xIndex ].eType == eSERVER_FTP )\r
+ {\r
+ xSize = sizeof( FTPClient_t );\r
+ fWorkFunc = xFTPClientWork;\r
+ fDeleteFunc = vFTPClientDelete;\r
+ pcType = "FTP";\r
+ }\r
+ }\r
+ #endif /* ipconfigUSE_FTP != 0 */\r
+\r
+ /* Malloc enough space for a new HTTP-client */\r
+ if( xSize )\r
+ {\r
+ pxClient = ( TCPClient_t* ) pvPortMallocLarge( xSize );\r
+ }\r
+\r
+ if( pxClient != NULL )\r
+ {\r
+ memset( pxClient, '\0', xSize );\r
+\r
+ /* Put the new client in front of the list. */\r
+ pxClient->eType = pxServer->xServers[ xIndex ].eType;\r
+ pxClient->pcRootDir = pxServer->xServers[ xIndex ].pcRootDir;\r
+ pxClient->pxParent = pxServer;\r
+ pxClient->xSocket = xNexSocket;\r
+ pxClient->pxNextClient = pxServer->pxClients;\r
+ pxClient->fWorkFunction = fWorkFunc;\r
+ pxClient->fDeleteFunction = fDeleteFunc;\r
+ pxServer->pxClients = pxClient;\r
+\r
+ FreeRTOS_FD_SET( xNexSocket, pxServer->xSocketSet, eSELECT_READ|eSELECT_EXCEPT );\r
+ }\r
+ else\r
+ {\r
+ pcType = "closed";\r
+ FreeRTOS_closesocket( xNexSocket );\r
+ }\r
+ {\r
+ struct freertos_sockaddr xRemoteAddress;\r
+ FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );\r
+ FreeRTOS_printf( ( "TPC-server: new %s client %xip\n", pcType, (unsigned)FreeRTOS_ntohl( xRemoteAddress.sin_addr ) ) );\r
+ }\r
+\r
+ /* Remove compiler warnings in case FreeRTOS_printf() is not used. */\r
+ ( void ) pcType;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void FreeRTOS_TCPServerWork( TCPServer_t *pxServer, TickType_t xBlockingTime )\r
+{\r
+TCPClient_t **ppxClient;\r
+BaseType_t xIndex;\r
+BaseType_t xRc;\r
+\r
+ /* Let the server do one working cycle */\r
+ xRc = FreeRTOS_select( pxServer->xSocketSet, xBlockingTime );\r
+\r
+ if( xRc != 0 )\r
+ {\r
+ for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )\r
+ {\r
+ struct freertos_sockaddr xAddress;\r
+ Socket_t xNexSocket;\r
+ socklen_t xSocketLength;\r
+\r
+ if( pxServer->xServers[ xIndex ].xSocket == FREERTOS_NO_SOCKET )\r
+ {\r
+ continue;\r
+ }\r
+\r
+ xSocketLength = sizeof( xAddress );\r
+ xNexSocket = FreeRTOS_accept( pxServer->xServers[ xIndex ].xSocket, &xAddress, &xSocketLength);\r
+\r
+ if( ( xNexSocket != FREERTOS_NO_SOCKET ) && ( xNexSocket != FREERTOS_INVALID_SOCKET ) )\r
+ {\r
+ prvReceiveNewClient( pxServer, xIndex, xNexSocket );\r
+ }\r
+ }\r
+ }\r
+\r
+ ppxClient = &pxServer->pxClients;\r
+\r
+ while( ( * ppxClient ) != NULL )\r
+ {\r
+ TCPClient_t *pxThis = *ppxClient;\r
+\r
+ /* Almost C++ */\r
+ xRc = pxThis->fWorkFunction( pxThis );\r
+\r
+ if (xRc < 0 )\r
+ {\r
+ *ppxClient = pxThis->pxNextClient;\r
+ /* Close handles, resources */\r
+ pxThis->fDeleteFunction( pxThis );\r
+ /* Free the space */\r
+ vPortFreeLarge( pxThis );\r
+ }\r
+ else\r
+ {\r
+ ppxClient = &( pxThis->pxNextClient );\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static char *strnew( const char *pcString )\r
+{\r
+BaseType_t xLength;\r
+char *pxBuffer;\r
+\r
+ xLength = strlen( pcString ) + 1;\r
+ pxBuffer = ( char * ) pvPortMalloc( xLength );\r
+ if( pxBuffer != NULL )\r
+ {\r
+ memcpy( pxBuffer, pcString, xLength );\r
+ }\r
+\r
+ return pxBuffer;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRemoveSlash( char *pcDir )\r
+{\r
+BaseType_t xLength = strlen( pcDir );\r
+\r
+ while( ( xLength > 0 ) && ( pcDir[ xLength - 1 ] == '/' ) )\r
+ {\r
+ pcDir[ --xLength ] = '\0';\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ipconfigSUPPORT_SIGNALS != 0 )\r
+\r
+ /* FreeRTOS_TCPServerWork() calls select().\r
+ The two functions below provide a possibility to interrupt\r
+ the call to select(). After the interruption, resume\r
+ by calling FreeRTOS_TCPServerWork() again. */\r
+ BaseType_t FreeRTOS_TCPServerSignal( TCPServer_t *pxServer )\r
+ {\r
+ BaseType_t xIndex;\r
+ BaseType_t xResult = pdFALSE;\r
+ for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )\r
+ {\r
+ if( pxServer->xServers[ xIndex ].xSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ FreeRTOS_SignalSocket( pxServer->xServers[ xIndex ].xSocket );\r
+ xResult = pdTRUE;\r
+ break;\r
+ }\r
+ }\r
+\r
+ return xResult;\r
+ }\r
+\r
+#endif /* ipconfigSUPPORT_SIGNALS */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ipconfigSUPPORT_SIGNALS != 0 )\r
+\r
+ /* Same as above: this function may be called from an ISR,\r
+ for instance a GPIO interrupt. */\r
+ BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t *pxServer, BaseType_t *pxHigherPriorityTaskWoken )\r
+ {\r
+ BaseType_t xIndex;\r
+ BaseType_t xResult = pdFALSE;\r
+ for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )\r
+ {\r
+ if( pxServer->xServers[ xIndex ].xSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ FreeRTOS_SignalSocketFromISR( pxServer->xServers[ xIndex ].xSocket, pxHigherPriorityTaskWoken );\r
+ xResult = pdTRUE;\r
+ break;\r
+ }\r
+ }\r
+\r
+ return xResult;\r
+ }\r
+#endif /* ipconfigSUPPORT_SIGNALS */\r
+/*-----------------------------------------------------------*/\r
+\r
+#endif /* ( ipconfigUSE_TCP == 1 ) && ( ( ipconfigUSE_HTTP == 1 ) || ( ipconfigUSE_FTP == 1 ) ) */\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+\r
+/* FreeRTOS+TCP includes. */\r
+#include "FreeRTOS_FTP_commands.h"\r
+\r
+const FTPCommand_t xFTPCommands[ FTP_CMD_COUNT ] =\r
+{\r
+/* cmdLen cmdName[7] cmdType checkLogin checkNullArg */\r
+ { 4, "USER", ECMD_USER, pdFALSE, pdFALSE },\r
+ { 4, "PASS", ECMD_PASS, pdFALSE, pdFALSE },\r
+ { 4, "ACCT", ECMD_ACCT, pdTRUE, pdFALSE },\r
+ { 3, "CWD", ECMD_CWD, pdTRUE, pdTRUE },\r
+ { 4, "CDUP", ECMD_CDUP, pdTRUE, pdFALSE },\r
+ { 4, "SMNT", ECMD_SMNT, pdTRUE, pdFALSE },\r
+ { 4, "QUIT", ECMD_QUIT, pdTRUE, pdFALSE },\r
+ { 4, "REIN", ECMD_REIN, pdTRUE, pdFALSE },\r
+ { 4, "PORT", ECMD_PORT, pdTRUE, pdFALSE },\r
+ { 4, "PASV", ECMD_PASV, pdTRUE, pdFALSE },\r
+ { 4, "TYPE", ECMD_TYPE, pdTRUE, pdFALSE },\r
+ { 4, "STRU", ECMD_STRU, pdTRUE, pdFALSE },\r
+ { 4, "MODE", ECMD_MODE, pdTRUE, pdFALSE },\r
+ { 4, "RETR", ECMD_RETR, pdTRUE, pdTRUE },\r
+ { 4, "STOR", ECMD_STOR, pdTRUE, pdTRUE },\r
+ { 4, "STOU", ECMD_STOU, pdTRUE, pdFALSE },\r
+ { 4, "APPE", ECMD_APPE, pdTRUE, pdFALSE },\r
+ { 4, "ALLO", ECMD_ALLO, pdTRUE, pdFALSE },\r
+ { 4, "REST", ECMD_REST, pdTRUE, pdFALSE },\r
+ { 4, "RNFR", ECMD_RNFR, pdTRUE, pdTRUE },\r
+ { 4, "RNTO", ECMD_RNTO, pdTRUE, pdTRUE },\r
+ { 4, "ABOR", ECMD_ABOR, pdTRUE, pdFALSE },\r
+ { 4, "SIZE", ECMD_SIZE, pdTRUE, pdTRUE },\r
+ { 4, "MDTM", ECMD_MDTM, pdTRUE, pdTRUE },\r
+ { 4, "DELE", ECMD_DELE, pdTRUE, pdTRUE },\r
+ { 3, "RMD", ECMD_RMD, pdTRUE, pdTRUE },\r
+ { 3, "MKD", ECMD_MKD, pdTRUE, pdTRUE },\r
+ { 3, "PWD", ECMD_PWD, pdTRUE, pdFALSE },\r
+ { 4, "LIST", ECMD_LIST, pdTRUE, pdFALSE },\r
+ { 4, "NLST", ECMD_NLST, pdTRUE, pdFALSE },\r
+ { 4, "SITE", ECMD_SITE, pdTRUE, pdFALSE },\r
+ { 4, "SYST", ECMD_SYST, pdFALSE, pdFALSE },\r
+ { 4, "FEAT", ECMD_FEAT, pdFALSE, pdFALSE },\r
+ { 4, "STAT", ECMD_STAT, pdTRUE, pdFALSE },\r
+ { 4, "HELP", ECMD_HELP, pdFALSE, pdFALSE },\r
+ { 4, "NOOP", ECMD_NOOP, pdFALSE, pdFALSE },\r
+ { 4, "EMPT", ECMD_EMPTY, pdFALSE, pdFALSE },\r
+ { 4, "CLOS", ECMD_CLOSE, pdTRUE, pdFALSE },\r
+ { 4, "UNKN", ECMD_UNKNOWN, pdFALSE, pdFALSE },\r
+};\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdint.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <time.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "portmacro.h"\r
+\r
+/* FreeRTOS+TCP includes. */\r
+#include "FreeRTOS_IP.h"\r
+#include "FreeRTOS_TCP_IP.h"\r
+#include "FreeRTOS_Sockets.h"\r
+#include "FreeRTOS_Stream_Buffer.h"\r
+\r
+/* FreeRTOS Protocol includes. */\r
+#include "FreeRTOS_FTP_commands.h"\r
+#include "FreeRTOS_TCP_server.h"\r
+#include "FreeRTOS_server_private.h"\r
+\r
+/* Remove the whole file if FTP is not supported. */\r
+#if( ipconfigUSE_FTP == 1 )\r
+\r
+#ifndef HTTP_SERVER_BACKLOG\r
+ #define HTTP_SERVER_BACKLOG ( 12 )\r
+#endif\r
+\r
+#if !defined( ARRAY_SIZE )\r
+ #define ARRAY_SIZE( x ) ( BaseType_t ) (sizeof( x ) / sizeof( x )[ 0 ] )\r
+#endif\r
+\r
+#if defined(__WIN32__) && !defined(ipconfigFTP_FS_USES_BACKSLAH)\r
+ #define ipconfigFTP_FS_USES_BACKSLAH 1\r
+#endif\r
+\r
+/* Some defines to make the code more readbale */\r
+#define pcCOMMAND_BUFFER pxClient->pxParent->pcCommandBuffer\r
+#define pcNEW_DIR pxClient->pxParent->pcNewDir\r
+#define pcFILE_BUFFER pxClient->pxParent->pcFileBuffer\r
+\r
+/* This FTP server will only do binary transfers */\r
+#define TMODE_BINARY 1\r
+#define TMODE_ASCII 2\r
+#define TMODE_7BITS 3\r
+#define TMODE_8BITS 4\r
+\r
+/* Ascii character definitions. */\r
+#define ftpASCII_CR 13\r
+#define ftpASCII_LF 10\r
+\r
+#if defined( FTP_WRITES_ALIGNED ) || defined( ipconfigFTP_WRITES_ALIGNED )\r
+ #error Name change : please rename the define to the new name 'ipconfigFTP_ZERO_COPY_ALIGNED_WRITES'\r
+#endif\r
+\r
+/*\r
+ * ipconfigFTP_ZERO_COPY_ALIGNED_WRITES : experimental optimisation option.\r
+ * If non-zero, receiving data will be done with the zero-copy method and also\r
+ * writes to disk will be done with sector-alignment as much as possible.\r
+ */\r
+#ifndef ipconfigFTP_ZERO_COPY_ALIGNED_WRITES\r
+ #define ipconfigFTP_ZERO_COPY_ALIGNED_WRITES 0\r
+#endif\r
+\r
+/*\r
+ * This module only has 2 public functions:\r
+ */\r
+BaseType_t xFTPClientWork( TCPClient_t *pxClient );\r
+void vFTPClientDelete( TCPClient_t *pxClient );\r
+\r
+/*\r
+ * Process a single command.\r
+ */\r
+static BaseType_t prvProcessCommand( FTPClient_t *pxClient, BaseType_t xIndex, char *pcRestCommand );\r
+\r
+/*\r
+ * Create a socket for a data connection to the FTP client.\r
+ */\r
+static BaseType_t prvTransferConnect( FTPClient_t *pxClient, BaseType_t xDoListen );\r
+\r
+/*\r
+ * Either call listen() or connect() to start the transfer connection.\r
+ */\r
+static BaseType_t prvTransferStart( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * See if the socket has got connected or disconnected. Close the socket if\r
+ * necessary.\r
+ */\r
+static void prvTransferCheck( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * Close the data socket and issue some informative logging.\r
+ */\r
+static void prvTransferCloseSocket( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * Close the file handle (pxReadHandle or pxWriteHandle).\r
+ */\r
+static void prvTransferCloseFile( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * Close a directory (-handle).\r
+ */\r
+static void prvTransferCloseDir( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * Translate a string (indicating a transfer type) to a number.\r
+ */\r
+static BaseType_t prvGetTransferType( const char *pcType );\r
+\r
+#if( ipconfigHAS_PRINTF != 0 )\r
+ /*\r
+ * For nice logging: write an amount (number of bytes), e.g. 3512200 as\r
+ * "3.45 MB"\r
+ */\r
+ static const char *pcMkSize( uint32_t ulAmount, char *pcBuffer, BaseType_t xBufferSize );\r
+#endif\r
+\r
+#if( ipconfigHAS_PRINTF != 0 )\r
+ /*\r
+ * Calculate the average as bytes-per-second, when amount and milliseconds\r
+ * are known.\r
+ */\r
+ static uint32_t ulGetAverage( uint32_t ulAmount, TickType_t xDeltaMs );\r
+#endif\r
+\r
+/*\r
+ * A port command looks like: PORT h1,h2,h3,h4,p1,p2. Parse it and translate it\r
+ * to an IP-address and a port number.\r
+ */\r
+static UBaseType_t prvParsePortData( const char *pcCommand, uint32_t *pulIPAddress );\r
+\r
+/*\r
+ * CWD: Change current working directory.\r
+ */\r
+\r
+static BaseType_t prvChangeDir( FTPClient_t *pxClient, char *pcDirectory );\r
+\r
+/*\r
+ * RNFR: Rename from ...\r
+ */\r
+static BaseType_t prvRenameFrom( FTPClient_t *pxClient, const char *pcFileName );\r
+\r
+/*\r
+ * RNTO: Rename to ...\r
+ */\r
+static BaseType_t prvRenameTo( FTPClient_t *pxClient, const char *pcFileName );\r
+\r
+/*\r
+ * SITE: Change file permissions.\r
+ */\r
+static BaseType_t prvSiteCmd( FTPClient_t *pxClient, char *pcRestCommand );\r
+\r
+/*\r
+ * DELE: Delete a file.\r
+ */\r
+static BaseType_t prvDeleteFile( FTPClient_t *pxClient, char *pcFileName );\r
+\r
+/*\r
+ * SIZE: get the size of a file (xSendDate = 0).\r
+ * MDTM: get data and time properties (xSendDate = 1).\r
+ */\r
+static BaseType_t prvSizeDateFile( FTPClient_t *pxClient, char *pcFileName, BaseType_t xSendDate );\r
+\r
+/*\r
+ * MKD: Make / create a directory (xDoRemove = 0).\r
+ * RMD: Remove a directory (xDoRemove = 1).\r
+ */\r
+static BaseType_t prvMakeRemoveDir( FTPClient_t *pxClient, const char *pcDirectory, BaseType_t xDoRemove );\r
+\r
+/*\r
+ * The next three commands: LIST, RETR and STOR all require a data socket.\r
+ * The data connection is either started with a 'PORT' or a 'PASV' command.\r
+ * Each of the commands has a prepare- (Prep) and a working- (Work) function.\r
+ * The Work function should be called as long as the data socket is open, and\r
+ * there is data to be transmitted.\r
+ */\r
+\r
+/*\r
+ * LIST: Send a directory listing in Unix style.\r
+ */\r
+static BaseType_t prvListSendPrep( FTPClient_t *pxClient );\r
+static BaseType_t prvListSendWork( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * RETR: Send a file to the FTP client.\r
+ */\r
+static BaseType_t prvRetrieveFilePrep( FTPClient_t *pxClient, char *pcFileName );\r
+static BaseType_t prvRetrieveFileWork( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * STOR: Receive a file from the FTP client and store it.\r
+ */\r
+static BaseType_t prvStoreFilePrep( FTPClient_t *pxClient, char *pcFileName );\r
+static BaseType_t prvStoreFileWork( FTPClient_t *pxClient );\r
+\r
+/*\r
+ * Print/format a single directory entry in Unix style.\r
+ */\r
+static BaseType_t prvGetFileInfoStat( FF_DirEnt_t *pxEntry, char *pcLine, BaseType_t xMaxLength );\r
+\r
+/*\r
+ * Send a reply to a socket, either the command- or the data-socket.\r
+ */\r
+static BaseType_t prvSendReply( Socket_t xSocket, const char *pcBuffer, BaseType_t xLength );\r
+\r
+/*\r
+ * Prepend the root directory (if any), plus the current working directory\r
+ * (always), to get an absolute path.\r
+ */\r
+BaseType_t xMakeAbsolute( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcPath );\r
+\r
+/*\r
+\r
+####### ##### ###### # # ##\r
+ # ## # # # # # # # #\r
+ # # # # # # #\r
+ # # # # # # # #### ### ## # #\r
+ ##### # ##### # # # # # # # # # #\r
+ # # # # # # # # # ## # ####\r
+ # # # ## ## # # # # #\r
+ # # # ## ## # # # # #\r
+#### #### #### ## ## #### #### ## ##\r
+\r
+ * xFTPClientWork()\r
+ * will be called by FreeRTOS_TCPServerWork(), after select has expired().\r
+ * FD_ISSET will not be used. This work function will always be called at\r
+ * regular intervals, and also after a select() event has occurred.\r
+ */\r
+BaseType_t xFTPClientWork( TCPClient_t *pxTCPClient )\r
+{\r
+FTPClient_t *pxClient = ( FTPClient_t * ) pxTCPClient;\r
+BaseType_t xRc;\r
+\r
+ if( pxClient->bits.bHelloSent == pdFALSE_UNSIGNED )\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ pxClient->bits.bHelloSent = pdTRUE_UNSIGNED;\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "220 Welcome to the FreeRTOS+TCP FTP server\r\n" );\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ }\r
+\r
+ /* Call recv() in a non-blocking way, to see if there is an FTP command\r
+ sent to this server. */\r
+ xRc = FreeRTOS_recv( pxClient->xSocket, ( void * )pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), 0 );\r
+\r
+ if( xRc > 0 )\r
+ {\r
+ BaseType_t xIndex;\r
+ const FTPCommand_t *pxCommand;\r
+ char *pcRestCommand;\r
+\r
+ if( xRc < ( BaseType_t ) sizeof( pcCOMMAND_BUFFER ) )\r
+ {\r
+ pcCOMMAND_BUFFER[ xRc ] = '\0';\r
+ }\r
+\r
+ while( xRc && ( ( pcCOMMAND_BUFFER[ xRc - 1 ] == ftpASCII_CR ) || ( pcCOMMAND_BUFFER[ xRc - 1 ] == ftpASCII_LF ) ) )\r
+ {\r
+ pcCOMMAND_BUFFER[ --xRc ] = '\0';\r
+ }\r
+\r
+ /* Now iterate through a list of FTP commands, and look for a match. */\r
+ pxCommand = xFTPCommands;\r
+ pcRestCommand = pcCOMMAND_BUFFER;\r
+ for( xIndex = 0; xIndex < FTP_CMD_COUNT - 1; xIndex++, pxCommand++ )\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ /* The length of each command is stored as well, just to be a bit\r
+ quicker here. */\r
+ xLength = pxCommand->xCommandLength;\r
+\r
+ if( ( xRc >= xLength ) && ( memcmp( ( const void * ) pxCommand->pcCommandName, ( const void * ) pcCOMMAND_BUFFER, xLength ) == 0 ) )\r
+ {\r
+ /* A match with an existing command is found. Skip any\r
+ whitespace to get the first parameter. */\r
+ pcRestCommand += xLength;\r
+ while( ( *pcRestCommand == ' ' ) || ( *pcRestCommand == '\t' ) )\r
+ {\r
+ pcRestCommand++;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ /* If the command received was not recognised, xIndex will point to a\r
+ fake entry called 'ECMD_UNKNOWN'. */\r
+ prvProcessCommand( pxClient, xIndex, pcRestCommand );\r
+ }\r
+ else if( xRc < 0 )\r
+ {\r
+ /* The connection will be closed and the client will be deleted. */\r
+ FreeRTOS_printf( ( "xFTPClientWork: xRc = %ld\n", xRc ) );\r
+ }\r
+\r
+ /* Does it have an open data connection? */\r
+ if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ /* See if the connection has changed. */\r
+ prvTransferCheck( pxClient );\r
+\r
+ /* "pcConnectionAck" contains a string like:\r
+ "Response: 150 Accepted data connection from 192.168.2.3:6789"\r
+ The socket can only be used once this acknowledgement has been sent. */\r
+ if( ( pxClient->xTransferSocket != FREERTOS_NO_SOCKET ) && ( pxClient->pcConnectionAck[ 0 ] == '\0' ) )\r
+ {\r
+ BaseType_t xClientRc = 0;\r
+\r
+ if( pxClient->bits1.bDirHasEntry )\r
+ {\r
+ /* Still listing a directory. */\r
+ xClientRc = prvListSendWork( pxClient );\r
+ }\r
+ else if( pxClient->pxReadHandle != NULL )\r
+ {\r
+ /* Sending a file. */\r
+ xClientRc = prvRetrieveFileWork( pxClient );\r
+ }\r
+ else if( pxClient->pxWriteHandle != NULL )\r
+ {\r
+ /* Receiving a file. */\r
+ xClientRc = prvStoreFileWork( pxClient );\r
+ }\r
+\r
+ if( xClientRc < 0 )\r
+ {\r
+ prvTransferCloseSocket( pxClient );\r
+ prvTransferCloseFile( pxClient );\r
+ }\r
+ }\r
+ }\r
+\r
+ return xRc;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvTransferCloseDir( FTPClient_t *pxClient )\r
+{\r
+ /* Nothing to close for +FAT. */\r
+ ( void ) pxClient;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vFTPClientDelete( TCPClient_t *pxTCPClient )\r
+{\r
+FTPClient_t *pxClient = ( FTPClient_t * ) pxTCPClient;\r
+\r
+ /* Close any directory-listing-handles (not used by +FAT ). */\r
+ prvTransferCloseDir( pxClient );\r
+ /* Close the data-socket. */\r
+ prvTransferCloseSocket( pxClient );\r
+ /* Close any open file handle. */\r
+ prvTransferCloseFile( pxClient );\r
+\r
+ /* Close the FTP command socket */\r
+ if( pxClient->xSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ FreeRTOS_FD_CLR( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_ALL );\r
+ FreeRTOS_closesocket( pxClient->xSocket );\r
+ pxClient->xSocket = FREERTOS_NO_SOCKET;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvProcessCommand( FTPClient_t *pxClient, BaseType_t xIndex, char *pcRestCommand )\r
+{\r
+const FTPCommand_t *pxFTPCommand = &( xFTPCommands[ xIndex ] );\r
+const char *pcMyReply = NULL;\r
+BaseType_t xResult = 0;\r
+\r
+ if( ( pxFTPCommand->ucCommandType != ECMD_PASS ) && ( pxFTPCommand->ucCommandType != ECMD_PORT ) )\r
+ {\r
+ FreeRTOS_printf( ( " %s %s\n", pxFTPCommand->pcCommandName, pcRestCommand ) );\r
+ }\r
+\r
+ if( ( pxFTPCommand->checkLogin != pdFALSE ) && ( pxClient->bits.bLoggedIn == pdFALSE_UNSIGNED ) )\r
+ {\r
+ pcMyReply = REPL_530; /* Please first log in. */\r
+ }\r
+ else if( ( pxFTPCommand->checkNullArg != pdFALSE ) && ( ( pcRestCommand == NULL ) || ( pcRestCommand[ 0 ] == '\0' ) ) )\r
+ {\r
+ pcMyReply = REPL_501; /* Command needs a parameter. */\r
+ }\r
+\r
+ if( pcMyReply == NULL )\r
+ {\r
+ switch( pxFTPCommand->ucCommandType )\r
+ {\r
+ case ECMD_USER: /* User. */\r
+ /* User name has been entered, expect password. */\r
+ pxClient->bits.bStatusUser = pdTRUE_UNSIGNED;\r
+\r
+ #if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )/*_RB_ Needs defaulting and adding to the web documentation. */\r
+ {\r
+ /* Save the user name in 'pcFileName'. */\r
+ snprintf( pxClient->pcFileName, sizeof( pxClient->pcFileName ), "%s", pcRestCommand );\r
+\r
+ /* The USER name is presented to the application. The function\r
+ may return a const string like "331 Please enter your\r
+ password\r\n". */\r
+ pcMyReply = pcApplicationFTPUserHook( pxClient->pcFileName );\r
+ if( pcMyReply == NULL )\r
+ {\r
+ pcMyReply = REPL_331_ANON;\r
+ }\r
+ }\r
+ #else\r
+ {\r
+ /* No password checks, any password will be accepted. */\r
+ pcMyReply = REPL_331_ANON;\r
+ }\r
+ #endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 */\r
+\r
+ #if( ipconfigFTP_HAS_USER_PROPERTIES_HOOK != 0 )/*_RB_ Needs defaulting and adding to the web documentation. */\r
+ {\r
+ FTPUserProperties_t xProperties;\r
+\r
+ xProperties.pcRootDir = pxClient->pcRootDir;\r
+ xProperties.xReadOnly = pdFALSE;\r
+ xProperties.usPortNumber = pxClient->usClientPort;\r
+ vApplicationFTPUserPropertiesHook( pxClient->pcFileName, &( xProperties ) );\r
+\r
+ if( xProperties.pcRootDir != NULL )\r
+ {\r
+ pxClient->pcRootDir = xProperties.pcRootDir;\r
+ }\r
+ pxClient->bits.bReadOnly = ( xProperties.xReadOnly != pdFALSE_UNSIGNED );\r
+ }\r
+ #endif /* ipconfigFTP_HAS_USER_PROPERTIES_HOOK */\r
+ break;\r
+\r
+ case ECMD_PASS: /* Password. */\r
+ pxClient->ulRestartOffset = 0;\r
+ if( pxClient->bits.bStatusUser == pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_503; /* "503 Bad sequence of commands.\r\n". */\r
+ }\r
+ else\r
+ {\r
+ BaseType_t xAllow;\r
+\r
+ pxClient->bits.bStatusUser = pdFALSE_UNSIGNED;\r
+ #if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )\r
+ {\r
+ xAllow = xApplicationFTPPasswordHook( pxClient->pcFileName, pcRestCommand );\r
+ }\r
+ #else\r
+ {\r
+ xAllow = 1;\r
+ }\r
+ #endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
+\r
+ if( xAllow > 0 )\r
+ {\r
+ pxClient->bits.bLoggedIn = pdTRUE_UNSIGNED; /* Client has now logged in. */\r
+ pcMyReply = "230 OK. Current directory is /\r\n";\r
+ }\r
+ else\r
+ {\r
+ pcMyReply = "530 Login incorrect\r\n"; /* 530 Login incorrect. */\r
+ }\r
+\r
+ strcpy( pxClient->pcCurrentDir, ( const char * ) "/" );\r
+ }\r
+ break;\r
+\r
+ case ECMD_SYST: /* System. */\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "215 UNIX Type: L8\r\n" );\r
+ pcMyReply = pcCOMMAND_BUFFER;\r
+ break;\r
+\r
+ case ECMD_PWD: /* Get working directory. */\r
+ xMakeRelative( pxClient, pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), pxClient->pcCurrentDir );\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), REPL_257_PWD, pcFILE_BUFFER );\r
+ pcMyReply = pcCOMMAND_BUFFER;\r
+ break;\r
+\r
+ case ECMD_REST:\r
+ if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_553_READ_ONLY;\r
+ }\r
+ else\r
+ {\r
+ const char *pcPtr = pcRestCommand;\r
+\r
+ while( *pcPtr == ' ' )\r
+ {\r
+ pcPtr++;\r
+ }\r
+\r
+ if( ( *pcPtr >= '0' ) && ( *pcPtr <= '9' ) )\r
+ {\r
+ sscanf( pcPtr, "%lu", &pxClient->ulRestartOffset );\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "350 Restarting at %lu. Send STORE or RETRIEVE\r\n", pxClient->ulRestartOffset );\r
+ pcMyReply = pcCOMMAND_BUFFER;\r
+ }\r
+ else\r
+ {\r
+ pcMyReply = REPL_500; /* 500 Syntax error, command unrecognised. */\r
+ }\r
+ }\r
+ break;\r
+\r
+ case ECMD_NOOP: /* NOP operation */\r
+ if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ pcMyReply = REPL_200_PROGRESS;\r
+ }\r
+ else\r
+ {\r
+ pcMyReply = REPL_200;\r
+ }\r
+ break;\r
+\r
+ case ECMD_TYPE: /* Ask or set transfer type. */\r
+ {\r
+ /* e.g. "TYPE I" for Images (binary). */\r
+ BaseType_t xType = prvGetTransferType( pcRestCommand );\r
+\r
+ if( xType < 0 )\r
+ {\r
+ /* TYPE not recognised. */\r
+ pcMyReply = REPL_500;\r
+ }\r
+ else\r
+ {\r
+ pxClient->xTransType = xType;\r
+ pcMyReply = REPL_200;\r
+ }\r
+ }\r
+ break;\r
+\r
+ case ECMD_PASV: /* Enter passive mode. */\r
+ /* Connect passive: Server will listen() and wait for a connection.\r
+ Start up a new data connection with 'xDoListen' set to true. */\r
+ if( prvTransferConnect( pxClient, pdTRUE ) == pdFALSE )\r
+ {\r
+ pcMyReply = REPL_502;\r
+ }\r
+ else\r
+ {\r
+ uint32_t ulIP;\r
+ uint16_t ulPort;\r
+ struct freertos_sockaddr xLocalAddress;\r
+ struct freertos_sockaddr xRemoteAddress;\r
+\r
+ FreeRTOS_GetLocalAddress( pxClient->xTransferSocket, &xLocalAddress );\r
+ FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );\r
+\r
+ ulIP = FreeRTOS_ntohl( xLocalAddress.sin_addr );\r
+ pxClient->ulClientIP = FreeRTOS_ntohl( xRemoteAddress.sin_addr );\r
+ ulPort = FreeRTOS_ntohs( xLocalAddress.sin_port );\r
+\r
+ pxClient->usClientPort = FreeRTOS_ntohs( xRemoteAddress.sin_port );\r
+\r
+ /* REPL_227_D "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d). */\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), REPL_227_D,\r
+ ( unsigned )ulIP >> 24,\r
+ ( unsigned )( ulIP >> 16 ) & 0xFF,\r
+ ( unsigned )( ulIP >> 8 ) & 0xFF,\r
+ ( unsigned )ulIP & 0xFF,\r
+ ( unsigned )ulPort >> 8,\r
+ ( unsigned )ulPort & 0xFF );\r
+\r
+ pcMyReply = pcCOMMAND_BUFFER;\r
+ }\r
+ break;\r
+\r
+ case ECMD_PORT: /* Active connection to the client. */\r
+ /* The client uses this command to tell the server to what\r
+ client-side port the server should contact; use of this command\r
+ indicates an active data transfer. e.g. PORT 192,168,1,2,4,19. */\r
+ {\r
+ uint32_t ulIPAddress = 0;\r
+ UBaseType_t uxPort;\r
+\r
+ uxPort = prvParsePortData( pcRestCommand, &ulIPAddress );\r
+ FreeRTOS_printf( (" PORT %lxip:%ld\n", ulIPAddress, uxPort ) );\r
+\r
+ if( uxPort == 0u )\r
+ {\r
+ pcMyReply = REPL_501;\r
+ }\r
+ else if( prvTransferConnect( pxClient, pdFALSE ) == pdFALSE )\r
+ {\r
+ /* Call prvTransferConnect() with 'xDoListen' = false for an\r
+ active connect(). */\r
+ pcMyReply = REPL_501;\r
+ }\r
+ else\r
+ {\r
+ pxClient->usClientPort = ( uint16_t ) uxPort;\r
+ pxClient->ulClientIP = ulIPAddress;\r
+ FreeRTOS_printf( ("Client address %lxip:%lu\n", ulIPAddress, uxPort ) );\r
+ pcMyReply = REPL_200;\r
+ }\r
+ }\r
+ break;\r
+\r
+ case ECMD_CWD: /* Change current working directory. */\r
+ prvChangeDir( pxClient, pcRestCommand );\r
+ break;\r
+\r
+ case ECMD_RNFR:\r
+ if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_553_READ_ONLY;\r
+ }\r
+ else\r
+ {\r
+ prvRenameFrom( pxClient, pcRestCommand );\r
+ }\r
+ break;\r
+\r
+ case ECMD_RNTO:\r
+ if( pxClient->bits.bInRename == pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_503; /* "503 Bad sequence of commands. */\r
+ }\r
+ else\r
+ {\r
+ prvRenameTo( pxClient, pcRestCommand );\r
+ }\r
+ break;\r
+\r
+ case ECMD_SITE: /* Set file permissions */\r
+ if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_553_READ_ONLY;\r
+ }\r
+ else if( prvSiteCmd( pxClient, pcRestCommand ) == pdFALSE )\r
+ {\r
+ pcMyReply = REPL_202;\r
+ }\r
+ break;\r
+\r
+ case ECMD_DELE:\r
+ if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_553_READ_ONLY;\r
+ }\r
+ else\r
+ {\r
+ prvDeleteFile( pxClient, pcRestCommand );\r
+ }\r
+ break;\r
+\r
+ case ECMD_MDTM:\r
+ prvSizeDateFile( pxClient, pcRestCommand, pdTRUE );\r
+ break;\r
+\r
+ case ECMD_SIZE:\r
+ if( pxClient->pxWriteHandle != NULL )\r
+ {\r
+ /* This SIZE query is probably about a file which is now being\r
+ received. If so, return the value of pxClient->ulRecvBytes,\r
+ pcRestCommand points to 'pcCommandBuffer', make it free by\r
+ copying it to pcNewDir. */\r
+\r
+ xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pcRestCommand );\r
+\r
+ if( strcmp( pcNEW_DIR, pcRestCommand ) == 0 )\r
+ {\r
+ BaseType_t xCount;\r
+ for( xCount = 0; xCount < 3 && pxClient->pxWriteHandle; xCount++ )\r
+ {\r
+ prvStoreFileWork( pxClient );\r
+ }\r
+ if( pxClient->pxWriteHandle != NULL )\r
+ {\r
+ /* File being queried is still open, return number of\r
+ bytes received until now. */\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 %lu\r\n", pxClient->ulRecvBytes );\r
+ pcMyReply = pcCOMMAND_BUFFER;\r
+ } /* otherwise, do a normal stat(). */\r
+ }\r
+ strcpy( pcRestCommand, pcNEW_DIR );\r
+ }\r
+ if( pcMyReply == NULL )\r
+ {\r
+ prvSizeDateFile( pxClient, pcRestCommand, pdFALSE );\r
+ }\r
+ break;\r
+ case ECMD_MKD:\r
+ case ECMD_RMD:\r
+ if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_553_READ_ONLY;\r
+ }\r
+ else\r
+ {\r
+ prvMakeRemoveDir( pxClient, pcRestCommand, pxFTPCommand->ucCommandType == ECMD_RMD );\r
+ }\r
+ break;\r
+ case ECMD_CDUP:\r
+ prvChangeDir( pxClient, ".." );\r
+ break;\r
+\r
+ case ECMD_QUIT:\r
+ prvSendReply( pxClient->xSocket, REPL_221, 0 );\r
+ pxClient->bits.bLoggedIn = pdFALSE_UNSIGNED;\r
+ break;\r
+ case ECMD_LIST:\r
+ case ECMD_RETR:\r
+ case ECMD_STOR:\r
+ if( ( pxClient->xTransferSocket == FREERTOS_NO_SOCKET ) &&\r
+ ( ( pxFTPCommand->ucCommandType != ECMD_STOR ) ||\r
+ ( pxClient->bits1.bEmptyFile == pdFALSE_UNSIGNED ) ) )\r
+ {\r
+ /* Sending "425 Can't open data connection." :\r
+ Before receiving any of these commands, there must have been a\r
+ PORT or PASV command, which causes the creation of a data socket. */\r
+ /* There is one exception: a STOR command is received while the\r
+ data connection has already been closed. This is tested with the\r
+ 'bEmptyFile' flag. */\r
+ pcMyReply = REPL_425;\r
+ }\r
+ else\r
+ {\r
+ /* In case an empty file was received ( bits1.bEmptyFile ), the\r
+ transfer socket never delivered any data. Check if the transfer\r
+ socket is still open: */\r
+ if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ prvTransferCheck( pxClient );\r
+ }\r
+ switch( pxFTPCommand->ucCommandType )\r
+ {\r
+ case ECMD_LIST:\r
+ prvListSendPrep( pxClient );\r
+ break;\r
+ case ECMD_RETR:\r
+ prvRetrieveFilePrep( pxClient, pcRestCommand );\r
+ break;\r
+ case ECMD_STOR:\r
+ if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
+ {\r
+ pcMyReply = REPL_553_READ_ONLY;\r
+ }\r
+ else\r
+ {\r
+ prvStoreFilePrep( pxClient, pcRestCommand );\r
+ if( pxClient->bits1.bEmptyFile != pdFALSE_UNSIGNED )\r
+ {\r
+ /* Although the 'xTransferSocket' is closed already,\r
+ call this function just for the logging. */\r
+ prvTransferCloseSocket( pxClient );\r
+\r
+ /* Close an empty file. */\r
+ prvTransferCloseFile( pxClient );\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ break;\r
+\r
+ case ECMD_FEAT:\r
+ {\r
+ static const char pcFeatAnswer[] =\r
+ "211-Features:\x0a"\r
+ /* The MDTM command is only allowed when\r
+ there is support for date&time. */\r
+ #if( ffconfigTIME_SUPPORT != 0 )\r
+ " MDTM\x0a"\r
+ #endif\r
+ " REST STREAM\x0a"\r
+ " SIZE\x0d\x0a"\r
+ "211 End\x0d\x0a";\r
+ pcMyReply = pcFeatAnswer;\r
+ }\r
+ break;\r
+\r
+ case ECMD_UNKNOWN:\r
+ FreeRTOS_printf( ("ftp::processCmd: Cmd %s unknown\n", pcRestCommand ) );\r
+ pcMyReply = REPL_500;\r
+ break;\r
+ }\r
+ }\r
+ if( pxFTPCommand->ucCommandType != ECMD_RNFR )\r
+ {\r
+ pxClient->bits.bInRename = pdFALSE_UNSIGNED;\r
+ }\r
+\r
+ if( pcMyReply != NULL )\r
+ {\r
+ xResult = prvSendReply( pxClient->xSocket, pcMyReply, strlen( pcMyReply ) );\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvTransferConnect( FTPClient_t *pxClient, BaseType_t xDoListen )\r
+{\r
+Socket_t xSocket;\r
+BaseType_t xResult;\r
+\r
+ /* Open a socket for a data connection with the FTP client.\r
+ Happens after a PORT or a PASV command. */\r
+\r
+ /* Make sure the previous socket is deleted and flags reset */\r
+ prvTransferCloseSocket( pxClient );\r
+\r
+ pxClient->bits1.bEmptyFile = pdFALSE_UNSIGNED;\r
+\r
+ xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
+\r
+ if( ( xSocket != FREERTOS_NO_SOCKET ) && ( xSocket != FREERTOS_INVALID_SOCKET ) )\r
+ {\r
+ BaseType_t xSmallTimeout = pdMS_TO_TICKS( 100 );\r
+ struct freertos_sockaddr xAddress;\r
+\r
+ #if( ipconfigFTP_TX_BUFSIZE > 0 )\r
+ WinProperties_t xWinProps;\r
+ #endif\r
+ xAddress.sin_addr = FreeRTOS_GetIPAddress( ); /* Single NIC, currently not used */\r
+ xAddress.sin_port = FreeRTOS_htons( 0 ); /* Bind to any available port number */\r
+\r
+ FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );\r
+\r
+ #if( ipconfigFTP_TX_BUFSIZE > 0 )\r
+ {\r
+ /* Fill in the buffer and window sizes that will be used by the\r
+ socket. */\r
+ xWinProps.lTxBufSize = ipconfigFTP_TX_BUFSIZE;\r
+ xWinProps.lTxWinSize = ipconfigFTP_TX_WINSIZE;\r
+ xWinProps.lRxBufSize = ipconfigFTP_RX_BUFSIZE;\r
+ xWinProps.lRxWinSize = ipconfigFTP_RX_WINSIZE;\r
+\r
+ /* Set the window and buffer sizes. */\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );\r
+ }\r
+ #endif\r
+\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xSmallTimeout, sizeof( BaseType_t ) );\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xSmallTimeout, sizeof( BaseType_t ) );\r
+\r
+ /* The same instance of the socket will be used for the connection and\r
+ data transport. */\r
+ if( xDoListen != pdFALSE )\r
+ {\r
+ BaseType_t xTrueValue = pdTRUE;\r
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_REUSE_LISTEN_SOCKET, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
+ }\r
+ pxClient->bits1.bIsListen = xDoListen;\r
+ pxClient->xTransferSocket = xSocket;\r
+\r
+ if( xDoListen != pdFALSE )\r
+ {\r
+ FreeRTOS_FD_SET( xSocket, pxClient->pxParent->xSocketSet, eSELECT_EXCEPT | eSELECT_READ );\r
+ /* Calling FreeRTOS_listen( ) */\r
+ xResult = prvTransferStart( pxClient );\r
+ if( xResult >= 0 )\r
+ {\r
+ xResult = pdTRUE;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_FD_SET( xSocket, pxClient->pxParent->xSocketSet, eSELECT_EXCEPT | eSELECT_READ | eSELECT_WRITE );\r
+ xResult = pdTRUE;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_printf( ( "FreeRTOS_socket() failed\n" ) );\r
+ xResult = -pdFREERTOS_ERRNO_ENOMEM;\r
+ }\r
+\r
+ /* An active socket (PORT) should connect() later. */\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvTransferStart( FTPClient_t *pxClient )\r
+{\r
+BaseType_t xResult;\r
+\r
+ /* A transfer socket has been opened, now either call listen() for 'PASV'\r
+ or connect() for the 'PORT' command. */\r
+ if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
+ {\r
+ xResult = FreeRTOS_listen( pxClient->xTransferSocket, 1 );\r
+ }\r
+ else\r
+ {\r
+ struct freertos_sockaddr xAddress;\r
+\r
+ xAddress.sin_addr = FreeRTOS_htonl( pxClient->ulClientIP );\r
+ xAddress.sin_port = FreeRTOS_htons( pxClient->usClientPort );\r
+ /* Start an active connection for this data socket */\r
+ xResult = FreeRTOS_connect( pxClient->xTransferSocket, &xAddress, sizeof( xAddress ) );\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvTransferCheck( FTPClient_t *pxClient )\r
+{\r
+BaseType_t xRxSize;\r
+\r
+ /* A data transfer is busy. Check if there are changes in connectedness. */\r
+ xRxSize = FreeRTOS_rx_size( pxClient->xTransferSocket );\r
+\r
+ if( pxClient->bits1.bClientConnected == pdFALSE_UNSIGNED )\r
+ {\r
+ /* The time to receive a small file can be so short, that we don't even\r
+ see that the socket gets connected and disconnected. Therefore, check\r
+ the sizeof of the RX buffer. */\r
+ {\r
+ struct freertos_sockaddr xAddress;\r
+ Socket_t xNexSocket;\r
+ socklen_t xSocketLength = sizeof( xAddress );\r
+\r
+ if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
+ {\r
+ xNexSocket = FreeRTOS_accept( pxClient->xTransferSocket, &xAddress, &xSocketLength);\r
+ if( ( ( xNexSocket != FREERTOS_NO_SOCKET ) && ( xNexSocket != FREERTOS_INVALID_SOCKET ) ) ||\r
+ xRxSize > 0 )\r
+ {\r
+ pxClient->bits1.bClientConnected = pdTRUE_UNSIGNED;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( FreeRTOS_issocketconnected( pxClient->xTransferSocket ) > 0 ||\r
+ xRxSize > 0 )\r
+ {\r
+ pxClient->bits1.bClientConnected = pdTRUE_UNSIGNED;\r
+ }\r
+ }\r
+ if( pxClient->bits1.bClientConnected != pdFALSE_UNSIGNED )\r
+ {\r
+ pxClient->bits1.bEmptyFile = pdFALSE_UNSIGNED;\r
+ #if( ipconfigHAS_PRINTF != 0 )\r
+ {\r
+ struct freertos_sockaddr xRemoteAddress, xLocalAddress;\r
+ FreeRTOS_GetRemoteAddress( pxClient->xTransferSocket, &xRemoteAddress );\r
+ FreeRTOS_GetLocalAddress( pxClient->xTransferSocket, &xLocalAddress );\r
+ FreeRTOS_printf( ( "%s Connected from %u to %u\n",\r
+ pxClient->bits1.bIsListen != pdFALSE_UNSIGNED ? "PASV" : "PORT",\r
+ ( unsigned ) FreeRTOS_ntohs( xLocalAddress.sin_port ),\r
+ ( unsigned ) FreeRTOS_ntohs( xRemoteAddress.sin_port ) ) );\r
+ }\r
+ #endif /* ipconfigHAS_PRINTF */\r
+ FreeRTOS_FD_CLR( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
+ FreeRTOS_FD_SET( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_READ|eSELECT_EXCEPT );\r
+ }\r
+ }\r
+ }\r
+\r
+ if ( pxClient->bits1.bClientConnected != pdFALSE_UNSIGNED )\r
+ {\r
+ if( pxClient->pcConnectionAck[ 0 ] != '\0' )\r
+ {\r
+ BaseType_t xLength;\r
+ BaseType_t xRemotePort;\r
+ struct freertos_sockaddr xRemoteAddress;\r
+\r
+ FreeRTOS_GetRemoteAddress( pxClient->xTransferSocket, &xRemoteAddress );\r
+ xRemotePort = FreeRTOS_ntohs( xRemoteAddress.sin_port );\r
+\r
+ /* Tell on the command port 21 we have a data connection */\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ pxClient->pcConnectionAck, pxClient->ulClientIP, xRemotePort );\r
+\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ pxClient->pcConnectionAck[ 0 ] = '\0';\r
+ }\r
+\r
+ if( ( FreeRTOS_issocketconnected( pxClient->xTransferSocket ) == pdFALSE ) && FreeRTOS_rx_size( pxClient->xTransferSocket ) == 0 )\r
+ {\r
+ prvTransferCloseSocket( pxClient );\r
+ prvTransferCloseFile( pxClient );\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvTransferCloseSocket( FTPClient_t *pxClient )\r
+{\r
+ if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ /* DEBUGGING ONLY */\r
+ BaseType_t xRxSize = FreeRTOS_rx_size( pxClient->xTransferSocket );\r
+ if( xRxSize > 0 )\r
+ {\r
+ BaseType_t xRxSize2;\r
+ BaseType_t xStatus;\r
+ prvStoreFileWork( pxClient );\r
+ xStatus = FreeRTOS_connstatus( pxClient->xTransferSocket );\r
+ xRxSize2 = FreeRTOS_rx_size( pxClient->xTransferSocket );\r
+ FreeRTOS_printf( ( "FTP: WARNING: %s: RX size = %ld -> %ld (%s)\n",\r
+ FreeRTOS_GetTCPStateName( xStatus ),\r
+ xRxSize, xRxSize2, pxClient->pcFileName ) );\r
+ if( xRxSize2 > 1 )\r
+ {\r
+ return;\r
+ }\r
+\r
+ /* Remove compiler warnings in case FreeRTOS_printf() is not\r
+ defined. */\r
+ ( void ) xStatus;\r
+ }\r
+ }\r
+\r
+ if( ( pxClient->pxWriteHandle != NULL ) || ( pxClient->pxReadHandle != NULL ) )\r
+ {\r
+ BaseType_t xLength;\r
+ char pcStrBuf[ 32 ];\r
+\r
+ if( pxClient->bits1.bHadError == pdFALSE_UNSIGNED )\r
+ {\r
+ xLength = snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ),\r
+ "226 Closing connection %d bytes transmitted\r\n", ( int ) pxClient->ulRecvBytes );\r
+ }\r
+ else\r
+ {\r
+ xLength = snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ),\r
+ "451 Requested action aborted after %d bytes\r\n", ( int ) pxClient->ulRecvBytes );\r
+ }\r
+\r
+ /* Tell on the command socket the data connection is now closed. */\r
+ prvSendReply( pxClient->xSocket, pxClient->pcClientAck, xLength );\r
+\r
+ #if( ipconfigHAS_PRINTF != 0 )\r
+ {\r
+ TickType_t xDelta;\r
+ uint32_t ulAverage;\r
+ xDelta = xTaskGetTickCount( ) - pxClient->xStartTime;\r
+ ulAverage = ulGetAverage( pxClient->ulRecvBytes, xDelta );\r
+\r
+ FreeRTOS_printf( ("FTP: %s: '%s' %lu Bytes (%s/sec)\n",\r
+ pxClient->pxReadHandle ? "sent" : "recv",\r
+ pxClient->pcFileName,\r
+ pxClient->ulRecvBytes,\r
+ pcMkSize( ulAverage, pcStrBuf, sizeof( pcStrBuf ) ) ) );\r
+ }\r
+ #endif\r
+ }\r
+\r
+ if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ FreeRTOS_FD_CLR( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_ALL );\r
+ FreeRTOS_closesocket( pxClient->xTransferSocket );\r
+ pxClient->xTransferSocket = FREERTOS_NO_SOCKET;\r
+ if( pxClient->ulRecvBytes == 0ul )\r
+ {\r
+ /* Received zero bytes: an empty file */\r
+ pxClient->bits1.bEmptyFile = pdTRUE_UNSIGNED;\r
+ }\r
+ else\r
+ {\r
+ pxClient->bits1.bEmptyFile = pdFALSE_UNSIGNED;\r
+ }\r
+ }\r
+ pxClient->bits1.bIsListen = pdFALSE_UNSIGNED;\r
+ pxClient->bits1.bDirHasEntry = pdFALSE_UNSIGNED;\r
+ pxClient->bits1.bClientConnected = pdFALSE_UNSIGNED;\r
+ pxClient->bits1.bHadError = pdFALSE_UNSIGNED;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvTransferCloseFile( FTPClient_t *pxClient )\r
+{\r
+ if( pxClient->pxWriteHandle != NULL )\r
+ {\r
+ ff_fclose( pxClient->pxWriteHandle );\r
+ pxClient->pxWriteHandle = NULL;\r
+ #if( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )\r
+ {\r
+ vApplicationFTPReceivedHook( pxClient->pcFileName, pxClient->ulRecvBytes, pxClient );\r
+ }\r
+ #endif\r
+\r
+ }\r
+ if( pxClient->pxReadHandle != NULL )\r
+ {\r
+ ff_fclose( pxClient->pxReadHandle );\r
+ pxClient->pxReadHandle = NULL;\r
+ }\r
+ /* These two field are only used for logging / file-statistics */\r
+ pxClient->ulRecvBytes = 0ul;\r
+ pxClient->xStartTime = 0ul;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/**\r
+ * Guess the transfer type, given the client requested type.\r
+ * Actually in unix there is no difference between binary and\r
+ * ascii mode when we work with file descriptors.\r
+ * If #type is not recognized as a valid client request, -1 is returned.\r
+ */\r
+static BaseType_t prvGetTransferType( const char *pcType )\r
+{\r
+BaseType_t xResult = -1;\r
+\r
+ if( pcType != NULL )\r
+ {\r
+ BaseType_t xLength = strlen( pcType );\r
+ if( xLength == 0 )\r
+ {\r
+ return -1;\r
+ }\r
+ switch( pcType[ 0 ] ) {\r
+ case 'I':\r
+ xResult = TMODE_BINARY;\r
+ break;\r
+ case 'A':\r
+ xResult = TMODE_ASCII;\r
+ break;\r
+ case 'L':\r
+ if( xLength >= 3 )\r
+ {\r
+ if( pcType[ 2 ] == '7' )\r
+ {\r
+ xResult = TMODE_7BITS;\r
+ }\r
+ else if( pcType[ 2 ] == '8' )\r
+ {\r
+ xResult = TMODE_7BITS;\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ipconfigHAS_PRINTF != 0 )\r
+ #define SIZE_1_GB ( 1024ul * 1024ul * 1024ul )\r
+ #define SIZE_1_MB ( 1024ul * 1024ul )\r
+ #define SIZE_1_KB ( 1024ul )\r
+\r
+ static const char *pcMkSize( uint32_t ulAmount, char *pcBuffer, BaseType_t xBufferSize )\r
+ {\r
+ uint32_t ulGB, ulMB, ulKB, ulByte;\r
+\r
+ ulGB = ( ulAmount / SIZE_1_GB );\r
+ ulAmount -= ( ulGB * SIZE_1_GB );\r
+ ulMB = ( ulAmount / SIZE_1_MB );\r
+ ulAmount -= ( ulMB * SIZE_1_MB );\r
+ ulKB = ( ulAmount / SIZE_1_KB );\r
+ ulAmount -= ( ulKB * SIZE_1_KB );\r
+ ulByte = ( ulAmount );\r
+\r
+ if (ulGB != 0ul )\r
+ {\r
+ snprintf( pcBuffer, xBufferSize, "%lu.%02lu GB", ulGB, (100 * ulMB) / SIZE_1_KB );\r
+ }\r
+ else if( ulMB != 0ul )\r
+ {\r
+ snprintf( pcBuffer, xBufferSize, "%lu.%02lu MB", ulMB, (100 * ulKB) / SIZE_1_KB );\r
+ }\r
+ else if( ulKB != 0ul )\r
+ {\r
+ snprintf(pcBuffer, xBufferSize, "%lu.%02lu KB", ulKB, (100 * ulByte) / SIZE_1_KB );\r
+ }\r
+ else\r
+ {\r
+ snprintf( pcBuffer, xBufferSize, "%lu bytes", ulByte );\r
+ }\r
+\r
+ return pcBuffer;\r
+ }\r
+ /*-----------------------------------------------------------*/\r
+#endif /* ipconfigHAS_PRINTF != 0 */\r
+\r
+#if( ipconfigHAS_PRINTF != 0 )\r
+ static uint32_t ulGetAverage( uint32_t ulAmount, TickType_t xDeltaMs )\r
+ {\r
+ uint32_t ulAverage;\r
+\r
+ /* Get the average amount of bytes per seconds. Ideally this is\r
+ calculated by Multiplying with 1000 and dividing by milliseconds:\r
+ ulAverage = ( 1000ul * ulAmount ) / xDeltaMs;\r
+ Now get a maximum precision, while avoiding an arithmetic overflow:\r
+ */\r
+ if( xDeltaMs == 0ul )\r
+ {\r
+ /* Time is zero, there is no average */\r
+ ulAverage = 0ul;\r
+ }\r
+ else if( ulAmount >= ( ~0ul / 10ul ) )\r
+ {\r
+ /* More than 409 MB has been transferred, do not multiply. */\r
+ ulAverage = ( ulAmount / ( xDeltaMs / 1000ul ) );\r
+ }\r
+ else if( ulAmount >= ( ~0ul / 100ul ) )\r
+ {\r
+ /* Between 409 and 41 MB has been transferred, can multiply by 10. */\r
+ ulAverage = ( ( ulAmount * 10ul ) / ( xDeltaMs / 100ul ) );\r
+ }\r
+ else if( ulAmount >= ( ~0ul / 1000ul ) )\r
+ {\r
+ /* Between 4.1 MB and 41 has been transferred, can multiply by 100. */\r
+ ulAverage = ( ( ulAmount * 100ul ) / ( xDeltaMs / 10ul ) );\r
+ }\r
+ else\r
+ {\r
+ /* Less than 4.1 MB: can multiply by 1000. */\r
+ ulAverage = ( ( ulAmount * 1000ul ) / xDeltaMs );\r
+ }\r
+\r
+ return ulAverage;\r
+ }\r
+ /*-----------------------------------------------------------*/\r
+#endif /* ipconfigHAS_PRINTF != 0 */\r
+\r
+static UBaseType_t prvParsePortData( const char *pcCommand, uint32_t *pulIPAddress )\r
+{\r
+/*_HT_ Using 'unsigned' here because when sscanf() sees '%u', it expects a pointer to 'unsigned'.\r
+Not sure about the sscanf() format for UBaseType_t ? */\r
+unsigned h1, h2, h3, h4, p1, p2;\r
+char sep;\r
+UBaseType_t uxResult;\r
+\r
+ /* Expect PORT h1,h2,h3,h4,p1,p2 */\r
+ if (sscanf (pcCommand, "%u%c%u%c%u%c%u%c%u%c%u", &h1, &sep, &h2, &sep, &h3, &sep, &h4, &sep, &p1, &sep, &p2) != 11)\r
+ {\r
+ uxResult= 0u;\r
+ }\r
+ else\r
+ {\r
+ /* Put in network byte order. */\r
+ *pulIPAddress =\r
+ ( ( uint32_t ) h1 << 24 ) |\r
+ ( ( uint32_t ) h2 << 16 ) |\r
+ ( ( uint32_t ) h3 << 8 ) |\r
+ ( ( uint32_t ) h4 );\r
+ uxResult = ( p1 << 8 ) | p2;\r
+ }\r
+ return uxResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+\r
+ #### ####### # ###\r
+# # # # ## # #\r
+# # # # # #\r
+# ###### #### ### ## #### # # ### # ####\r
+ ## # # # # # # # # ##### # # # #\r
+ ## # # # ## # ###### # # # # ######\r
+# # # # # # # # # # #\r
+# # # ## # # # # ## # # # # ##\r
+ #### ## #### #### #### #### ##### ##### ####\r
+\r
+*/\r
+\r
+static BaseType_t prvStoreFilePrep( FTPClient_t *pxClient, char *pcFileName )\r
+{\r
+BaseType_t xResult;\r
+FF_FILE *pxNewHandle;\r
+size_t uxFileSize = 0ul;\r
+int iErrorNo;\r
+\r
+ /* Close previous handle (if any) and reset file transfer parameters. */\r
+ prvTransferCloseFile( pxClient );\r
+\r
+ xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
+\r
+ pxNewHandle = NULL;\r
+\r
+ if( pxClient->ulRestartOffset != 0 )\r
+ {\r
+ size_t uxOffset = pxClient->ulRestartOffset;\r
+ int32_t lRc;\r
+\r
+ pxClient->ulRestartOffset = 0ul; /* Only use 1 time. */\r
+ pxNewHandle = ff_fopen( pxClient->pcFileName, "ab" );\r
+\r
+ if( pxNewHandle != NULL )\r
+ {\r
+ uxFileSize = pxNewHandle->ulFileSize;\r
+\r
+ if( uxOffset <= uxFileSize )\r
+ {\r
+ lRc = ff_fseek( pxNewHandle, uxOffset, FF_SEEK_SET );\r
+ }\r
+ else\r
+ {\r
+ /* Won't even try to seek after EOF */\r
+ lRc = -pdFREERTOS_ERRNO_EINVAL;\r
+ }\r
+ if( lRc != 0 )\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "450 Seek invalid %u length %u\r\n",\r
+ ( unsigned ) uxOffset, ( unsigned ) uxFileSize );\r
+\r
+ /* "Requested file action not taken". */\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+\r
+ FreeRTOS_printf( ( "ftp::storeFile: create %s: Seek %u length %u\n",\r
+ pxClient->pcFileName, ( unsigned ) uxOffset, ( unsigned ) uxFileSize ) );\r
+\r
+ ff_fclose( pxNewHandle );\r
+ pxNewHandle = NULL;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ pxNewHandle = ff_fopen( pxClient->pcFileName, "wb" );\r
+ }\r
+\r
+ if( pxNewHandle == NULL )\r
+ {\r
+ iErrorNo = stdioGET_ERRNO();\r
+ if( iErrorNo == pdFREERTOS_ERRNO_ENOSPC )\r
+ {\r
+ prvSendReply( pxClient->xSocket, REPL_552, 0 );\r
+ }\r
+ else\r
+ {\r
+ /* "Requested file action not taken". */\r
+ prvSendReply( pxClient->xSocket, REPL_450, 0 );\r
+ }\r
+ FreeRTOS_printf( ( "ftp::storeFile: create %s: %s (errno %d)\n",\r
+ pxClient->pcFileName,\r
+ ( const char* ) strerror( iErrorNo ), iErrorNo ) );\r
+\r
+ xResult = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ if( pxClient->bits1.bIsListen )\r
+ {\r
+ /* True if PASV is used. */\r
+ snprintf( pxClient->pcConnectionAck, sizeof( pxClient->pcConnectionAck ),\r
+ "150 Accepted data connection from %%xip:%%u\r\n" );\r
+ prvTransferCheck( pxClient );\r
+ }\r
+ else\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "150 Opening BIN connection to store file\r\n" );\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ pxClient->pcConnectionAck[ 0 ] = '\0';\r
+ prvTransferStart( pxClient ); /* Now active connect. */\r
+ }\r
+\r
+ pxClient->pxWriteHandle = pxNewHandle;\r
+\r
+ /* To get some statistics about the performance. */\r
+ pxClient->xStartTime = xTaskGetTickCount( );\r
+\r
+ xResult = pdTRUE;\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ipconfigFTP_ZERO_COPY_ALIGNED_WRITES == 0 )\r
+\r
+ static BaseType_t prvStoreFileWork( FTPClient_t *pxClient )\r
+ {\r
+ BaseType_t xRc, xWritten;\r
+\r
+ /* Read from the data socket until all has been read or until a negative value\r
+ is returned. */\r
+ for( ; ; )\r
+ {\r
+ char *pcBuffer;\r
+\r
+ /* The "zero-copy" method: */\r
+ xRc = FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) &pcBuffer,\r
+ 0x20000u, FREERTOS_ZERO_COPY | FREERTOS_MSG_DONTWAIT );\r
+ if( xRc <= 0 )\r
+ {\r
+ break;\r
+ }\r
+ pxClient->ulRecvBytes += xRc;\r
+ xWritten = ff_fwrite( pcBuffer, 1, xRc, pxClient->pxWriteHandle );\r
+ FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) NULL, xRc, 0 );\r
+ if( xWritten != xRc )\r
+ {\r
+ xRc = -1;\r
+ /* bHadError: a transfer got aborted because of an error. */\r
+ pxClient->bits1.bHadError = pdTRUE_UNSIGNED;\r
+ break;\r
+ }\r
+ }\r
+ return xRc;\r
+ }\r
+\r
+#else /* ipconfigFTP_ZERO_COPY_ALIGNED_WRITES != 0 */\r
+\r
+ #if !defined( ipconfigFTP_PREFERRED_WRITE_SIZE )\r
+ /* If you store data on flash, it may be profitable to give 'ipconfigFTP_PREFERRED_WRITE_SIZE'\r
+ the same size as the size of the flash' erase blocks, e.g. 4KB */\r
+ #define ipconfigFTP_PREFERRED_WRITE_SIZE 512ul\r
+ #endif\r
+\r
+ static BaseType_t prvStoreFileWork( FTPClient_t *pxClient )\r
+ {\r
+ BaseType_t xRc, xWritten;\r
+\r
+ /* Read from the data socket until all has been read or until a negative\r
+ value is returned. */\r
+ for( ; ; )\r
+ {\r
+ char *pcBuffer;\r
+ UBaseType_t xStatus;\r
+\r
+ /* The "zero-copy" method: */\r
+ xRc = FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) &pcBuffer,\r
+ 0x20000u, FREERTOS_ZERO_COPY | FREERTOS_MSG_DONTWAIT );\r
+\r
+ if( xRc <= 0 )\r
+ {\r
+ /* There are no data or the connection is closed. */\r
+ break;\r
+ }\r
+ xStatus = FreeRTOS_connstatus( pxClient->xTransferSocket );\r
+ if( xStatus != eESTABLISHED )\r
+ {\r
+ /* The connection is not established (any more), therefore\r
+ accept any amount of bytes, probably the last few bytes. */\r
+ }\r
+ else\r
+ {\r
+ if( xRc >= ipconfigFTP_PREFERRED_WRITE_SIZE )\r
+ {\r
+ /* More than a sector to write, round down to a multiple of\r
+ PREFERRED_WRITE_SIZE bytes. */\r
+ xRc = ( xRc / ipconfigFTP_PREFERRED_WRITE_SIZE ) * ipconfigFTP_PREFERRED_WRITE_SIZE;\r
+ }\r
+ else\r
+ {\r
+ const StreamBuffer_t *pxBuffer = FreeRTOS_get_rx_buf( pxClient->xTransferSocket );\r
+ size_t uxSpace = pxBuffer->LENGTH - pxBuffer->uxTail;\r
+\r
+ if( uxSpace >= ipconfigFTP_PREFERRED_WRITE_SIZE )\r
+ {\r
+ /* At this moment there are les than PREFERRED_WRITE_SIZE bytes in the RX\r
+ buffer, but there is space for more. Just return and\r
+ wait for more. */\r
+ xRc = 0;\r
+ }\r
+ else\r
+ {\r
+ /* Now reading beyond the end of the circular buffer,\r
+ use a normal read. */\r
+ pcBuffer = pcFILE_BUFFER;\r
+ xRc = FreeRTOS_recvcount( pxClient->xTransferSocket );\r
+ xRc = ( xRc / ipconfigFTP_PREFERRED_WRITE_SIZE ) * ipconfigFTP_PREFERRED_WRITE_SIZE;\r
+ if( xRc > 0 )\r
+ {\r
+ xRc = FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) pcBuffer,\r
+ sizeof( pcFILE_BUFFER ), FREERTOS_MSG_DONTWAIT );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if( xRc == 0 )\r
+ {\r
+ break;\r
+ }\r
+ pxClient->ulRecvBytes += xRc;\r
+\r
+ xWritten = ff_fwrite( pcBuffer, 1, xRc, pxClient->pxWriteHandle );\r
+ if( pcBuffer != pcFILE_BUFFER )\r
+ {\r
+ FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) NULL, xRc, 0 );\r
+ }\r
+ if( xWritten != xRc )\r
+ {\r
+ xRc = -1;\r
+ /* bHadError: a transfer got aborted because of an error. */\r
+ pxClient->bits1.bHadError = pdTRUE_UNSIGNED;\r
+ break;\r
+ }\r
+ }\r
+ return xRc;\r
+ }\r
+\r
+#endif /* ipconfigFTP_ZERO_COPY_ALIGNED_WRITES */\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+###### # ####### # ###\r
+ # # # # # ## # #\r
+ # # # # # #\r
+ # # #### ###### ### ## ### #### # # #### # # ### # ####\r
+ ###### # # # # # # # # # # # # # ##### # # # #\r
+ # ## ###### # ## # # ###### # # ###### # # # # ######\r
+ # # # # # # # # # # # # # #\r
+ # # # ## # ## # # # ## # # # ## # # # # ##\r
+### ## #### ## #### ##### #### ## #### #### ##### ##### ####\r
+*/\r
+static BaseType_t prvRetrieveFilePrep( FTPClient_t *pxClient, char *pcFileName )\r
+{\r
+BaseType_t xResult = pdTRUE;\r
+size_t uxFileSize;\r
+\r
+ /* Close previous handle (if any) and reset file transfer parameters */\r
+ prvTransferCloseFile( pxClient );\r
+\r
+ xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
+\r
+ pxClient->pxReadHandle = ff_fopen( pxClient->pcFileName, "rb" );\r
+ if( pxClient->pxReadHandle == NULL )\r
+ {\r
+ int iErrno = stdioGET_ERRNO();\r
+ /* "Requested file action not taken". */\r
+ prvSendReply( pxClient->xSocket, REPL_450, 0 );\r
+ FreeRTOS_printf( ("prvRetrieveFilePrep: open '%s': errno %d: %s\n",\r
+ pxClient->pcFileName, iErrno, ( const char * ) strerror( iErrno ) ) );\r
+ uxFileSize = 0ul;\r
+ xResult = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ uxFileSize = pxClient->pxReadHandle->ulFileSize;\r
+ pxClient->uxBytesLeft = uxFileSize;\r
+ if( pxClient->ulRestartOffset != 0ul )\r
+ {\r
+ size_t uxOffset = pxClient->ulRestartOffset;\r
+ int32_t iRc;\r
+\r
+ /* Only use 1 time. */\r
+ pxClient->ulRestartOffset = 0;\r
+\r
+ if( uxOffset < uxFileSize )\r
+ {\r
+ iRc = ff_fseek( pxClient->pxReadHandle, uxOffset, FF_SEEK_SET );\r
+ }\r
+ else\r
+ {\r
+ iRc = -pdFREERTOS_ERRNO_EINVAL;\r
+ }\r
+ if( iRc != 0 )\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "450 Seek invalid %u length %u\r\n", ( unsigned ) uxOffset, ( unsigned ) uxFileSize );\r
+\r
+ /* "Requested file action not taken". */\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+\r
+ FreeRTOS_printf( ( "prvRetrieveFilePrep: create %s: Seek %u length %u\n",\r
+ pxClient->pcFileName, ( unsigned ) uxOffset, ( unsigned ) uxFileSize ) );\r
+\r
+ ff_fclose( pxClient->pxReadHandle );\r
+ pxClient->pxReadHandle = NULL;\r
+ xResult = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ pxClient->uxBytesLeft = uxFileSize - pxClient->ulRestartOffset;\r
+ }\r
+ }\r
+ }\r
+ if( xResult != pdFALSE )\r
+ {\r
+ if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
+ {\r
+ /* True if PASV is used. */\r
+ snprintf( pxClient->pcConnectionAck, sizeof( pxClient->pcConnectionAck ),\r
+ "150%cAccepted data connection from %%xip:%%u\r\n%s",\r
+ pxClient->xTransType == TMODE_ASCII ? '-' : ' ',\r
+ pxClient->xTransType == TMODE_ASCII ? "150 NOTE: ASCII mode requested, but binary mode used\r\n" : "" );\r
+ } else {\r
+ BaseType_t xLength;\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "150%cOpening data connection to %lxip:%u\r\n%s",\r
+ pxClient->xTransType == TMODE_ASCII ? '-' : ' ',\r
+ pxClient->ulClientIP,\r
+ pxClient->usClientPort,\r
+ pxClient->xTransType == TMODE_ASCII ? "150 NOTE: ASCII mode requested, but binary mode used\r\n" : "" );\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ pxClient->pcConnectionAck[ 0 ] = '\0';\r
+ prvTransferStart( pxClient );\r
+ }\r
+\r
+ /* Prepare the ACK which will be sent when all data has been sent. */\r
+ snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ), "%s", REPL_226 );\r
+\r
+ /* To get some statistics about the performance. */\r
+ pxClient->xStartTime = xTaskGetTickCount( );\r
+ if( uxFileSize == 0ul )\r
+ {\r
+ FreeRTOS_shutdown( pxClient->xTransferSocket, FREERTOS_SHUT_RDWR );\r
+ }\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvRetrieveFileWork( FTPClient_t *pxClient )\r
+{\r
+size_t uxSpace;\r
+size_t uxCount, uxItemsRead;\r
+BaseType_t xRc = 0;\r
+BaseType_t xSetEvent = pdFALSE;\r
+\r
+ do\r
+ {\r
+ #if( ipconfigFTP_TX_ZERO_COPY != 0 )\r
+ char *pcBuffer;\r
+ BaseType_t xBufferLength;\r
+ #endif /* ipconfigFTP_TX_ZERO_COPY */\r
+\r
+ /* Take the lesser of the two: tx_space (number of bytes that can be\r
+ queued for transmission) and uxBytesLeft (the number of bytes left to\r
+ read from the file) */\r
+ uxSpace = FreeRTOS_tx_space( pxClient->xTransferSocket );\r
+\r
+ if( uxSpace == 0 )\r
+ {\r
+ FreeRTOS_FD_SET( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE | eSELECT_EXCEPT );\r
+ xRc = FreeRTOS_select( pxClient->pxParent->xSocketSet, 200 );\r
+ uxSpace = FreeRTOS_tx_space( pxClient->xTransferSocket );\r
+ }\r
+\r
+ uxCount = FreeRTOS_min_uint32( pxClient->uxBytesLeft, uxSpace );\r
+\r
+ if( uxCount == 0 )\r
+ {\r
+ break;\r
+ }\r
+\r
+ #if( ipconfigFTP_TX_ZERO_COPY == 0 )\r
+ {\r
+ if( uxCount > sizeof( pcFILE_BUFFER ) )\r
+ {\r
+ uxCount = sizeof( pcFILE_BUFFER );\r
+ }\r
+ uxItemsRead = ff_fread( pcFILE_BUFFER, 1, uxCount, pxClient->pxReadHandle );\r
+ if( uxItemsRead != uxCount )\r
+ {\r
+ FreeRTOS_printf( ( "prvRetrieveFileWork: Got %u Expected %u\n", ( unsigned )uxItemsRead, ( unsigned ) uxCount ) );\r
+ xRc = FreeRTOS_shutdown( pxClient->xTransferSocket, FREERTOS_SHUT_RDWR );\r
+ pxClient->uxBytesLeft = 0u;\r
+ break;\r
+ }\r
+ pxClient->uxBytesLeft -= uxCount;\r
+\r
+ if( pxClient->uxBytesLeft == 0u )\r
+ {\r
+ BaseType_t xTrueValue = 1;\r
+\r
+ FreeRTOS_setsockopt( pxClient->xTransferSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
+ }\r
+\r
+ xRc = FreeRTOS_send( pxClient->xTransferSocket, pcFILE_BUFFER, uxCount, 0 );\r
+ }\r
+ #else /* ipconfigFTP_TX_ZERO_COPY != 0 */\r
+ {\r
+ /* Use zero-copy transmission:\r
+ FreeRTOS_get_tx_head() returns a direct pointer to the TX stream and\r
+ set xBufferLength to know how much space there is left. */\r
+ pcBuffer = ( char * )FreeRTOS_get_tx_head( pxClient->xTransferSocket, &xBufferLength );\r
+ if( ( pcBuffer != NULL ) && ( xBufferLength >= 512 ) )\r
+ {\r
+ /* Will read disk data directly to the TX stream of the socket. */\r
+ uxCount = FreeRTOS_min_uint32( uxCount, ( uint32_t )xBufferLength );\r
+ if( uxCount > ( size_t ) 0x40000u )\r
+ {\r
+ uxCount = ( size_t ) 0x40000u;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* Use the normal file i/o buffer. */\r
+ pcBuffer = pcFILE_BUFFER;\r
+ if( uxCount > sizeof( pcFILE_BUFFER ) )\r
+ {\r
+ uxCount = sizeof( pcFILE_BUFFER );\r
+ }\r
+ }\r
+\r
+ if ( pxClient->uxBytesLeft >= 1024u )\r
+ {\r
+ uxCount &= ~( ( size_t ) 512u - 1u );\r
+ }\r
+\r
+ if( uxCount <= 0u )\r
+ {\r
+ /* Nothing to send after rounding down to a multiple of a sector size. */\r
+ break;\r
+ }\r
+\r
+ uxItemsRead = ff_fread( pcBuffer, 1, uxCount, pxClient->pxReadHandle );\r
+\r
+ if( uxCount != uxItemsRead )\r
+ {\r
+ FreeRTOS_printf( ( "prvRetrieveFileWork: Got %u Expected %u\n", ( unsigned )uxItemsRead, ( unsigned )uxCount ) );\r
+ xRc = FreeRTOS_shutdown( pxClient->xTransferSocket, FREERTOS_SHUT_RDWR );\r
+ pxClient->uxBytesLeft = 0u;\r
+ break;\r
+ }\r
+ pxClient->uxBytesLeft -= uxCount;\r
+\r
+ if( pxClient->uxBytesLeft == 0u )\r
+ {\r
+ BaseType_t xTrueValue = 1;\r
+\r
+ FreeRTOS_setsockopt( pxClient->xTransferSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
+ }\r
+ if( pcBuffer != pcFILE_BUFFER )\r
+ {\r
+ pcBuffer = NULL;\r
+ }\r
+ xRc = FreeRTOS_send( pxClient->xTransferSocket, pcBuffer, uxCount, 0 );\r
+ }\r
+ #endif /* ipconfigFTP_TX_ZERO_COPY */\r
+\r
+ if( xRc < 0 )\r
+ {\r
+ break;\r
+ }\r
+\r
+ pxClient->ulRecvBytes += xRc;\r
+ if( pxClient->uxBytesLeft == 0u )\r
+ {\r
+ break;\r
+ }\r
+ } while( uxCount > 0u );\r
+\r
+ if( xRc < 0 )\r
+ {\r
+ FreeRTOS_printf( ( "prvRetrieveFileWork: already disconnected\n" ) );\r
+ }\r
+ else if( pxClient->uxBytesLeft <= 0u )\r
+ {\r
+ BaseType_t x;\r
+\r
+ for( x = 0; x < 5; x++ )\r
+ {\r
+ xRc = FreeRTOS_recv( pxClient->xTransferSocket, pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), 0 );\r
+ if( xRc < 0 )\r
+ {\r
+ break;\r
+ }\r
+ }\r
+// FreeRTOS_printf( ( "prvRetrieveFileWork: %s all sent: xRc %ld\n", pxClient->pcFileName, xRc ) );\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_FD_SET( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
+ xSetEvent = pdTRUE;\r
+ }\r
+ if( xSetEvent == pdFALSE )\r
+ {\r
+ FreeRTOS_FD_CLR( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
+ }\r
+ return xRc;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+### ##### #### #####\r
+ # # # # # # #\r
+ # # # # #\r
+ # # # #\r
+ # # ## #\r
+ # # # ## #\r
+ # # # # # #\r
+ # # # # # #\r
+####### ##### #### ####\r
+*/\r
+/* Prepare sending a directory LIST */\r
+static BaseType_t prvListSendPrep( FTPClient_t *pxClient )\r
+{\r
+BaseType_t xFindResult;\r
+int iErrorNo;\r
+\r
+ if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
+ {\r
+ /* True if PASV is used */\r
+ snprintf( pxClient->pcConnectionAck, sizeof( pxClient->pcConnectionAck ),\r
+ "150 Accepted data connection from %%xip:%%u\r\n" );\r
+ }\r
+ else\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ /* Here the FTP server is supposed to connect() */\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "150 Opening ASCII mode data connection to for /bin/ls \r\n" );\r
+\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ /* Clear the current connection acknowledge message */\r
+ pxClient->pcConnectionAck[ 0 ] = '\0';\r
+ prvTransferStart( pxClient );\r
+ }\r
+\r
+ pxClient->xDirCount = 0;\r
+ xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pxClient->pcCurrentDir );\r
+\r
+ xFindResult = ff_findfirst( pcNEW_DIR, &pxClient->xFindData );\r
+\r
+ pxClient->bits1.bDirHasEntry = ( xFindResult >= 0 );\r
+\r
+ iErrorNo = stdioGET_ERRNO();\r
+ if( ( xFindResult < 0 ) && ( iErrorNo == pdFREERTOS_ERRNO_ENMFILE ) )\r
+ {\r
+ FreeRTOS_printf( ("prvListSendPrep: Empty directory? (%s)\n", pxClient->pcCurrentDir ) );\r
+ prvSendReply( pxClient->xTransferSocket, "total 0\r\n", 0 );\r
+ pxClient->xDirCount++;\r
+ }\r
+ else if( xFindResult < 0 )\r
+ {\r
+ FreeRTOS_printf( ( "prvListSendPrep: rc = %ld iErrorNo = %d\n", xFindResult, iErrorNo ) );\r
+ prvSendReply( pxClient->xSocket, REPL_451, 0 );\r
+ }\r
+ pxClient->pcClientAck[ 0 ] = '\0';\r
+\r
+ return pxClient->xDirCount;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#define MAX_DIR_LIST_ENTRY_SIZE 256\r
+\r
+static BaseType_t prvListSendWork( FTPClient_t *pxClient )\r
+{\r
+BaseType_t xTxSpace;\r
+\r
+ while( pxClient->bits1.bClientConnected != pdFALSE_UNSIGNED )\r
+ {\r
+ char *pcWritePtr = pcCOMMAND_BUFFER;\r
+ BaseType_t xWriteLength;\r
+\r
+ xTxSpace = FreeRTOS_tx_space( pxClient->xTransferSocket );\r
+\r
+ if( xTxSpace > ( BaseType_t ) sizeof( pcCOMMAND_BUFFER ) )\r
+ {\r
+ xTxSpace = sizeof( pcCOMMAND_BUFFER );\r
+ }\r
+\r
+ while( ( xTxSpace >= MAX_DIR_LIST_ENTRY_SIZE ) && ( pxClient->bits1.bDirHasEntry != pdFALSE_UNSIGNED ) )\r
+ {\r
+ BaseType_t xLength, xEndOfDir;\r
+ int32_t iRc;\r
+ int iErrorNo;\r
+\r
+ xLength = prvGetFileInfoStat( &( pxClient->xFindData.xDirectoryEntry ), pcWritePtr, xTxSpace );\r
+\r
+ pxClient->xDirCount++;\r
+ pcWritePtr += xLength;\r
+ xTxSpace -= xLength;\r
+\r
+ iRc = ff_findnext( &pxClient->xFindData );\r
+ iErrorNo = stdioGET_ERRNO();\r
+\r
+ xEndOfDir = ( iRc < 0 ) && ( iErrorNo == pdFREERTOS_ERRNO_ENMFILE );\r
+\r
+ pxClient->bits1.bDirHasEntry = ( xEndOfDir == pdFALSE ) && ( iRc >= 0 );\r
+\r
+ if( ( iRc < 0 ) && ( xEndOfDir == pdFALSE ) )\r
+ {\r
+ FreeRTOS_printf( ("prvListSendWork: %s (rc %08x)\n",\r
+ ( const char * ) strerror( iErrorNo ),\r
+ ( unsigned )iRc ) );\r
+ }\r
+ }\r
+ xWriteLength = ( BaseType_t ) ( pcWritePtr - pcCOMMAND_BUFFER );\r
+\r
+ if( xWriteLength == 0 )\r
+ {\r
+ break;\r
+ }\r
+\r
+ if( pxClient->bits1.bDirHasEntry == pdFALSE_UNSIGNED )\r
+ {\r
+ uint32_t ulTotalCount;\r
+ uint32_t ulFreeCount;\r
+ uint32_t ulPercentage;\r
+\r
+ ulTotalCount = 1;\r
+ ulFreeCount = ff_diskfree( pxClient->pcCurrentDir, &ulTotalCount );\r
+ ulPercentage = ( uint32_t ) ( ( 100ULL * ulFreeCount + ulTotalCount / 2 ) / ulTotalCount );\r
+\r
+ /* Prepare the ACK which will be sent when all data has been sent. */\r
+ snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ),\r
+ "226-Options: -l\r\n"\r
+ "226-%ld matches total\r\n"\r
+ "226 Total %lu KB (%lu %% free)\r\n",\r
+ pxClient->xDirCount, ulTotalCount /1024, ulPercentage );\r
+ }\r
+\r
+ if( xWriteLength )\r
+ {\r
+ if( pxClient->bits1.bDirHasEntry == pdFALSE_UNSIGNED )\r
+ {\r
+ BaseType_t xTrueValue = 1;\r
+\r
+ FreeRTOS_setsockopt( pxClient->xTransferSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
+ }\r
+\r
+ prvSendReply( pxClient->xTransferSocket, pcCOMMAND_BUFFER, xWriteLength );\r
+ }\r
+\r
+ if( pxClient->bits1.bDirHasEntry == pdFALSE_UNSIGNED )\r
+ {\r
+ prvSendReply( pxClient->xSocket, pxClient->pcClientAck, 0 );\r
+ break;\r
+ }\r
+\r
+ } /* while( pxClient->bits1.bClientConnected ) */\r
+\r
+ return 0;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static const char *pcMonthAbbrev( BaseType_t xMonth )\r
+{\r
+static const char pcMonthList[] = "JanFebMarAprMayJunJulAugSepOctNovDec";\r
+\r
+ if( xMonth < 1 || xMonth > 12 )\r
+ xMonth = 12;\r
+\r
+ return pcMonthList + 3 * ( xMonth - 1 );\r
+};\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvGetFileInfoStat( FF_DirEnt_t *pxEntry, char *pcLine, BaseType_t xMaxLength )\r
+{\r
+ char date[ 16 ];\r
+ char mode[ 11 ] = "----------";\r
+ BaseType_t st_nlink = 1;\r
+ const char user[ 9 ] = "freertos";\r
+ const char group[ 8 ] = "plusfat";\r
+\r
+/*\r
+ * Creates a unix-style listing, understood by most FTP clients:\r
+ *\r
+ * -rw-rw-r-- 1 freertos FreeRTOS+FAT 10564588 Sep 01 00:17 03. Metaharmoniks - Star (Instrumental).mp3\r
+ * -rw-rw-r-- 1 freertos FreeRTOS+FAT 19087839 Sep 01 00:17 04. Simon Le Grec - Dimitri (Wherever U Are) (Cosmos Mix).mp3\r
+ * -rw-rw-r-- 1 freertos FreeRTOS+FAT 11100621 Sep 01 00:16 05. D-Chill - Mistake (feat. Katy Blue).mp3\r
+ */\r
+\r
+ #if ( ffconfigTIME_SUPPORT == 1 )\r
+ const FF_SystemTime_t *pxCreateTime = &( pxEntry->xCreateTime );\r
+ #else\r
+ #warning Do not use this.\r
+ FF_SystemTime_t xCreateTime;\r
+ const FF_SystemTime_t *pxCreateTime = &xCreateTime;\r
+ #endif\r
+ size_t ulSize = ( size_t )pxEntry->ulFileSize;\r
+ const char *pcFileName = pxEntry->pcFileName;\r
+\r
+ mode[ 0 ] = ( ( pxEntry->ucAttrib & FF_FAT_ATTR_DIR ) != 0 ) ? 'd' : '-';\r
+ #if( ffconfigDEV_SUPPORT != 0 )\r
+ {\r
+ if( ( pxEntry->ucAttrib & FF_FAT_ATTR_DIR ) == 0 )\r
+ {\r
+ switch( pxEntry->ucIsDeviceDir )\r
+ {\r
+ case FF_DEV_CHAR_DEV:\r
+ mode[ 0 ] = 'c';\r
+ break;\r
+ case FF_DEV_BLOCK_DEV:\r
+ mode[ 0 ] = 'b';\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ #endif /* ffconfigDEV_SUPPORT != 0 */\r
+\r
+ mode[ 1 ] = 'r'; /* Owner. */\r
+ mode[ 2 ] = ( ( pxEntry->ucAttrib & FF_FAT_ATTR_READONLY ) != 0 ) ? '-' : 'w';\r
+ mode[ 3 ] = '-'; /* x for executable. */\r
+\r
+ mode[ 4 ] = 'r'; /* group. */\r
+ mode[ 5 ] = ( ( pxEntry->ucAttrib & FF_FAT_ATTR_READONLY ) != 0 ) ? '-' : 'w';\r
+ mode[ 6 ] = '-'; /* x for executable. */\r
+\r
+ mode[ 7 ] = 'r'; /* world. */\r
+ mode[ 8 ] = '-';\r
+ mode[ 9 ] = '-'; /* x for executable. */\r
+\r
+ if( pxCreateTime->Month && pxCreateTime->Day )\r
+ {\r
+ snprintf( date, sizeof( date ), "%-3.3s %02d %02d:%02d",\r
+ pcMonthAbbrev( pxCreateTime->Month ),\r
+ pxCreateTime->Day,\r
+ pxCreateTime->Hour,\r
+ pxCreateTime->Minute );\r
+ }\r
+ else\r
+ {\r
+ snprintf (date, sizeof( date ), "Jan 01 1970");\r
+ }\r
+ return snprintf( pcLine, xMaxLength, "%s %3ld %-4s %-4s %8d %12s %s\r\n",\r
+ mode, st_nlink, user, group, ( int ) ulSize, date, pcFileName );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ #### # # #####\r
+ # # # # # #\r
+# # # # # #\r
+# # # # # #\r
+# # # # # #\r
+# # # # # #\r
+# # ## ## # #\r
+ # # ## ## # #\r
+ #### ## ## #####\r
+*/\r
+static BaseType_t prvChangeDir( FTPClient_t *pxClient, char *pcDirectory )\r
+{\r
+BaseType_t xResult;\r
+BaseType_t xIsRootDir, xLength, xValid;\r
+BaseType_t xIsDotDir = 0;\r
+\r
+ if( pcDirectory[ 0 ] == '.' )\r
+ {\r
+ if( ( pcDirectory[ 1 ] == '.' ) &&\r
+ ( pcDirectory[ 2 ] == '\0' ) )\r
+ {\r
+ xIsDotDir = 2;\r
+ }\r
+ else if( pcDirectory[ 1 ] == '\0' )\r
+ {\r
+ xIsDotDir = 1;\r
+ }\r
+ }\r
+\r
+ if( xIsDotDir != 0 )\r
+ {\r
+ strcpy( pcFILE_BUFFER, pxClient->pcCurrentDir );\r
+\r
+ if( pcDirectory[ 1 ] == '.' )\r
+ {\r
+ char *p = strrchr( pcFILE_BUFFER, '/' );\r
+ if( p != NULL )\r
+ {\r
+ if( p == pcFILE_BUFFER )\r
+ {\r
+ p[ 1 ] = '\0';\r
+ }\r
+ else\r
+ {\r
+ p[ 0 ] = '\0';\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if(pcDirectory[ 0 ] != '/' )\r
+ {\r
+ BaseType_t xCurLength;\r
+\r
+ xCurLength = strlen( pxClient->pcCurrentDir );\r
+ snprintf( pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), "%s%s%s",\r
+ pxClient->pcCurrentDir,\r
+ pxClient->pcCurrentDir[ xCurLength - 1 ] == '/' ? "" : "/",\r
+ pcDirectory );\r
+ }\r
+ else\r
+ {\r
+ snprintf( pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), "%s", pcDirectory );\r
+ }\r
+ }\r
+\r
+ xIsRootDir = ( pcFILE_BUFFER[ 0 ] == '/' ) && ( pcFILE_BUFFER[ 1 ] == '\0' );\r
+ xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pcFILE_BUFFER );\r
+\r
+ if( ( ( xIsRootDir == pdFALSE ) || ( FF_FS_Count() == 0 ) ) && ( ff_finddir( pcNEW_DIR ) == pdFALSE ) )\r
+ {\r
+ xValid = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ xValid = pdTRUE;\r
+ }\r
+\r
+ if( xValid == pdFALSE )\r
+ {\r
+ /* Get the directory cluster, if it exists. */\r
+ FreeRTOS_printf( ("FTP: chdir \"%s\": No such dir\n", pcNEW_DIR ) );\r
+ //#define REPL_550 "550 Requested action not taken.\r\n"\r
+ //550 /home/hein/arch/h8300: No such file or directory\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "550 %s: No such file or directory\r\n",\r
+ pcNEW_DIR );\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ xResult = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ memcpy( pxClient->pcCurrentDir, pcNEW_DIR, sizeof( pxClient->pcCurrentDir ) );\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "250 Changed to %s\r\n", pcNEW_DIR );\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ xResult = pdTRUE;\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+###### ## # ####### ######\r
+ # # ## # # ## # #\r
+ # # ## # # # # #\r
+ # # ### # # # # #\r
+ ###### # ## # ##### ######\r
+ # ## # ## # # # # ##\r
+ # # # ### # # #\r
+ # # # ## # # #\r
+### ## # ## #### ### ##\r
+*/\r
+static BaseType_t prvRenameFrom( FTPClient_t *pxClient, const char *pcFileName )\r
+{\r
+const char *myReply;\r
+FF_FILE *fh;\r
+\r
+ xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
+\r
+ myReply = NULL;\r
+\r
+ fh = ff_fopen( pxClient->pcFileName, "rb" );\r
+\r
+ if( fh != NULL )\r
+ {\r
+ ff_fclose( fh );\r
+ /* REPL_350; "350 Requested file action pending further information." */\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "350 Rename '%s' ...\r\n", pxClient->pcFileName );\r
+ myReply = pcCOMMAND_BUFFER;\r
+ pxClient->bits.bInRename = pdTRUE_UNSIGNED;\r
+ }\r
+ else if( stdioGET_ERRNO() == pdFREERTOS_ERRNO_EISDIR )\r
+ {\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "350 Rename directory '%s' ...\r\n", pxClient->pcFileName );\r
+ myReply = pcCOMMAND_BUFFER;\r
+ pxClient->bits.bInRename = pdTRUE_UNSIGNED;\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_printf( ("ftp::renameFrom[%s]\n%s\n", pxClient->pcFileName, strerror( stdioGET_ERRNO() ) ) );\r
+ myReply = REPL_451; /* "451 Requested action aborted. Local error in processing." */\r
+ }\r
+ if( myReply )\r
+ {\r
+ prvSendReply( pxClient->xSocket, myReply, 0 );\r
+ }\r
+\r
+ return pdTRUE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+###### ## # ##### ###\r
+ # # ## # # # # ## ##\r
+ # # ## # # ## ##\r
+ # # ### # # # #\r
+ ###### # ## # # # #\r
+ # ## # ## # # # #\r
+ # # # ### # ## ##\r
+ # # # ## # ## ##\r
+### ## # ## #### ###\r
+*/\r
+static BaseType_t prvRenameTo( FTPClient_t *pxClient, const char *pcFileName )\r
+{\r
+const char *myReply = NULL;\r
+int iResult;\r
+\r
+ xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pcFileName );\r
+\r
+ /* FreeRTOS+FAT rename has an extra parameter: "remove target if already\r
+ exists". */\r
+ iResult = ff_rename( pxClient->pcFileName, pcNEW_DIR, pdFALSE );\r
+\r
+ if( iResult < 0 )\r
+ {\r
+ iResult = stdioGET_ERRNO();\r
+ }\r
+ else\r
+ {\r
+ iResult = 0;\r
+ }\r
+\r
+ switch( iResult )\r
+ {\r
+ case 0:\r
+ FreeRTOS_printf( ( "ftp::renameTo[%s,%s]: Ok\n", pxClient->pcFileName, pcNEW_DIR ) );\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "250 Rename successful to '%s'\r\n", pcNEW_DIR );\r
+ myReply = pcCOMMAND_BUFFER;\r
+ break;\r
+ case pdFREERTOS_ERRNO_EEXIST:\r
+ /* the destination file already exists.\r
+ "450 Requested file action not taken.\r\n"*/\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "450 Already exists '%s'\r\n", pcNEW_DIR );\r
+ myReply = pcCOMMAND_BUFFER;\r
+ break;\r
+ case pdFREERTOS_ERRNO_EIO: /* FF_ERR_FILE_COULD_NOT_CREATE_DIRENT */\r
+ /* if dirent creation failed (fatal error!).\r
+ "553 Requested action not taken.\r\n" */\r
+ FreeRTOS_printf( ("ftp::renameTo[%s,%s]: Error creating DirEnt\n",\r
+ pxClient->pcFileName, pcNEW_DIR ) );\r
+ myReply = REPL_553;\r
+ break;\r
+ case pdFREERTOS_ERRNO_ENXIO:\r
+ case pdFREERTOS_ERRNO_ENOENT:\r
+ /* if the source file was not found.\r
+ "450 Requested file action not taken.\r\n" */\r
+ snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "450 No such file '%s'\r\n", pxClient->pcFileName );\r
+ myReply = pcCOMMAND_BUFFER;\r
+ break;\r
+ default:\r
+ FreeRTOS_printf( ("ftp::renameTo[%s,%s]: %s\n", pxClient->pcFileName, pcNEW_DIR,\r
+ (const char*)strerror( stdioGET_ERRNO() ) ) );\r
+ myReply = REPL_451; /* "451 Requested action aborted. Local error in processing." */\r
+ break;\r
+ }\r
+ prvSendReply( pxClient->xSocket, myReply, 0 );\r
+\r
+ return pdTRUE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ #### #\r
+# # # #\r
+# # #\r
+# ### ###### ####\r
+ ## # # # #\r
+ ## # # ######\r
+# # # # #\r
+# # # # ## # ##\r
+ #### ##### ## ####\r
+*/\r
+static BaseType_t prvSiteCmd( FTPClient_t *pxClient, char *pcRestCommand )\r
+{\r
+ ( void ) pxClient;\r
+ ( void ) pcRestCommand;\r
+\r
+ return 0;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+##### ###\r
+ # # # #\r
+ # # # #\r
+ # # #### # #### ###### ####\r
+ # # # # # # # # # #\r
+ # # ###### # ###### # ######\r
+ # # # # # # #\r
+ # # # ## # # ## # ## # ##\r
+##### #### ##### #### ## ####\r
+*/\r
+static BaseType_t prvDeleteFile( FTPClient_t *pxClient, char *pcFileName )\r
+{\r
+BaseType_t xResult, xLength;\r
+int32_t iRc;\r
+int iErrorNo;\r
+\r
+ /* DELE: Delete a file. */\r
+ xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
+\r
+ iRc = ff_remove( pxClient->pcFileName );\r
+\r
+ if (iRc >= 0 )\r
+ {\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "250 File \"%s\" removed\r\n", pxClient->pcFileName );\r
+ xResult = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ const char *errMsg = "other error";\r
+\r
+ iErrorNo = stdioGET_ERRNO();\r
+ switch( iErrorNo )\r
+ { /*_RB_ What do these negative numbers relate to? */\r
+ case pdFREERTOS_ERRNO_ENOENT: errMsg = "No such file"; break; /* -31 File was not found. */\r
+ case pdFREERTOS_ERRNO_EALREADY: errMsg = "File still open"; break; /* -30 File is in use. */\r
+ case pdFREERTOS_ERRNO_EISDIR: errMsg = "Is a dir"; break; /* -32 Tried to FF_Open() a Directory. */\r
+ case pdFREERTOS_ERRNO_EROFS: errMsg = "Read-only"; break; /* -33 Tried to FF_Open() a file marked read only. */\r
+ case pdFREERTOS_ERRNO_ENOTDIR: errMsg = "Invalid path"; break; /* -34 The path of the file was not found. */\r
+ }\r
+ FreeRTOS_printf( ( "ftp::delFile: '%s' because %s\n",\r
+ pxClient->pcFileName, strerror( iErrorNo ) ) );\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "521-\"%s\" %s;\r\n"\r
+ "521 taking no action\r\n",\r
+ pxClient->pcFileName, errMsg );\r
+\r
+ xResult = pdFALSE;\r
+ }\r
+\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ #### # #####\r
+# # # # # #\r
+# # # # #\r
+# ### ###### #### # # #### ###### ####\r
+ ## # # # # # # # # # # #\r
+ ## # # ###### # # ##### # ######\r
+# # # # # # # # # # #\r
+# # # # # ## # # # # # ## # ##\r
+ #### ##### ###### #### ##### ### ## ## ####\r
+*/\r
+static BaseType_t prvSizeDateFile( FTPClient_t *pxClient, char *pcFileName, BaseType_t xSendDate )\r
+{\r
+BaseType_t xResult = pdFALSE;\r
+char *pcPtr;\r
+\r
+ /* SIZE: get the size of a file (xSendDate = 0)\r
+ MDTM: get data and time properties (xSendDate = 1) */\r
+ xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
+\r
+ pcPtr = strrchr( pxClient->pcFileName, '/' );\r
+\r
+ if( ( pcPtr != NULL ) && ( pcPtr[ 1 ] != '\0' ) )\r
+ {\r
+ FF_Stat_t xStatBuf;\r
+ int32_t iRc = ff_stat( pxClient->pcFileName, &xStatBuf );\r
+ if (iRc < 0 )\r
+ FreeRTOS_printf( ("In %s: %s\n", pxClient->pcFileName,\r
+ ( const char* )strerror( stdioGET_ERRNO() ) ) );\r
+\r
+ if( iRc == 0 )\r
+ {\r
+ BaseType_t xLength;\r
+ /* "YYYYMMDDhhmmss" */\r
+ if( xSendDate != pdFALSE )\r
+ {\r
+ #if( ffconfigTIME_SUPPORT != 0 )\r
+ {\r
+ FF_TimeStruct_t tmStruct;\r
+ time_t secs = xStatBuf.st_mtime;\r
+ FreeRTOS_gmtime_r( &secs, &tmStruct );\r
+\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 %04u%02u%02u%02u%02u%02u\r\n",\r
+ tmStruct.tm_year + 1900,\r
+ tmStruct.tm_mon+1,\r
+ tmStruct.tm_mday,\r
+ tmStruct.tm_hour,\r
+ tmStruct.tm_min,\r
+ tmStruct.tm_sec );\r
+ }\r
+ #else\r
+ {\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 19700101000000\r\n",\r
+ }\r
+ #endif\r
+ }\r
+ else\r
+ {\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 %lu\r\n", xStatBuf.st_size );\r
+ }\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+ xResult = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_printf( ("ftp::sizeDateFile: No such file %s\n", pxClient->pcFileName ) );\r
+ }\r
+ } else {\r
+ FreeRTOS_printf( ("ftp::sizeDateFile: Invalid file name: %s ?\n", pxClient->pcFileName ) );\r
+ }\r
+ if( xResult == pdFALSE )\r
+ {\r
+ prvSendReply( pxClient->xSocket, REPL_450, 0 ); /* "Requested file action not taken". */\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+## ## ## ## ##### ###### ## ## #####\r
+### ### # # # # # # ### ### # #\r
+# ### # # # # # # # # ### # # #\r
+# # # # # # # # # # # # # #\r
+# # # #### # # ###### # # # # #\r
+# # # # # # # ## # # # #\r
+# # # # # # # # # # # #\r
+# # # # # # # # # # # #\r
+# # ### ## ##### ### ## # # #####\r
+*/\r
+static BaseType_t prvMakeRemoveDir( FTPClient_t *pxClient, const char *pcDirectory, BaseType_t xDoRemove )\r
+{\r
+BaseType_t xResult;\r
+BaseType_t xLength;\r
+int32_t iRc;\r
+int iErrorNo;\r
+\r
+ /* MKD: Make / create a directory (xDoRemove = 0)\r
+ RMD: Remove a directory (xDoRemove = 1) */\r
+ xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcDirectory );\r
+\r
+ if( xDoRemove )\r
+ {\r
+ iRc = ff_rmdir( pxClient->pcFileName );\r
+ }\r
+ else\r
+ {\r
+ #if( ffconfigMKDIR_RECURSIVE != 0 )\r
+ {\r
+ iRc = ff_mkdir( pxClient->pcFileName, pdFALSE );\r
+ }\r
+ #else\r
+ {\r
+ iRc = ff_mkdir( pxClient->pcFileName );\r
+ }\r
+ #endif /* ffconfigMKDIR_RECURSIVE */\r
+ }\r
+ xResult = pdTRUE;\r
+\r
+ if( iRc >= 0 )\r
+ {\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "257 \"%s\" directory %s\r\n",\r
+ pxClient->pcFileName, xDoRemove ? "removed" : "created" );\r
+ }\r
+ else\r
+ {\r
+ const char *errMsg = "other error";\r
+ BaseType_t xFTPCode = 521;\r
+\r
+ xResult = pdFALSE;\r
+ iErrorNo = stdioGET_ERRNO();\r
+ switch( iErrorNo )\r
+ {\r
+ case pdFREERTOS_ERRNO_EEXIST: errMsg = "Directory already exists"; break;\r
+ case pdFREERTOS_ERRNO_ENOTDIR: errMsg = "Invalid path"; break; /* -34 The path of the file was not found. *//*_RB_ As before, what do these negative numbers relate to? */\r
+ case pdFREERTOS_ERRNO_ENOTEMPTY:errMsg = "Dir not empty"; break;\r
+ case pdFREERTOS_ERRNO_EROFS: errMsg = "Read-only"; break; /* -33 Tried to FF_Open() a file marked read only. */\r
+ default: errMsg = strerror( iErrorNo ); break;\r
+ }\r
+ if( iErrorNo == pdFREERTOS_ERRNO_ENOSPC )\r
+ {\r
+ xFTPCode = 552;\r
+ }\r
+ xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
+ "%ld-\"%s\" %s;\r\n"\r
+ "%ld taking no action\r\n",\r
+ xFTPCode, pxClient->pcFileName, errMsg, xFTPCode );\r
+ FreeRTOS_printf( ( "%sdir '%s': %s\n", xDoRemove ? "rm" : "mk", pxClient->pcFileName, errMsg ) );\r
+ }\r
+ prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static portINLINE BaseType_t IsDigit( char cChar )\r
+{\r
+BaseType_t xResult;\r
+\r
+ if( cChar >= '0' && cChar <= '9' )\r
+ {\r
+ xResult = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ xResult = pdFALSE;\r
+ }\r
+ return xResult;\r
+}\r
+\r
+static BaseType_t prvSendReply( Socket_t xSocket, const char *pcBuffer, BaseType_t xLength )\r
+{\r
+BaseType_t xResult;\r
+\r
+ if( xLength == 0 )\r
+ {\r
+ xLength = strlen( pcBuffer );\r
+ }\r
+ xResult = FreeRTOS_send( xSocket, ( const void * )pcBuffer, ( size_t ) xLength, 0 );\r
+ if( IsDigit( ( int ) pcBuffer[ 0 ] ) &&\r
+ IsDigit( ( int ) pcBuffer[ 1 ] ) &&\r
+ IsDigit( ( int ) pcBuffer[ 2 ] ) &&\r
+ IsDigit( ( int ) pcBuffer[ 3 ] ) )\r
+ {\r
+ const char *last = pcBuffer + strlen( pcBuffer );\r
+ int iLength;\r
+ while( ( last > pcBuffer ) && ( ( last[ -1 ] == ftpASCII_CR ) || ( last[ -1 ] == ftpASCII_LF ) ) )\r
+ {\r
+ last--;\r
+ }\r
+ iLength = ( int )( last - pcBuffer );\r
+ FF_PRINTF( " %-*.*s", iLength, iLength, pcBuffer );\r
+ }\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )\r
+\r
+ /*\r
+ * The following function is called for every file received:\r
+ * void vApplicationFTPReceivedHook( pcFileName, ulSize, pxFTPClient );\r
+ * This callback function may do a callback to vFTPReplyMessage() to send messages\r
+ * to the FTP client like:\r
+ * 200-Please wait: Received new firmware\r
+ * 200-Please wait: Please wait a few seconds for reboot\r
+ */\r
+ void vFTPReplyMessage( struct xFTP_CLIENT *pxFTPClient, const char *pcMessage )\r
+ {\r
+ if( ( pxFTPClient != NULL ) && ( pxFTPClient->xSocket != NULL ) )\r
+ {\r
+ prvSendReply( pxFTPClient->xSocket, pcMessage, 0 );\r
+ }\r
+ }\r
+ /*-----------------------------------------------------------*/\r
+\r
+#endif /* ipconfigFTP_HAS_RECEIVED_HOOK != 0 */\r
+\r
+/*\r
+ * Some explanation:\r
+ * The FTP client may send: "DELE readme.txt"\r
+ * Here the complete path is constructed consisting of 3 parts:\r
+ *\r
+ * pxClient->pcRootDir + pxClient->pcCurrentDir + pcFileName\r
+ *\r
+ * 'pcCurrentDir' will not be applied for an absolute path like in "DELE /.htaccess"\r
+ */\r
+BaseType_t xMakeAbsolute( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName )\r
+{\r
+BaseType_t xLength = strlen( pxClient->pcRootDir );\r
+\r
+ if( pcFileName[ 0 ] != '/' )\r
+ {\r
+ char *pcNewDirBuffer = pcNEW_DIR;\r
+ BaseType_t xCurLength;\r
+\r
+ xCurLength = strlen( pxClient->pcCurrentDir );\r
+ if( pcBuffer == pcNEW_DIR )\r
+ {\r
+ /* In one call, the result already goes into pcNEW_DIR.\r
+ Use pcFILE_BUFFER in that case */\r
+ pcNewDirBuffer = pcFILE_BUFFER;\r
+ }\r
+ snprintf( pcNewDirBuffer, sizeof( pcNEW_DIR ), "%s%s%s",\r
+ pxClient->pcCurrentDir,\r
+ pxClient->pcCurrentDir[ xCurLength - 1 ] == '/' ? "" : "/",\r
+ pcFileName );\r
+ pcFileName = pcNewDirBuffer;\r
+ }\r
+ if( strncasecmp( pxClient->pcRootDir, pcFileName, xLength ) == 0 )\r
+ {\r
+ xLength = snprintf( pcBuffer, xBufferLength, "%s", pcFileName );\r
+ }\r
+ else\r
+ {\r
+ xLength = snprintf( pcBuffer, xBufferLength, "%s/%s",\r
+ pxClient->pcRootDir,\r
+ pcFileName[ 0 ] == '/' ? ( pcFileName + 1 ) : pcFileName );\r
+ }\r
+\r
+ #if( ipconfigFTP_FS_USES_BACKSLAH == 1 )\r
+ for( pcPtr = pcBuffer; *pcPtr; pcPtr++ )\r
+ {\r
+ if( pcPtr[ 0 ] == '/' )\r
+ {\r
+ pcPtr[ 0 ] = '\\';\r
+ }\r
+ }\r
+ #endif\r
+\r
+ return xLength;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+BaseType_t xMakeRelative( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName )\r
+{\r
+BaseType_t xLength = strlen( pxClient->pcRootDir );\r
+\r
+ if( strncasecmp ( pxClient->pcRootDir, pcFileName, xLength ) == 0 )\r
+ {\r
+ xLength = snprintf( pcBuffer, xBufferLength, "%s", pcFileName + xLength );\r
+ }\r
+ else\r
+ {\r
+ xLength = snprintf( pcBuffer, xBufferLength, "%s", pcFileName );\r
+ }\r
+\r
+ return xLength;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#endif /* ipconfigUSE_FTP */\r
+\r
+\r
+\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+\r
+#include "FreeRTOS_HTTP_commands.h"\r
+\r
+const struct xWEB_COMMAND xWebCommands[ WEB_CMD_COUNT ] =\r
+{\r
+ { 3, "GET", ECMD_GET },\r
+ { 4, "HEAD", ECMD_HEAD },\r
+ { 4, "POST", ECMD_POST },\r
+ { 3, "PUT", ECMD_PUT },\r
+ { 6, "DELETE", ECMD_DELETE },\r
+ { 5, "TRACE", ECMD_TRACE },\r
+ { 7, "OPTIONS", ECMD_OPTIONS },\r
+ { 7, "CONNECT", ECMD_CONNECT },\r
+ { 5, "PATCH", ECMD_PATCH },\r
+ { 4, "UNKN", ECMD_UNK },\r
+};\r
+\r
+const char *webCodename (int aCode)\r
+{\r
+ switch (aCode) {\r
+ case WEB_REPLY_OK: // = 200,\r
+ return "OK";\r
+ case WEB_NO_CONTENT: // 204\r
+ return "No content";\r
+ case WEB_BAD_REQUEST: // = 400,\r
+ return "Bad request";\r
+ case WEB_UNAUTHORIZED: // = 401,\r
+ return "Authorization Required";\r
+ case WEB_NOT_FOUND: // = 404,\r
+ return "Not Found";\r
+ case WEB_GONE: // = 410,\r
+ return "Done";\r
+ case WEB_PRECONDITION_FAILED: // = 412,\r
+ return "Precondition Failed";\r
+ case WEB_INTERNAL_SERVER_ERROR: // = 500,\r
+ return "Internal Server Error";\r
+ }\r
+ return "Unknown";\r
+}\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* FreeRTOS+TCP includes. */\r
+#include "FreeRTOS_IP.h"\r
+#include "FreeRTOS_Sockets.h"\r
+\r
+/* FreeRTOS Protocol includes. */\r
+#include "FreeRTOS_HTTP_commands.h"\r
+#include "FreeRTOS_TCP_server.h"\r
+#include "FreeRTOS_server_private.h"\r
+\r
+/* Remove the whole file if HTTP is not supported. */\r
+#if( ipconfigUSE_HTTP == 1 )\r
+\r
+/* FreeRTOS+FAT includes. */\r
+#include "ff_stdio.h"\r
+\r
+#ifndef HTTP_SERVER_BACKLOG\r
+ #define HTTP_SERVER_BACKLOG ( 12 )\r
+#endif\r
+\r
+#ifndef USE_HTML_CHUNKS\r
+ #define USE_HTML_CHUNKS ( 0 )\r
+#endif\r
+\r
+#if !defined( ARRAY_SIZE )\r
+ #define ARRAY_SIZE(x) ( BaseType_t ) (sizeof( x ) / sizeof( x )[ 0 ] )\r
+#endif\r
+\r
+/* Some defines to make the code more readbale */\r
+#define pcCOMMAND_BUFFER pxClient->pxParent->pcCommandBuffer\r
+#define pcNEW_DIR pxClient->pxParent->pcNewDir\r
+#define pcFILE_BUFFER pxClient->pxParent->pcFileBuffer\r
+\r
+#ifndef ipconfigHTTP_REQUEST_CHARACTER\r
+ #define ipconfigHTTP_REQUEST_CHARACTER '?'\r
+#endif\r
+\r
+/*_RB_ Need comment block, although fairly self evident. */\r
+static void prvFileClose( HTTPClient_t *pxClient );\r
+static BaseType_t prvProcessCmd( HTTPClient_t *pxClient, BaseType_t xIndex );\r
+static const char *pcGetContentsType( const char *apFname );\r
+static BaseType_t prvOpenURL( HTTPClient_t *pxClient );\r
+static BaseType_t prvSendFile( HTTPClient_t *pxClient );\r
+static BaseType_t prvSendReply( HTTPClient_t *pxClient, BaseType_t xCode );\r
+\r
+static const char pcEmptyString[1] = { '\0' };\r
+\r
+typedef struct xTYPE_COUPLE\r
+{\r
+ const char *pcExtension;\r
+ const char *pcType;\r
+} TypeCouple_t;\r
+\r
+static TypeCouple_t pxTypeCouples[ ] =\r
+{\r
+ { "html", "text/html" },\r
+ { "css", "text/css" },\r
+ { "js", "text/javascript" },\r
+ { "png", "image/png" },\r
+ { "jpg", "image/jpeg" },\r
+ { "gif", "image/gif" },\r
+ { "txt", "text/plain" },\r
+ { "mp3", "audio/mpeg3" },\r
+ { "wav", "audio/wav" },\r
+ { "flac", "audio/ogg" },\r
+ { "pdf", "application/pdf" },\r
+ { "ttf", "application/x-font-ttf" },\r
+ { "ttc", "application/x-font-ttf" }\r
+};\r
+\r
+void vHTTPClientDelete( TCPClient_t *pxTCPClient )\r
+{\r
+HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;\r
+\r
+ /* This HTTP client stops, close / release all resources. */\r
+ if( pxClient->xSocket != FREERTOS_NO_SOCKET )\r
+ {\r
+ FreeRTOS_FD_CLR( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_ALL );\r
+ FreeRTOS_closesocket( pxClient->xSocket );\r
+ pxClient->xSocket = FREERTOS_NO_SOCKET;\r
+ }\r
+ prvFileClose( pxClient );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvFileClose( HTTPClient_t *pxClient )\r
+{\r
+ if( pxClient->pxFileHandle != NULL )\r
+ {\r
+ FreeRTOS_printf( ( "Closing file: %s\n", pxClient->pcCurrentFilename ) );\r
+ ff_fclose( pxClient->pxFileHandle );\r
+ pxClient->pxFileHandle = NULL;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvSendReply( HTTPClient_t *pxClient, BaseType_t xCode )\r
+{\r
+struct xTCP_SERVER *pxParent = pxClient->pxParent;\r
+BaseType_t xRc;\r
+\r
+ /* A normal command reply on the main socket (port 21). */\r
+ char *pcBuffer = pxParent->pcFileBuffer;\r
+\r
+ xRc = snprintf( pcBuffer, sizeof( pxParent->pcFileBuffer ),\r
+ "HTTP/1.1 %d %s\r\n"\r
+#if USE_HTML_CHUNKS\r
+ "Transfer-Encoding: chunked\r\n"\r
+#endif\r
+ "Content-Type: %s\r\n"\r
+ "Connection: keep-alive\r\n"\r
+ "%s\r\n",\r
+ ( int ) xCode,\r
+ webCodename (xCode),\r
+ pxParent->pcContentsType[0] ? pxParent->pcContentsType : "text/html",\r
+ pxParent->pcExtraContents );\r
+\r
+ pxParent->pcContentsType[0] = '\0';\r
+ pxParent->pcExtraContents[0] = '\0';\r
+\r
+ xRc = FreeRTOS_send( pxClient->xSocket, ( const void * ) pcBuffer, xRc, 0 );\r
+ pxClient->bits.bReplySent = pdTRUE_UNSIGNED;\r
+\r
+ return xRc;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvSendFile( HTTPClient_t *pxClient )\r
+{\r
+size_t uxSpace;\r
+size_t uxCount;\r
+BaseType_t xRc = 0;\r
+\r
+ if( pxClient->bits.bReplySent == pdFALSE_UNSIGNED )\r
+ {\r
+ pxClient->bits.bReplySent = pdTRUE_UNSIGNED;\r
+\r
+ strcpy( pxClient->pxParent->pcContentsType, pcGetContentsType( pxClient->pcCurrentFilename ) );\r
+ snprintf( pxClient->pxParent->pcExtraContents, sizeof( pxClient->pxParent->pcExtraContents ),\r
+ "Content-Length: %d\r\n", ( int ) pxClient->uxBytesLeft );\r
+\r
+ /* "Requested file action OK". */\r
+ xRc = prvSendReply( pxClient, WEB_REPLY_OK );\r
+ }\r
+\r
+ if( xRc >= 0 ) do\r
+ {\r
+ uxSpace = FreeRTOS_tx_space( pxClient->xSocket );\r
+\r
+ if( pxClient->uxBytesLeft < uxSpace )\r
+ {\r
+ uxCount = pxClient->uxBytesLeft;\r
+ }\r
+ else\r
+ {\r
+ uxCount = uxSpace;\r
+ }\r
+\r
+ if( uxCount > 0u )\r
+ {\r
+ if( uxCount > sizeof( pxClient->pxParent->pcFileBuffer ) )\r
+ {\r
+ uxCount = sizeof( pxClient->pxParent->pcFileBuffer );\r
+ }\r
+ ff_fread( pxClient->pxParent->pcFileBuffer, 1, uxCount, pxClient->pxFileHandle );\r
+ pxClient->uxBytesLeft -= uxCount;\r
+\r
+ xRc = FreeRTOS_send( pxClient->xSocket, pxClient->pxParent->pcFileBuffer, uxCount, 0 );\r
+ if( xRc < 0 )\r
+ {\r
+ break;\r
+ }\r
+ }\r
+ } while( uxCount > 0u );\r
+\r
+ if( pxClient->uxBytesLeft == 0u )\r
+ {\r
+ /* Writing is ready, no need for further 'eSELECT_WRITE' events. */\r
+ FreeRTOS_FD_CLR( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
+ prvFileClose( pxClient );\r
+ }\r
+ else\r
+ {\r
+ /* Wake up the TCP task as soon as this socket may be written to. */\r
+ FreeRTOS_FD_SET( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
+ }\r
+\r
+ return xRc;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvOpenURL( HTTPClient_t *pxClient )\r
+{\r
+BaseType_t xRc;\r
+char pcSlash[ 2 ];\r
+\r
+ pxClient->bits.ulFlags = 0;\r
+\r
+ #if( ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK != 0 )\r
+ {\r
+ if( strchr( pxClient->pcUrlData, ipconfigHTTP_REQUEST_CHARACTER ) != NULL )\r
+ {\r
+ size_t xResult;\r
+\r
+ xResult = uxApplicationHTTPHandleRequestHook( pxClient->pcUrlData, pxClient->pcCurrentFilename, sizeof( pxClient->pcCurrentFilename ) );\r
+ if( xResult > 0 )\r
+ {\r
+ strcpy( pxClient->pxParent->pcContentsType, "text/html" );\r
+ snprintf( pxClient->pxParent->pcExtraContents, sizeof( pxClient->pxParent->pcExtraContents ),\r
+ "Content-Length: %d\r\n", ( int ) xResult );\r
+ xRc = prvSendReply( pxClient, WEB_REPLY_OK ); /* "Requested file action OK" */\r
+ if( xRc > 0 )\r
+ {\r
+ xRc = FreeRTOS_send( pxClient->xSocket, pxClient->pcCurrentFilename, xResult, 0 );\r
+ }\r
+ /* Although against the coding standard of FreeRTOS, a return is\r
+ done here to simplify this conditional code. */\r
+ return xRc;\r
+ }\r
+ }\r
+ }\r
+ #endif /* ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK */\r
+\r
+ if( pxClient->pcUrlData[ 0 ] != '/' )\r
+ {\r
+ /* Insert a slash before the file name. */\r
+ pcSlash[ 0 ] = '/';\r
+ pcSlash[ 1 ] = '\0';\r
+ }\r
+ else\r
+ {\r
+ /* The browser provided a starting '/' already. */\r
+ pcSlash[ 0 ] = '\0';\r
+ }\r
+ snprintf( pxClient->pcCurrentFilename, sizeof( pxClient->pcCurrentFilename ), "%s%s%s",\r
+ pxClient->pcRootDir,\r
+ pcSlash,\r
+ pxClient->pcUrlData);\r
+\r
+ pxClient->pxFileHandle = ff_fopen( pxClient->pcCurrentFilename, "rb" );\r
+\r
+ FreeRTOS_printf( ( "Open file '%s': %s\n", pxClient->pcCurrentFilename,\r
+ pxClient->pxFileHandle != NULL ? "Ok" : strerror( stdioGET_ERRNO() ) ) );\r
+\r
+ if( pxClient->pxFileHandle == NULL )\r
+ {\r
+ /* "404 File not found". */\r
+ xRc = prvSendReply( pxClient, WEB_NOT_FOUND );\r
+ }\r
+ else\r
+ {\r
+ pxClient->uxBytesLeft = ( size_t ) pxClient->pxFileHandle->ulFileSize;\r
+ xRc = prvSendFile( pxClient );\r
+ }\r
+\r
+ return xRc;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static BaseType_t prvProcessCmd( HTTPClient_t *pxClient, BaseType_t xIndex )\r
+{\r
+BaseType_t xResult = 0;\r
+\r
+ /* A new command has been received. Process it. */\r
+ switch( xIndex )\r
+ {\r
+ case ECMD_GET:\r
+ xResult = prvOpenURL( pxClient );\r
+ break;\r
+\r
+ case ECMD_HEAD:\r
+ case ECMD_POST:\r
+ case ECMD_PUT:\r
+ case ECMD_DELETE:\r
+ case ECMD_TRACE:\r
+ case ECMD_OPTIONS:\r
+ case ECMD_CONNECT:\r
+ case ECMD_PATCH:\r
+ case ECMD_UNK:\r
+ {\r
+ FreeRTOS_printf( ( "prvProcessCmd: Not implemented: %s\n",\r
+ xWebCommands[xIndex].pcCommandName ) );\r
+ }\r
+ break;\r
+ }\r
+\r
+ return xResult;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+BaseType_t xHTTPClientWork( TCPClient_t *pxTCPClient )\r
+{\r
+BaseType_t xRc;\r
+HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;\r
+\r
+ if( pxClient->pxFileHandle != NULL )\r
+ {\r
+ prvSendFile( pxClient );\r
+ }\r
+\r
+ xRc = FreeRTOS_recv( pxClient->xSocket, ( void * )pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), 0 );\r
+\r
+ if( xRc > 0 )\r
+ {\r
+ BaseType_t xIndex;\r
+ const char *pcEndOfCmd;\r
+ const struct xWEB_COMMAND *curCmd;\r
+ char *pcBuffer = pcCOMMAND_BUFFER;\r
+\r
+ if( xRc < ( BaseType_t ) sizeof( pcCOMMAND_BUFFER ) )\r
+ {\r
+ pcBuffer[ xRc ] = '\0';\r
+ }\r
+ while( xRc && ( pcBuffer[ xRc - 1 ] == 13 || pcBuffer[ xRc - 1 ] == 10 ) )\r
+ {\r
+ pcBuffer[ --xRc ] = '\0';\r
+ }\r
+ pcEndOfCmd = pcBuffer + xRc;\r
+\r
+ curCmd = xWebCommands;\r
+\r
+ /* Pointing to "/index.html HTTP/1.1". */\r
+ pxClient->pcUrlData = pcBuffer;\r
+\r
+ /* Pointing to "HTTP/1.1". */\r
+ pxClient->pcRestData = pcEmptyString;\r
+\r
+ /* Last entry is "ECMD_UNK". */\r
+ for( xIndex = 0; xIndex < WEB_CMD_COUNT - 1; xIndex++, curCmd++ )\r
+ {\r
+ BaseType_t xLength;\r
+\r
+ xLength = curCmd->xCommandLength;\r
+ if( ( xRc >= xLength ) && ( memcmp( curCmd->pcCommandName, pcBuffer, xLength ) == 0 ) )\r
+ {\r
+ char *pcLastPtr;\r
+\r
+ pxClient->pcUrlData += xLength + 1;\r
+ for( pcLastPtr = (char *)pxClient->pcUrlData; pcLastPtr < pcEndOfCmd; pcLastPtr++ )\r
+ {\r
+ char ch = *pcLastPtr;\r
+ if( ( ch == '\0' ) || ( strchr( "\n\r \t", ch ) != NULL ) )\r
+ {\r
+ *pcLastPtr = '\0';\r
+ pxClient->pcRestData = pcLastPtr + 1;\r
+ break;\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ if( xIndex < ( WEB_CMD_COUNT - 1 ) )\r
+ {\r
+ xRc = prvProcessCmd( pxClient, xIndex );\r
+ }\r
+ }\r
+ else if( xRc < 0 )\r
+ {\r
+ /* The connection will be closed and the client will be deleted. */\r
+ FreeRTOS_printf( ( "xHTTPClientWork: rc = %ld\n", xRc ) );\r
+ }\r
+ return xRc;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static const char *pcGetContentsType (const char *apFname)\r
+{\r
+ const char *slash = NULL;\r
+ const char *dot = NULL;\r
+ const char *ptr;\r
+ const char *pcResult = "text/html";\r
+ BaseType_t x;\r
+\r
+ for( ptr = apFname; *ptr; ptr++ )\r
+ {\r
+ if (*ptr == '.') dot = ptr;\r
+ if (*ptr == '/') slash = ptr;\r
+ }\r
+ if( dot > slash )\r
+ {\r
+ dot++;\r
+ for( x = 0; x < ARRAY_SIZE( pxTypeCouples ); x++ )\r
+ {\r
+ if( strcasecmp( dot, pxTypeCouples[ x ].pcExtension ) == 0 )\r
+ {\r
+ pcResult = pxTypeCouples[ x ].pcType;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ return pcResult;\r
+}\r
+\r
+#endif /* ipconfigUSE_HTTP */\r
+\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/*\r
+ * NTPDemo.c\r
+ *\r
+ * An example of how to lookup a domain using DNS\r
+ * And also how to send and receive UDP messages to get the NTP time\r
+ *\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdint.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <time.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+/* FreeRTOS+TCP includes. */\r
+#include "FreeRTOS_IP.h"\r
+#include "FreeRTOS_Sockets.h"\r
+#include "FreeRTOS_DNS.h"\r
+#include "FreeRTOS_Stream_Buffer.h"\r
+\r
+/* Use the date & time functions from +FAT. */\r
+#include "ff_time.h"\r
+\r
+#include "NTPDemo.h"\r
+#include "ntpClient.h"\r
+\r
+#include "date_and_time.h"\r
+\r
+enum EStatus {\r
+ EStatusLookup,\r
+ EStatusAsking,\r
+ EStatusPause,\r
+ EStatusFailed,\r
+};\r
+\r
+static struct SNtpPacket xNTPPacket;\r
+\r
+#if( ipconfigUSE_CALLBACKS == 0 )\r
+ static char cRecvBuffer[ sizeof( struct SNtpPacket ) + 64 ];\r
+#endif\r
+\r
+static enum EStatus xStatus = EStatusLookup;\r
+\r
+static const char *pcTimeServers[] = {\r
+ "0.asia.pool.ntp.org",\r
+ "0.europe.pool.ntp.org",\r
+ "0.id.pool.ntp.org",\r
+ "0.south-america.pool.ntp.org",\r
+ "0.oceania.pool.ntp.org",\r
+ "0.north-america.pool.ntp.org"\r
+};\r
+\r
+static SemaphoreHandle_t xNTPWakeupSem = NULL;\r
+static uint32_t ulIPAddressFound;\r
+static Socket_t xUDPSocket = NULL;\r
+static TaskHandle_t xNTPTaskhandle = NULL;\r
+static TickType_t uxSendTime;\r
+\r
+static void prvNTPTask( void *pvParameters );\r
+\r
+static void vSignalTask( void )\r
+{\r
+ #if( ipconfigUSE_CALLBACKS == 0 )\r
+ if( xUDPSocket != NULL )\r
+ {\r
+ /* Send a signal to the socket so that the\r
+ FreeRTOS_recvfrom will get interrupted. */\r
+ FreeRTOS_SignalSocket( xUDPSocket );\r
+ }\r
+ else\r
+ #endif\r
+ if( xNTPWakeupSem != NULL )\r
+ {\r
+ xSemaphoreGive( xNTPWakeupSem );\r
+ }\r
+}\r
+\r
+void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )\r
+{\r
+ /* The only public function in this module: start a task to contact\r
+ some NTP server. */\r
+\r
+ if( xNTPTaskhandle != NULL )\r
+ {\r
+ switch( xStatus )\r
+ {\r
+ case EStatusPause:\r
+ xStatus = EStatusAsking;\r
+ vSignalTask();\r
+ break;\r
+ case EStatusLookup:\r
+ FreeRTOS_printf( ( "NTP looking up server\n" ) );\r
+ break;\r
+ case EStatusAsking:\r
+ FreeRTOS_printf( ( "NTP still asking\n" ) );\r
+ break;\r
+ case EStatusFailed:\r
+ FreeRTOS_printf( ( "NTP failed somehow\n" ) );\r
+ ulIPAddressFound = 0ul;\r
+ xStatus = EStatusLookup;\r
+ vSignalTask();\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ xUDPSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );\r
+ if( xUDPSocket != NULL )\r
+ {\r
+ struct freertos_sockaddr xAddress;\r
+ #if( ipconfigUSE_CALLBACKS != 0 )\r
+ BaseType_t xReceiveTimeOut = pdMS_TO_TICKS( 0 );\r
+ #else\r
+ BaseType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );\r
+ #endif\r
+\r
+ xAddress.sin_addr = 0ul;\r
+ xAddress.sin_port = FreeRTOS_htons( NTP_PORT );\r
+\r
+ FreeRTOS_bind( xUDPSocket, &xAddress, sizeof( xAddress ) );\r
+ FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );\r
+ xTaskCreate( prvNTPTask, /* The function that implements the task. */\r
+ ( const char * ) "NTP client", /* Just a text name for the task to aid debugging. */\r
+ usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */\r
+ NULL, /* The task parameter, not used in this case. */\r
+ uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */\r
+ &xNTPTaskhandle ); /* The task handle. */\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_printf( ( "Creating socket failed\n" ) );\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void vDNS_callback( const char *pcName, void *pvSearchID, uint32_t ulIPAddress )\r
+{\r
+char pcBuf[16];\r
+\r
+ /* The DNS lookup has a result, or it has reached the time-out. */\r
+ FreeRTOS_inet_ntoa( ulIPAddress, pcBuf );\r
+ FreeRTOS_printf( ( "IP address of %s found: %s\n", pcName, pcBuf ) );\r
+ if( ulIPAddressFound == 0ul )\r
+ {\r
+ ulIPAddressFound = ulIPAddress;\r
+ }\r
+ /* For testing: in case DNS doen't respond, still try some NTP server\r
+ with a known IP-address. */\r
+ if( ulIPAddressFound == 0ul )\r
+ {\r
+ ulIPAddressFound = FreeRTOS_inet_addr_quick( 184, 105, 182, 7 );\r
+/* ulIPAddressFound = FreeRTOS_inet_addr_quick( 103, 242, 70, 4 ); */\r
+ }\r
+ xStatus = EStatusAsking;\r
+\r
+ vSignalTask();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSwapFields( struct SNtpPacket *pxPacket)\r
+{\r
+ /* NTP messages are big-endian */\r
+ pxPacket->rootDelay = FreeRTOS_htonl( pxPacket->rootDelay );\r
+ pxPacket->rootDispersion = FreeRTOS_htonl( pxPacket->rootDispersion );\r
+\r
+ pxPacket->referenceTimestamp.seconds = FreeRTOS_htonl( pxPacket->referenceTimestamp.seconds );\r
+ pxPacket->referenceTimestamp.fraction = FreeRTOS_htonl( pxPacket->referenceTimestamp.fraction );\r
+\r
+ pxPacket->originateTimestamp.seconds = FreeRTOS_htonl( pxPacket->originateTimestamp.seconds );\r
+ pxPacket->originateTimestamp.fraction = FreeRTOS_htonl( pxPacket->originateTimestamp.fraction );\r
+\r
+ pxPacket->receiveTimestamp.seconds = FreeRTOS_htonl( pxPacket->receiveTimestamp.seconds );\r
+ pxPacket->receiveTimestamp.fraction = FreeRTOS_htonl( pxPacket->receiveTimestamp.fraction );\r
+\r
+ pxPacket->transmitTimestamp.seconds = FreeRTOS_htonl( pxPacket->transmitTimestamp.seconds );\r
+ pxPacket->transmitTimestamp.fraction = FreeRTOS_htonl( pxPacket->transmitTimestamp.fraction );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvNTPPacketInit( )\r
+{\r
+ memset (&xNTPPacket, '\0', sizeof( xNTPPacket ) );\r
+\r
+ xNTPPacket.flags = 0xDB; /* value 0xDB : mode 3 (client), version 3, leap indicator unknown 3 */\r
+ xNTPPacket.poll = 10; /* 10 means 1 << 10 = 1024 seconds */\r
+ xNTPPacket.precision = 0xFA; /* = 250 = 0.015625 seconds */\r
+ xNTPPacket.rootDelay = 0x5D2E; /* 0x5D2E = 23854 or (23854/65535)= 0.3640 sec */\r
+ xNTPPacket.rootDispersion = 0x0008CAC8; /* 0x0008CAC8 = 8.7912 seconds */\r
+\r
+ /* use the recorded NTP time */\r
+ time_t uxSecs = FreeRTOS_time( NULL );/* apTime may be NULL, returns seconds */\r
+\r
+ xNTPPacket.referenceTimestamp.seconds = uxSecs; /* Current time */\r
+ xNTPPacket.transmitTimestamp.seconds = uxSecs + 3;\r
+\r
+ /* Transform the contents of the fields from native to big endian. */\r
+ prvSwapFields( &xNTPPacket );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvReadTime( struct SNtpPacket * pxPacket )\r
+{\r
+ FF_TimeStruct_t xTimeStruct;\r
+ time_t uxPreviousSeconds;\r
+ time_t uxPreviousMS;\r
+\r
+ time_t uxCurrentSeconds;\r
+ time_t uxCurrentMS;\r
+\r
+ const char *pcTimeUnit;\r
+ int32_t ilDiff;\r
+ TickType_t uxTravelTime;\r
+\r
+ uxTravelTime = xTaskGetTickCount() - uxSendTime;\r
+\r
+ /* Transform the contents of the fields from big to native endian. */\r
+ prvSwapFields( pxPacket );\r
+\r
+ uxCurrentSeconds = pxPacket->receiveTimestamp.seconds - TIME1970;\r
+ uxCurrentMS = pxPacket->receiveTimestamp.fraction / 4294967;\r
+ uxCurrentSeconds += uxCurrentMS / 1000;\r
+ uxCurrentMS = uxCurrentMS % 1000;\r
+\r
+ // Get the last time recorded\r
+ uxPreviousSeconds = FreeRTOS_get_secs_msec( &uxPreviousMS );\r
+\r
+ // Set the new time with precision in msec. */\r
+ FreeRTOS_set_secs_msec( &uxCurrentSeconds, &uxCurrentMS );\r
+\r
+ if( uxCurrentSeconds >= uxPreviousSeconds )\r
+ {\r
+ ilDiff = ( int32_t ) ( uxCurrentSeconds - uxPreviousSeconds );\r
+ }\r
+ else\r
+ {\r
+ ilDiff = 0 - ( int32_t ) ( uxPreviousSeconds - uxCurrentSeconds );\r
+ }\r
+\r
+ if( ( ilDiff < -5 ) || ( ilDiff > 5 ) )\r
+ {\r
+ /* More than 5 seconds difference. */\r
+ pcTimeUnit = "sec";\r
+ }\r
+ else\r
+ {\r
+ /* Less than or equal to 5 second difference. */\r
+ pcTimeUnit = "ms";\r
+ uint32_t ulLowest = ( uxCurrentSeconds <= uxPreviousSeconds ) ? uxCurrentSeconds : uxPreviousSeconds;\r
+ int32_t iCurMS = 1000 * ( uxCurrentSeconds - ulLowest ) + uxCurrentMS;\r
+ int32_t iPrevMS = 1000 * ( uxPreviousSeconds - ulLowest ) + uxPreviousMS;\r
+ ilDiff = iCurMS - iPrevMS;\r
+ }\r
+ uxCurrentSeconds -= iTimeZone;\r
+\r
+ FreeRTOS_gmtime_r( &uxCurrentSeconds, &xTimeStruct );\r
+\r
+ /*\r
+ 378.067 [NTP client] NTP time: 9/11/2015 16:11:19.559 Diff -20 ms (289 ms)\r
+ 379.441 [NTP client] NTP time: 9/11/2015 16:11:20.933 Diff 0 ms (263 ms)\r
+ */\r
+\r
+ FreeRTOS_printf( ("NTP time: %d/%d/%02d %2d:%02d:%02d.%03u Diff %d %s (%lu ms)\n",\r
+ xTimeStruct.tm_mday,\r
+ xTimeStruct.tm_mon + 1,\r
+ xTimeStruct.tm_year + 1900,\r
+ xTimeStruct.tm_hour,\r
+ xTimeStruct.tm_min,\r
+ xTimeStruct.tm_sec,\r
+ ( unsigned )uxCurrentMS,\r
+ ( unsigned )ilDiff,\r
+ pcTimeUnit,\r
+ uxTravelTime ) );\r
+\r
+ /* Remove compiler warnings in case FreeRTOS_printf() is not used. */\r
+ ( void ) pcTimeUnit;\r
+ ( void ) uxTravelTime;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( ipconfigUSE_CALLBACKS != 0 )\r
+\r
+ static BaseType_t xOnUDPReceive( Socket_t xSocket, void * pvData, size_t xLength,\r
+ const struct freertos_sockaddr *pxFrom, const struct freertos_sockaddr *pxDest )\r
+ {\r
+ if( xLength >= sizeof( xNTPPacket ) )\r
+ {\r
+ prvReadTime( ( struct SNtpPacket *)pvData );\r
+ if( xStatus != EStatusPause )\r
+ {\r
+ xStatus = EStatusPause;\r
+ }\r
+ }\r
+ vSignalTask();\r
+ /* Tell the driver not to store the RX data */\r
+ return 1;\r
+ }\r
+ /*-----------------------------------------------------------*/\r
+\r
+#endif /* ipconfigUSE_CALLBACKS != 0 */\r
+\r
+static void prvNTPTask( void *pvParameters )\r
+{\r
+BaseType_t xServerIndex = 3;\r
+struct freertos_sockaddr xAddress;\r
+#if( ipconfigUSE_CALLBACKS != 0 )\r
+ F_TCP_UDP_Handler_t xHandler;\r
+#endif /* ipconfigUSE_CALLBACKS != 0 */\r
+\r
+ xStatus = EStatusLookup;\r
+ #if( ipconfigSOCKET_HAS_USER_SEMAPHORE != 0 ) || ( ipconfigUSE_CALLBACKS != 0 )\r
+ {\r
+ xNTPWakeupSem = xSemaphoreCreateBinary();\r
+ }\r
+ #endif\r
+\r
+ #if( ipconfigUSE_CALLBACKS != 0 )\r
+ {\r
+ memset( &xHandler, '\0', sizeof( xHandler ) );\r
+ xHandler.pxOnUDPReceive = xOnUDPReceive;\r
+ FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_UDP_RECV_HANDLER, ( void * ) &xHandler, sizeof( xHandler ) );\r
+ }\r
+ #endif\r
+ #if( ipconfigSOCKET_HAS_USER_SEMAPHORE != 0 )\r
+ {\r
+ FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_SET_SEMAPHORE, ( void * ) &xNTPWakeupSem, sizeof( xNTPWakeupSem ) );\r
+ }\r
+ #endif\r
+ for( ; ; )\r
+ {\r
+ switch( xStatus )\r
+ {\r
+ case EStatusLookup:\r
+ if( ( ulIPAddressFound == 0ul ) || ( ulIPAddressFound == ~0ul ) )\r
+ {\r
+ if( ++xServerIndex == sizeof( pcTimeServers ) / sizeof( pcTimeServers[ 0 ] ) )\r
+ {\r
+ xServerIndex = 0;\r
+ }\r
+ FreeRTOS_printf( ( "Looking up server '%s'\n", pcTimeServers[ xServerIndex ] ) );\r
+ FreeRTOS_gethostbyname_a( pcTimeServers[ xServerIndex ], vDNS_callback, (void *)NULL, 1200 );\r
+ }\r
+ else\r
+ {\r
+ xStatus = EStatusAsking;\r
+ }\r
+ break;\r
+\r
+ case EStatusAsking:\r
+ {\r
+ char pcBuf[16];\r
+\r
+ prvNTPPacketInit( );\r
+ xAddress.sin_addr = ulIPAddressFound;\r
+ xAddress.sin_port = FreeRTOS_htons( NTP_PORT );\r
+\r
+ FreeRTOS_inet_ntoa( xAddress.sin_addr, pcBuf );\r
+ FreeRTOS_printf( ( "Sending UDP message to %s:%u\n",\r
+ pcBuf,\r
+ FreeRTOS_ntohs( xAddress.sin_port ) ) );\r
+\r
+ uxSendTime = xTaskGetTickCount( );\r
+ FreeRTOS_sendto( xUDPSocket, ( void * )&xNTPPacket, sizeof( xNTPPacket ), 0, &xAddress, sizeof( xAddress ) );\r
+ }\r
+ break;\r
+\r
+ case EStatusPause:\r
+ break;\r
+\r
+ case EStatusFailed:\r
+ break;\r
+ }\r
+\r
+ #if( ipconfigUSE_CALLBACKS != 0 )\r
+ {\r
+ xSemaphoreTake( xNTPWakeupSem, 5000 );\r
+ }\r
+ #else\r
+ {\r
+ uint32_t xAddressSize;\r
+ BaseType_t xReturned;\r
+\r
+ xAddressSize = sizeof( xAddress );\r
+ xReturned = FreeRTOS_recvfrom( xUDPSocket, ( void * ) cRecvBuffer, sizeof( cRecvBuffer ), 0, &xAddress, &xAddressSize );\r
+ switch( xReturned )\r
+ {\r
+ case 0:\r
+ case -pdFREERTOS_ERRNO_EAGAIN:\r
+ case -pdFREERTOS_ERRNO_EINTR:\r
+ break;\r
+ default:\r
+ if( xReturned < sizeof( xNTPPacket ) )\r
+ {\r
+ FreeRTOS_printf( ( "FreeRTOS_recvfrom: returns %ld\n", xReturned ) );\r
+ }\r
+ else\r
+ {\r
+ prvReadTime( ( struct SNtpPacket *)cRecvBuffer );\r
+ if( xStatus != EStatusPause )\r
+ {\r
+ xStatus = EStatusPause;\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ #endif\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.1\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+#ifndef __FTPCMD_H__\r
+\r
+#define __FTPCMD_H__\r
+\r
+#define REPL_110 "110 Restart marker reply.\r\n"\r
+#define REPL_120 "120 Try again in 2 minutes.\r\n"\r
+#define REPL_125 "125 Data connection already open; transfer starting.\r\n"\r
+#define REPL_150 "150 File status okay; about to open data connection.\r\n"\r
+#define REPL_200 "200 NOOP command successful.\r\n"\r
+#define REPL_200_PROGRESS "200 NOOP: data transfer in progress.\r\n"\r
+#define REPL_202 "202 Command not implemented, superfluous at this site.\r\n"\r
+#define REPL_211 "221 System status, or system help reply.\r\n"\r
+#define REPL_211_STATUS "221-status of %s.\r\n"\r
+#define REPL_211_END "221 End of status.\r\n"\r
+#define REPL_212 "212 Directory status.\r\n"\r
+#define REPL_213 "213 File status.\r\n"\r
+#define REPL_214 "214 Help message.\r\n"\r
+#define REPL_214_END "214 End Help message.\r\n"\r
+#define REPL_215 "215 %s system type.\r\n"\r
+#define REPL_220 "220 Service ready for new user.\r\n"\r
+#define REPL_221 "221 Service closing control connection.\r\n"\r
+#define REPL_225 "225 Data connection open; no transfer in progress.\r\n"\r
+#define REPL_226 "226 Closing data connection.\r\n"\r
+#define REPL_227 "227 Entering Passive Mode (%s,%s,%s,%s,%s,%s).\r\n"\r
+#define REPL_227_D "227 Entering Passive Mode (%u,%u,%u,%u,%u,%u).\r\n"\r
+#define REPL_230 "230 User logged in, proceed.\r\n"\r
+#define REPL_250 "250 Requested file action okay, completed.\r\n"\r
+#define REPL_257 "257 %s created.\r\n"\r
+// #define REPL_257_PWD "257 \"%s\" is current working dir.\r\n"\r
+#define REPL_257_PWD "257 \"%s\"\r\n"\r
+#define REPL_331 "331 Only anonymous user is accepted.\r\n"\r
+#define REPL_331_ANON "331 Anonymous login okay\r\n"\r
+#define REPL_332 "332 Need account for login.\r\n"\r
+#define REPL_350 "350 Requested file action pending further information.\r\n"\r
+#define REPL_421 "421 Service not available, closing control connection.\r\n"\r
+#define REPL_425 "425 Can't open data connection.\r\n"\r
+#define REPL_426 "426 Connection closed; transfer aborted.\r\n"\r
+#define REPL_450 "450 Requested file action not taken.\r\n"\r
+#define REPL_451 "451 Requested action aborted. Local error in processing.\r\n"\r
+#define REPL_452 "452 Requested action not taken.\r\n"\r
+#define REPL_500 "500 Syntax error, command unrecognized.\r\n"\r
+#define REPL_501 "501 Syntax error in parameters or arguments.\r\n"\r
+#define REPL_502 "502 Command not implemented.\r\n"\r
+#define REPL_503 "503 Bad sequence of commands.\r\n"\r
+#define REPL_504 "504 Command not implemented for that parameter.\r\n"\r
+#define REPL_530 "530 Not logged in.\r\n"\r
+#define REPL_532 "532 Need account for storing files.\r\n"\r
+#define REPL_550 "550 Requested action not taken.\r\n"\r
+#define REPL_551 "551 Requested action aborted. Page type unknown.\r\n"\r
+#define REPL_552 "552 Requested file action aborted.\r\n"\r
+#define REPL_553 "553 Requested action not taken.\r\n"\r
+#define REPL_553_READ_ONLY "553 Read-only file-system.\r\n"\r
+\r
+enum EFTPCommand {\r
+ ECMD_USER,\r
+ ECMD_PASS,\r
+ ECMD_ACCT,\r
+ ECMD_CWD,\r
+ ECMD_CDUP,\r
+ ECMD_SMNT,\r
+ ECMD_QUIT,\r
+ ECMD_REIN,\r
+ ECMD_PORT,\r
+ ECMD_PASV,\r
+ ECMD_TYPE,\r
+ ECMD_STRU,\r
+ ECMD_MODE,\r
+ ECMD_RETR,\r
+ ECMD_STOR,\r
+ ECMD_STOU,\r
+ ECMD_APPE,\r
+ ECMD_ALLO,\r
+ ECMD_REST,\r
+ ECMD_RNFR,\r
+ ECMD_RNTO,\r
+ ECMD_ABOR,\r
+ ECMD_SIZE,\r
+ ECMD_MDTM,\r
+ ECMD_DELE,\r
+ ECMD_RMD,\r
+ ECMD_MKD,\r
+ ECMD_PWD,\r
+ ECMD_LIST,\r
+ ECMD_NLST,\r
+ ECMD_SITE,\r
+ ECMD_SYST,\r
+ ECMD_FEAT,\r
+ ECMD_STAT,\r
+ ECMD_HELP,\r
+ ECMD_NOOP,\r
+ ECMD_EMPTY,\r
+ ECMD_CLOSE,\r
+ ECMD_UNKNOWN,\r
+};\r
+\r
+typedef struct xFTP_COMMAND {\r
+ BaseType_t xCommandLength;\r
+ const char pcCommandName[7];\r
+ const unsigned char ucCommandType;\r
+ const unsigned char checkLogin;\r
+ const unsigned char checkNullArg;\r
+} FTPCommand_t;\r
+\r
+#define FTP_CMD_COUNT (ECMD_UNKNOWN+1)\r
+\r
+extern const FTPCommand_t xFTPCommands[ FTP_CMD_COUNT ];\r
+\r
+#endif // __FTPCMD_H__\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+#ifndef FREERTOS_HTTP_COMMANDS_H\r
+#define FREERTOS_HTTP_COMMANDS_H\r
+\r
+enum {\r
+ WEB_REPLY_OK = 200,\r
+ WEB_NO_CONTENT = 204,\r
+ WEB_BAD_REQUEST = 400,\r
+ WEB_UNAUTHORIZED = 401,\r
+ WEB_NOT_FOUND = 404,\r
+ WEB_GONE = 410,\r
+ WEB_PRECONDITION_FAILED = 412,\r
+ WEB_INTERNAL_SERVER_ERROR = 500,\r
+};\r
+\r
+enum EWebCommand {\r
+ ECMD_GET,\r
+ ECMD_HEAD,\r
+ ECMD_POST,\r
+ ECMD_PUT,\r
+ ECMD_DELETE,\r
+ ECMD_TRACE,\r
+ ECMD_OPTIONS,\r
+ ECMD_CONNECT,\r
+ ECMD_PATCH,\r
+ ECMD_UNK,\r
+};\r
+\r
+struct xWEB_COMMAND\r
+{\r
+ BaseType_t xCommandLength;\r
+ const char *pcCommandName;\r
+ const unsigned char ucCommandType;\r
+};\r
+\r
+#define WEB_CMD_COUNT (ECMD_UNK+1)\r
+\r
+extern const struct xWEB_COMMAND xWebCommands[WEB_CMD_COUNT];\r
+\r
+extern const char *webCodename (int aCode);\r
+\r
+#endif /* FREERTOS_HTTP_COMMANDS_H */\r
+\r
+\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/*\r
+ Some code which is common to TCP servers like HTTP en FTP\r
+*/\r
+\r
+#ifndef FREERTOS_TCP_SERVER_H\r
+#define FREERTOS_TCP_SERVER_H\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#ifndef FTP_SERVER_USES_RELATIVE_DIRECTORY\r
+ #define FTP_SERVER_USES_RELATIVE_DIRECTORY 0\r
+#endif\r
+\r
+enum eSERVER_TYPE\r
+{\r
+ eSERVER_NONE,\r
+ eSERVER_HTTP,\r
+ eSERVER_FTP,\r
+};\r
+\r
+struct xFTP_CLIENT;\r
+\r
+#if( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )\r
+ extern void vApplicationFTPReceivedHook( const char *pcFileName, uint32_t ulSize, struct xFTP_CLIENT *pxFTPClient );\r
+ extern void vFTPReplyMessage( struct xFTP_CLIENT *pxFTPClient, const char *pcMessage );\r
+#endif /* ipconfigFTP_HAS_RECEIVED_HOOK != 0 */\r
+\r
+#if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )\r
+ /*\r
+ * Function is called when a user name has been submitted.\r
+ * The function may return a string such as: "331 Please enter your password"\r
+ * or return NULL to use the default reply.\r
+ */\r
+ extern const char *pcApplicationFTPUserHook( const char *pcUserName );\r
+#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
+\r
+#if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )\r
+ /*\r
+ * Function is called when a password was received.\r
+ * Return positive value to allow the user\r
+ */\r
+ extern BaseType_t xApplicationFTPPasswordHook( const char *pcUserName, const char *pcPassword );\r
+#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
+\r
+#if( ipconfigFTP_HAS_USER_PROPERTIES_HOOK != 0 )\r
+ /*\r
+ * The FTP server is asking for user-specific properties\r
+ */\r
+ typedef struct\r
+ {\r
+ uint16_t usPortNumber; /* For reference only. Host-endian. */\r
+ const char *pcRootDir;\r
+ BaseType_t xReadOnly;\r
+ }\r
+ FTPUserProperties_t;\r
+ extern void vApplicationFTPUserPropertiesHook( const char *pcUserName, FTPUserProperties_t *pxProperties );\r
+#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
+\r
+#if( ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK != 0 )\r
+ /*\r
+ * A GET request is received containing a special character,\r
+ * usually a question mark.\r
+ * const char *pcURLData; // A request, e.g. "/request?limit=75"\r
+ * char *pcBuffer; // Here the answer can be written\r
+ * size_t uxBufferLength; // Size of the buffer\r
+ *\r
+ */\r
+ extern size_t uxApplicationHTTPHandleRequestHook( const char *pcURLData, char *pcBuffer, size_t uxBufferLength );\r
+#endif /* ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK */\r
+\r
+struct xSERVER_CONFIG\r
+{\r
+ enum eSERVER_TYPE eType; /* eSERVER_HTTP | eSERVER_FTP */\r
+ BaseType_t xPortNumber; /* e.g. 80, 8080, 21 */\r
+ BaseType_t xBackLog; /* e.g. 10, maximum number of connected TCP clients */\r
+ const char * const pcRootDir; /* Treat this directory as the root directory */\r
+};\r
+\r
+struct xTCP_SERVER;\r
+typedef struct xTCP_SERVER TCPServer_t;\r
+\r
+TCPServer_t *FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG *pxConfigs, BaseType_t xCount );\r
+void FreeRTOS_TCPServerWork( TCPServer_t *pxServer, TickType_t xBlockingTime );\r
+\r
+#if( ipconfigSUPPORT_SIGNALS != 0 )\r
+ /* FreeRTOS_TCPServerWork() calls select().\r
+ The two functions below provide a possibility to interrupt\r
+ the call to select(). After the interruption, resume\r
+ by calling FreeRTOS_TCPServerWork() again. */\r
+ BaseType_t FreeRTOS_TCPServerSignal( TCPServer_t *pxServer );\r
+ BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t *pxServer, BaseType_t *pxHigherPriorityTaskWoken );\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* FREERTOS_TCP_SERVER_H */\r
--- /dev/null
+/*\r
+ * FreeRTOS+TCP V2.0.3\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+ /*\r
+ Some code which is common to TCP servers like HTTP and FTP\r
+*/\r
+\r
+#ifndef FREERTOS_SERVER_PRIVATE_H\r
+#define FREERTOS_SERVER_PRIVATE_H\r
+\r
+#define FREERTOS_NO_SOCKET NULL\r
+\r
+/* FreeRTOS+FAT */\r
+#include "ff_stdio.h"\r
+\r
+/* Each HTTP server has 1, at most 2 sockets */\r
+#define HTTP_SOCKET_COUNT 2\r
+\r
+/*\r
+ * ipconfigTCP_COMMAND_BUFFER_SIZE sets the size of:\r
+ * pcCommandBuffer': a buffer to receive and send TCP commands\r
+ *\r
+ * ipconfigTCP_FILE_BUFFER_SIZE sets the size of:\r
+ * pcFileBuffer' : a buffer to access the file system: read or write data.\r
+ *\r
+ * The buffers are both used for FTP as well as HTTP.\r
+ */\r
+\r
+#ifndef ipconfigTCP_COMMAND_BUFFER_SIZE\r
+ #define ipconfigTCP_COMMAND_BUFFER_SIZE ( 2048 )\r
+#endif\r
+\r
+#ifndef ipconfigTCP_FILE_BUFFER_SIZE\r
+ #define ipconfigTCP_FILE_BUFFER_SIZE ( 2048 )\r
+#endif\r
+\r
+struct xTCP_CLIENT;\r
+\r
+typedef BaseType_t ( * FTCPWorkFunction ) ( struct xTCP_CLIENT * /* pxClient */ );\r
+typedef void ( * FTCPDeleteFunction ) ( struct xTCP_CLIENT * /* pxClient */ );\r
+\r
+#define TCP_CLIENT_FIELDS \\r
+ enum eSERVER_TYPE eType; \\r
+ struct xTCP_SERVER *pxParent; \\r
+ Socket_t xSocket; \\r
+ const char *pcRootDir; \\r
+ FTCPWorkFunction fWorkFunction; \\r
+ FTCPDeleteFunction fDeleteFunction; \\r
+ struct xTCP_CLIENT *pxNextClient\r
+\r
+typedef struct xTCP_CLIENT\r
+{\r
+ /* This define contains fields which must come first within each of the client structs */\r
+ TCP_CLIENT_FIELDS;\r
+ /* --- Keep at the top --- */\r
+\r
+} TCPClient_t;\r
+\r
+struct xHTTP_CLIENT\r
+{\r
+ /* This define contains fields which must come first within each of the client structs */\r
+ TCP_CLIENT_FIELDS;\r
+ /* --- Keep at the top --- */\r
+\r
+ const char *pcUrlData;\r
+ const char *pcRestData;\r
+ char pcCurrentFilename[ ffconfigMAX_FILENAME ];\r
+ size_t uxBytesLeft;\r
+ FF_FILE *pxFileHandle;\r
+ union {\r
+ struct {\r
+ uint32_t\r
+ bReplySent : 1;\r
+ };\r
+ uint32_t ulFlags;\r
+ } bits;\r
+};\r
+\r
+typedef struct xHTTP_CLIENT HTTPClient_t;\r
+\r
+struct xFTP_CLIENT\r
+{\r
+ /* This define contains fields which must come first within each of the client structs */\r
+ TCP_CLIENT_FIELDS;\r
+ /* --- Keep at the top --- */\r
+\r
+ uint32_t ulRestartOffset;\r
+ uint32_t ulRecvBytes;\r
+ size_t uxBytesLeft; /* Bytes left to send */\r
+ uint32_t ulClientIP;\r
+ TickType_t xStartTime;\r
+ uint16_t usClientPort;\r
+ Socket_t xTransferSocket;\r
+ BaseType_t xTransType;\r
+ BaseType_t xDirCount;\r
+ FF_FindData_t xFindData;\r
+ FF_FILE *pxReadHandle;\r
+ FF_FILE *pxWriteHandle;\r
+ char pcCurrentDir[ ffconfigMAX_FILENAME ];\r
+ char pcFileName[ ffconfigMAX_FILENAME ];\r
+ char pcConnectionAck[ 128 ];\r
+ char pcClientAck[ 128 ];\r
+ union {\r
+ struct {\r
+ uint32_t\r
+ bHelloSent : 1,\r
+ bLoggedIn : 1,\r
+ bStatusUser : 1,\r
+ bInRename : 1,\r
+ bReadOnly : 1;\r
+ };\r
+ uint32_t ulFTPFlags;\r
+ } bits;\r
+ union {\r
+ struct {\r
+ uint32_t\r
+ bIsListen : 1, /* pdTRUE for passive data connections (using list()). */\r
+ bDirHasEntry : 1, /* pdTRUE if ff_findfirst() was successful. */\r
+ bClientConnected : 1, /* pdTRUE after connect() or accept() has succeeded. */\r
+ bEmptyFile : 1, /* pdTRUE if a connection-without-data was received. */\r
+ bHadError : 1; /* pdTRUE if a transfer got aborted because of an error. */\r
+ };\r
+ uint32_t ulConnFlags;\r
+ } bits1;\r
+};\r
+\r
+typedef struct xFTP_CLIENT FTPClient_t;\r
+\r
+BaseType_t xHTTPClientWork( TCPClient_t *pxClient );\r
+BaseType_t xFTPClientWork( TCPClient_t *pxClient );\r
+\r
+void vHTTPClientDelete( TCPClient_t *pxClient );\r
+void vFTPClientDelete( TCPClient_t *pxClient );\r
+\r
+BaseType_t xMakeAbsolute( struct xFTP_CLIENT *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName );\r
+BaseType_t xMakeRelative( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName );\r
+\r
+struct xTCP_SERVER\r
+{\r
+ SocketSet_t xSocketSet;\r
+ /* A buffer to receive and send TCP commands, either HTTP of FTP. */\r
+ char pcCommandBuffer[ ipconfigTCP_COMMAND_BUFFER_SIZE ];\r
+ /* A buffer to access the file system: read or write data. */\r
+ char pcFileBuffer[ ipconfigTCP_FILE_BUFFER_SIZE ];\r
+\r
+ #if( ipconfigUSE_FTP != 0 )\r
+ char pcNewDir[ ffconfigMAX_FILENAME ];\r
+ #endif\r
+ #if( ipconfigUSE_HTTP != 0 )\r
+ char pcContentsType[40]; /* Space for the msg: "text/javascript" */\r
+ char pcExtraContents[40]; /* Space for the msg: "Content-Length: 346500" */\r
+ #endif\r
+ BaseType_t xServerCount;\r
+ TCPClient_t *pxClients;\r
+ struct xSERVER\r
+ {\r
+ enum eSERVER_TYPE eType; /* eSERVER_HTTP | eSERVER_FTP */\r
+ const char *pcRootDir;\r
+ Socket_t xSocket;\r
+ } xServers[ 1 ];\r
+};\r
+\r
+#endif /* FREERTOS_SERVER_PRIVATE_H */\r
--- /dev/null
+//\r
+// ntpClient.h\r
+//\r
+\r
+#ifndef __NTPCLIENT_H__\r
+\r
+#define __NTPCLIENT_H__\r
+\r
+#define NTP_PORT 123\r
+\r
+typedef uint32_t quint32;\r
+typedef int32_t qint32;\r
+typedef uint8_t quint8;\r
+typedef int8_t qint8;\r
+\r
+typedef union _SNtpFlags SNtpFlags;\r
+\r
+/**\r
+ * 64-bit NTP timestamp.\r
+ */\r
+struct __attribute__ ((__packed__)) _SNtpTimestamp {\r
+ /** Number of seconds passed since Jan 1 1900, in big-endian format. */\r
+ quint32 seconds;\r
+\r
+ /** Fractional time part, in <tt>1/0xFFFFFFFF</tt>s of a second. */\r
+ quint32 fraction;\r
+};\r
+\r
+typedef struct _SNtpTimestamp SNtpTimestamp;\r
+/**\r
+ * Mandatory part of an NTP packet\r
+ */\r
+struct SNtpPacket {\r
+ /** Flags. */\r
+ unsigned char flags; // value 0xDB : mode 3 (client), version 3, leap indicator unknown 3\r
+\r
+ /** Stratum of the clock. */\r
+ quint8 stratum; // value 0 : unspecified\r
+\r
+ /** Maximum interval between successive messages, in log2 seconds. Note that the value is signed. */\r
+ qint8 poll; // 10 means 1 << 10 = 1024 seconds\r
+\r
+ /** Precision of the clock, in log2 seconds. Note that the value is signed. */\r
+ qint8 precision; // 0xFA = 250 = 0.015625 seconds\r
+\r
+ /** Round trip time to the primary reference source, in NTP short format. */\r
+ qint32 rootDelay; // 0x5D2E = 23854 or (23854/65535)= 0.3640 sec\r
+\r
+ /** Nominal error relative to the primary reference source. */\r
+ qint32 rootDispersion; // 0x0008 CAC8 = 8.7912 seconds\r
+\r
+ /** Reference identifier (either a 4 character string or an IP address). */\r
+ qint8 referenceID[4]; // or just 0000\r
+\r
+ /** The time at which the clock was last set or corrected. */\r
+ SNtpTimestamp referenceTimestamp; // Current time\r
+\r
+ /** The time at which the request departed the client for the server. */\r
+ SNtpTimestamp originateTimestamp; // Keep 0\r
+\r
+ /** The time at which the request arrived at the server. */\r
+ SNtpTimestamp receiveTimestamp; // Keep 0\r
+\r
+ /** The time at which the reply departed the server for client. */\r
+ SNtpTimestamp transmitTimestamp;\r
+};\r
+\r
+/* Add this number to get secs since 1-1-1900 */\r
+#define TIME1970 2208988800UL\r
+\r
+#endif // __NTPCLIENT_H__\r
--- /dev/null
+/*\r
+ * A simple demo for NTP using FreeRTOS+TCP\r
+ */\r
+\r
+#ifndef NTPDEMO_H\r
+\r
+#define NTPDEMO_H\r
+\r
+void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );\r
+\r
+#endif
\ No newline at end of file
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
\r
void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress, const uint32_t ulIPAddress )\r
{\r
-BaseType_t x, xIpEntry = -1, xMacEntry = -1, xUseEntry = 0;\r
+BaseType_t x = 0;\r
+BaseType_t xIpEntry = -1;\r
+BaseType_t xMacEntry = -1;\r
+BaseType_t xUseEntry = 0;\r
uint8_t ucMinAgeFound = 0U;\r
\r
#if( ipconfigARP_STORES_REMOTE_ADDRESSES == 0 )\r
xARPHeader.usOperation;\r
xARPHeader.xTargetHardwareAddress;\r
*/\r
- memcpy( ( void * ) &( pxARPPacket->xEthernetHeader ), ( void * ) xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );\r
+ memcpy( ( void * ) pxARPPacket, ( void * ) xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );\r
memcpy( ( void * ) pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes , ( void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );\r
memcpy( ( void * ) pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes, ( void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );\r
\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
#endif\r
\r
/* Codes of interest found in the DHCP options field. */\r
-#define dhcpIPv4_ZERO_PAD_OPTION_CODE ( 0u )\r
-#define dhcpIPv4_SUBNET_MASK_OPTION_CODE ( 1u )\r
-#define dhcpIPv4_GATEWAY_OPTION_CODE ( 3u )\r
-#define dhcpIPv4_DNS_SERVER_OPTIONS_CODE ( 6u )\r
-#define dhcpIPv4_DNS_HOSTNAME_OPTIONS_CODE ( 12u )\r
-#define dhcpIPv4_REQUEST_IP_ADDRESS_OPTION_CODE ( 50u )\r
-#define dhcpIPv4_LEASE_TIME_OPTION_CODE ( 51u )\r
-#define dhcpIPv4_MESSAGE_TYPE_OPTION_CODE ( 53u )\r
-#define dhcpIPv4_SERVER_IP_ADDRESS_OPTION_CODE ( 54u )\r
-#define dhcpIPv4_PARAMETER_REQUEST_OPTION_CODE ( 55u )\r
-#define dhcpIPv4_CLIENT_IDENTIFIER_OPTION_CODE ( 61u )\r
+#define dhcpZERO_PAD_OPTION_CODE ( 0u )\r
+#define dhcpSUBNET_MASK_OPTION_CODE ( 1u )\r
+#define dhcpGATEWAY_OPTION_CODE ( 3u )\r
+#define dhcpDNS_SERVER_OPTIONS_CODE ( 6u )\r
+#define dhcpDNS_HOSTNAME_OPTIONS_CODE ( 12u )\r
+#define dhcpREQUEST_IP_ADDRESS_OPTION_CODE ( 50u )\r
+#define dhcpLEASE_TIME_OPTION_CODE ( 51u )\r
+#define dhcpMESSAGE_TYPE_OPTION_CODE ( 53u )\r
+#define dhcpSERVER_IP_ADDRESS_OPTION_CODE ( 54u )\r
+#define dhcpPARAMETER_REQUEST_OPTION_CODE ( 55u )\r
+#define dhcpCLIENT_IDENTIFIER_OPTION_CODE ( 61u )\r
\r
/* The four DHCP message types of interest. */\r
#define dhcpMESSAGE_TYPE_DISCOVER ( 1 )\r
made up of the length byte, and minimum one byte value. */\r
#define dhcpMAX_OPTION_LENGTH_OF_INTEREST ( 2L )\r
\r
-/* Standard DHCP port numbers and magic cookie value.\r
-DHCPv4 uses UDP port number 68 for clients and port number 67 for servers.\r
-*/\r
+/* Standard DHCP port numbers and magic cookie value. */\r
#if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )\r
#define dhcpCLIENT_PORT 0x4400u\r
#define dhcpSERVER_PORT 0x4300u\r
\r
if( xDHCPData.xDHCPTxPeriod <= ipconfigMAXIMUM_DISCOVER_TX_PERIOD )\r
{\r
- xDHCPData.ulTransactionId++;\r
- xDHCPData.xDHCPTxTime = xTaskGetTickCount();\r
- xDHCPData.xUseBroadcast = !xDHCPData.xUseBroadcast;\r
- prvSendDHCPDiscover( );\r
- FreeRTOS_debug_printf( ( "vDHCPProcess: timeout %lu ticks\n", xDHCPData.xDHCPTxPeriod ) );\r
+ xDHCPData.ulTransactionId = ipconfigRAND32( );\r
+\r
+ if( 0 != xDHCPData.ulTransactionId )\r
+ {\r
+ xDHCPData.xDHCPTxTime = xTaskGetTickCount( );\r
+ xDHCPData.xUseBroadcast = !xDHCPData.xUseBroadcast;\r
+ prvSendDHCPDiscover( );\r
+ FreeRTOS_debug_printf( ( "vDHCPProcess: timeout %lu ticks\n", xDHCPData.xDHCPTxPeriod ) );\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_debug_printf( ( "vDHCPProcess: failed to generate a random Transaction ID\n" ) );\r
+ }\r
}\r
else\r
{\r
{\r
/* xGivingUp became true either because of a time-out, or because\r
xApplicationDHCPHook() returned another value than 'eDHCPContinue',\r
- meaning that the conversion is cancelled from here. */\r
+ meaning that the conversion is canceled from here. */\r
\r
/* Revert to static IP address. */\r
taskENTER_CRITICAL();\r
\r
static void prvInitialiseDHCP( void )\r
{\r
- /* Initialise the parameters that will be set by the DHCP process. */\r
- if( xDHCPData.ulTransactionId == 0ul )\r
- {\r
- xDHCPData.ulTransactionId = ipconfigRAND32();\r
- }\r
- else\r
- {\r
- xDHCPData.ulTransactionId++;\r
- }\r
-\r
- /* Check for random number generator API failure. */\r
- if( 0 != xDHCPData.ulTransactionId )\r
- {\r
- xDHCPData.xUseBroadcast = 0;\r
- xDHCPData.ulOfferedIPAddress = 0UL;\r
- xDHCPData.ulDHCPServerAddress = 0UL;\r
- xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;\r
-\r
- /* Create the DHCP socket if it has not already been created. */\r
- prvCreateDHCPSocket();\r
- FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );\r
- vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );\r
- }\r
+ /* Initialise the parameters that will be set by the DHCP process. Per\r
+ https://www.ietf.org/rfc/rfc2131.txt, Transaction ID should be a random\r
+ value chosen by the client. */\r
+ xDHCPData.ulTransactionId = ipconfigRAND32();\r
+\r
+ /* Check for random number generator API failure. */\r
+ if( 0 != xDHCPData.ulTransactionId )\r
+ {\r
+ xDHCPData.xUseBroadcast = 0;\r
+ xDHCPData.ulOfferedIPAddress = 0UL;\r
+ xDHCPData.ulDHCPServerAddress = 0UL;\r
+ xDHCPData.xDHCPTxPeriod = dhcpINITIAL_DHCP_TX_PERIOD;\r
+\r
+ /* Create the DHCP socket if it has not already been created. */\r
+ prvCreateDHCPSocket();\r
+ FreeRTOS_debug_printf( ( "prvInitialiseDHCP: start after %lu ticks\n", dhcpINITIAL_TIMER_PERIOD ) );\r
+ vIPReloadDHCPTimer( dhcpINITIAL_TIMER_PERIOD );\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
pxDHCPMessage = ( DHCPMessage_t * ) ( pucUDPPayload );\r
\r
/* Sanity check. */\r
- if( ( pxDHCPMessage->ulDHCPCookie == ( uint32_t ) dhcpCOOKIE ) &&\r
+ if( ( lBytes >= sizeof( DHCPMessage_t ) ) &&\r
+ ( pxDHCPMessage->ulDHCPCookie == ( uint32_t ) dhcpCOOKIE ) &&\r
( pxDHCPMessage->ucOpcode == ( uint8_t ) dhcpREPLY_OPCODE ) &&\r
( pxDHCPMessage->ulTransactionID == FreeRTOS_htonl( xDHCPData.ulTransactionId ) ) )\r
{\r
- if( memcmp( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress ), ( void * ) ipLOCAL_MAC_ADDRESS, sizeof( MACAddress_t ) ) == 0 )\r
+ if( memcmp( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress ), \r
+ ( void * ) ipLOCAL_MAC_ADDRESS, \r
+ sizeof( MACAddress_t ) ) == 0 )\r
{\r
/* None of the essential options have been processed yet. */\r
ulProcessed = 0ul;\r
while( pucByte < pucLastByte )\r
{\r
ucOptionCode = pucByte[ 0 ];\r
- if( ucOptionCode == ( uint8_t ) dhcpOPTION_END_BYTE )\r
+ if( ucOptionCode == dhcpOPTION_END_BYTE )\r
{\r
/* Ready, the last byte has been seen. */\r
break;\r
}\r
- if( ucOptionCode == ( uint8_t ) dhcpIPv4_ZERO_PAD_OPTION_CODE )\r
+ if( ucOptionCode == dhcpZERO_PAD_OPTION_CODE )\r
{\r
/* The value zero is used as a pad byte,\r
it is not followed by a length byte. */\r
pucByte += 1;\r
continue;\r
}\r
- ucLength = pucByte[ 1 ];\r
- pucByte += 2;\r
\r
- /* In most cases, a 4-byte network-endian parameter follows,\r
- just get it once here and use later */\r
- memcpy( ( void * ) &( ulParameter ), ( void * ) pucByte, ( size_t ) sizeof( ulParameter ) );\r
+ /* Stop if the response is malformed. */\r
+ if( pucByte < pucLastByte - 1 )\r
+ {\r
+ ucLength = pucByte[ 1 ];\r
+ pucByte += 2;\r
+\r
+ if( pucByte >= pucLastByte - ucLength )\r
+ {\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ break;\r
+ } \r
\r
+ /* In most cases, a 4-byte network-endian parameter follows,\r
+ just get it once here and use later. */\r
+ if( ucLength >= sizeof( ulParameter ) )\r
+ {\r
+ memcpy( ( void * ) &( ulParameter ), \r
+ ( void * ) pucByte, \r
+ ( size_t ) sizeof( ulParameter ) );\r
+ }\r
+ else\r
+ {\r
+ ulParameter = 0;\r
+ }\r
+\r
+ /* Option-specific handling. */\r
switch( ucOptionCode )\r
{\r
- case dhcpIPv4_MESSAGE_TYPE_OPTION_CODE :\r
+ case dhcpMESSAGE_TYPE_OPTION_CODE :\r
\r
if( *pucByte == ( uint8_t ) xExpectedMessageType )\r
{\r
}\r
break;\r
\r
- case dhcpIPv4_SUBNET_MASK_OPTION_CODE :\r
+ case dhcpSUBNET_MASK_OPTION_CODE :\r
\r
if( ucLength == sizeof( uint32_t ) )\r
{\r
}\r
break;\r
\r
- case dhcpIPv4_GATEWAY_OPTION_CODE :\r
- /* The DHCP server may send more than 1 gateway addresses. */\r
- if( ucLength >= sizeof( uint32_t ) )\r
+ case dhcpGATEWAY_OPTION_CODE :\r
+\r
+ if( ucLength == sizeof( uint32_t ) )\r
{\r
/* ulProcessed is not incremented in this case\r
because the gateway is not essential. */\r
}\r
break;\r
\r
- case dhcpIPv4_DNS_SERVER_OPTIONS_CODE :\r
+ case dhcpDNS_SERVER_OPTIONS_CODE :\r
\r
/* ulProcessed is not incremented in this case\r
because the DNS server is not essential. Only the\r
xNetworkAddressing.ulDNSServerAddress = ulParameter;\r
break;\r
\r
- case dhcpIPv4_SERVER_IP_ADDRESS_OPTION_CODE :\r
+ case dhcpSERVER_IP_ADDRESS_OPTION_CODE :\r
\r
if( ucLength == sizeof( uint32_t ) )\r
{\r
}\r
break;\r
\r
- case dhcpIPv4_LEASE_TIME_OPTION_CODE :\r
+ case dhcpLEASE_TIME_OPTION_CODE :\r
\r
if( ucLength == sizeof( xDHCPData.ulLeaseTime ) )\r
{\r
}\r
\r
FreeRTOS_ReleaseUDPPayloadBuffer( ( void * ) pucUDPPayload );\r
- } /* if( lBytes > 0 ) */\r
+ }\r
\r
return xReturn;\r
}\r
pxDHCPMessage->ucOpcode = ( uint8_t ) xOpcode;\r
pxDHCPMessage->ucAddressType = ( uint8_t ) dhcpADDRESS_TYPE_ETHERNET;\r
pxDHCPMessage->ucAddressLength = ( uint8_t ) dhcpETHERNET_ADDRESS_LENGTH;\r
-\r
- /* ulTransactionID doesn't really need a htonl() translation, but when DHCP\r
- times out, it is nicer to see an increasing number in this ID field */\r
pxDHCPMessage->ulTransactionID = FreeRTOS_htonl( xDHCPData.ulTransactionId );\r
pxDHCPMessage->ulDHCPCookie = ( uint32_t ) dhcpCOOKIE;\r
if( xDHCPData.xUseBroadcast != pdFALSE )\r
\r
/* Point to where the OPTION_END was stored to add data. */\r
pucPtr = &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + ( *pxOptionsArraySize - 1 ) ] );\r
- pucPtr[ 0 ] = dhcpIPv4_DNS_HOSTNAME_OPTIONS_CODE;\r
+ pucPtr[ 0 ] = dhcpDNS_HOSTNAME_OPTIONS_CODE;\r
pucPtr[ 1 ] = ( uint8_t ) xNameLength;\r
memcpy( ( void *) ( pucPtr + 2 ), pucHostName, xNameLength );\r
pucPtr[ 2 + xNameLength ] = dhcpOPTION_END_BYTE;\r
/* Do not change the ordering without also changing\r
dhcpCLIENT_IDENTIFIER_OFFSET, dhcpREQUESTED_IP_ADDRESS_OFFSET and\r
dhcpDHCP_SERVER_IP_ADDRESS_OFFSET. */\r
- dhcpIPv4_MESSAGE_TYPE_OPTION_CODE, 1, dhcpMESSAGE_TYPE_REQUEST, /* Message type option. */\r
- dhcpIPv4_CLIENT_IDENTIFIER_OPTION_CODE, 6, 0, 0, 0, 0, 0, 0, /* Client identifier. */\r
- dhcpIPv4_REQUEST_IP_ADDRESS_OPTION_CODE, 4, 0, 0, 0, 0, /* The IP address being requested. */\r
- dhcpIPv4_SERVER_IP_ADDRESS_OPTION_CODE, 4, 0, 0, 0, 0, /* The IP address of the DHCP server. */\r
+ dhcpMESSAGE_TYPE_OPTION_CODE, 1, dhcpMESSAGE_TYPE_REQUEST, /* Message type option. */\r
+ dhcpCLIENT_IDENTIFIER_OPTION_CODE, 6, 0, 0, 0, 0, 0, 0, /* Client identifier. */\r
+ dhcpREQUEST_IP_ADDRESS_OPTION_CODE, 4, 0, 0, 0, 0, /* The IP address being requested. */\r
+ dhcpSERVER_IP_ADDRESS_OPTION_CODE, 4, 0, 0, 0, 0, /* The IP address of the DHCP server. */\r
dhcpOPTION_END_BYTE\r
};\r
size_t xOptionsLength = sizeof( ucDHCPRequestOptions );\r
\r
- pucUDPPayloadBuffer = prvCreatePartDHCPMessage( &xAddress, ( uint8_t ) dhcpREQUEST_OPCODE, ucDHCPRequestOptions, &xOptionsLength );\r
+ pucUDPPayloadBuffer = prvCreatePartDHCPMessage( &xAddress, dhcpREQUEST_OPCODE, ucDHCPRequestOptions, &xOptionsLength );\r
\r
/* Copy in the IP address being requested. */\r
memcpy( ( void * ) &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpREQUESTED_IP_ADDRESS_OFFSET ] ),\r
static const uint8_t ucDHCPDiscoverOptions[] =\r
{\r
/* Do not change the ordering without also changing dhcpCLIENT_IDENTIFIER_OFFSET. */\r
- dhcpIPv4_MESSAGE_TYPE_OPTION_CODE, 1, dhcpMESSAGE_TYPE_DISCOVER, /* Message type option. */\r
- dhcpIPv4_CLIENT_IDENTIFIER_OPTION_CODE, 6, 0, 0, 0, 0, 0, 0, /* Client identifier. */\r
- dhcpIPv4_PARAMETER_REQUEST_OPTION_CODE, 3, dhcpIPv4_SUBNET_MASK_OPTION_CODE, dhcpIPv4_GATEWAY_OPTION_CODE, dhcpIPv4_DNS_SERVER_OPTIONS_CODE, /* Parameter request option. */\r
+ dhcpMESSAGE_TYPE_OPTION_CODE, 1, dhcpMESSAGE_TYPE_DISCOVER, /* Message type option. */\r
+ dhcpCLIENT_IDENTIFIER_OPTION_CODE, 6, 0, 0, 0, 0, 0, 0, /* Client identifier. */\r
+ dhcpPARAMETER_REQUEST_OPTION_CODE, 3, dhcpSUBNET_MASK_OPTION_CODE, dhcpGATEWAY_OPTION_CODE, dhcpDNS_SERVER_OPTIONS_CODE, /* Parameter request option. */\r
dhcpOPTION_END_BYTE\r
};\r
size_t xOptionsLength = sizeof( ucDHCPDiscoverOptions );\r
\r
- pucUDPPayloadBuffer = prvCreatePartDHCPMessage( &xAddress, ( uint8_t ) dhcpREQUEST_OPCODE, ucDHCPDiscoverOptions, &xOptionsLength );\r
+ pucUDPPayloadBuffer = prvCreatePartDHCPMessage( &xAddress, dhcpREQUEST_OPCODE, ucDHCPDiscoverOptions, &xOptionsLength );\r
\r
FreeRTOS_debug_printf( ( "vDHCPProcess: discover\n" ) );\r
iptraceSENDING_DHCP_DISCOVER();\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
#if( ipconfigUSE_DNS != 0 )\r
\r
#if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )\r
- #define dnsDNS_PORT 0x3500u\r
- #define dnsONE_QUESTION 0x0100u\r
- #define dnsOUTGOING_FLAGS 0x0001u /* Standard query. */\r
- #define dnsRX_FLAGS_MASK 0x0f80u /* The bits of interest in the flags field of incoming DNS messages. */\r
- #define dnsEXPECTED_RX_FLAGS 0x0080u /* Should be a response, without any errors. */\r
+ #define dnsDNS_PORT 0x3500\r
+ #define dnsONE_QUESTION 0x0100\r
+ #define dnsOUTGOING_FLAGS 0x0001 /* Standard query. */\r
+ #define dnsRX_FLAGS_MASK 0x0f80 /* The bits of interest in the flags field of incoming DNS messages. */\r
+ #define dnsEXPECTED_RX_FLAGS 0x0080 /* Should be a response, without any errors. */\r
#else\r
- #define dnsDNS_PORT 0x0035u\r
- #define dnsONE_QUESTION 0x0001u\r
- #define dnsOUTGOING_FLAGS 0x0100u /* Standard query. */\r
- #define dnsRX_FLAGS_MASK 0x800fu /* The bits of interest in the flags field of incoming DNS messages. */\r
- #define dnsEXPECTED_RX_FLAGS 0x8000u /* Should be a response, without any errors. */\r
+ #define dnsDNS_PORT 0x0035\r
+ #define dnsONE_QUESTION 0x0001\r
+ #define dnsOUTGOING_FLAGS 0x0100 /* Standard query. */\r
+ #define dnsRX_FLAGS_MASK 0x800f /* The bits of interest in the flags field of incoming DNS messages. */\r
+ #define dnsEXPECTED_RX_FLAGS 0x8000 /* Should be a response, without any errors. */\r
\r
#endif /* ipconfigBYTE_ORDER */\r
\r
#define dnsNAME_IS_OFFSET ( ( uint8_t ) 0xc0 )\r
\r
/* NBNS flags. */\r
-#define dnsNBNS_FLAGS_RESPONSE 0x8000u\r
-#define dnsNBNS_FLAGS_OPCODE_MASK 0x7800u\r
-#define dnsNBNS_FLAGS_OPCODE_QUERY 0x0000u\r
-#define dnsNBNS_FLAGS_OPCODE_REGISTRATION 0x2800u\r
+#define dnsNBNS_FLAGS_RESPONSE 0x8000\r
+#define dnsNBNS_FLAGS_OPCODE_MASK 0x7800\r
+#define dnsNBNS_FLAGS_OPCODE_QUERY 0x0000\r
+#define dnsNBNS_FLAGS_OPCODE_REGISTRATION 0x2800\r
\r
/* Host types. */\r
-#define dnsTYPE_A_HOST 0x0001u\r
-#define dnsCLASS_IN 0x0001u\r
+#define dnsTYPE_A_HOST 0x01\r
+#define dnsCLASS_IN 0x01\r
\r
/* LLMNR constants. */\r
-#define dnsLLMNR_TTL_VALUE 300000u\r
-#define dnsLLMNR_FLAGS_IS_REPONSE 0x8000u\r
+#define dnsLLMNR_TTL_VALUE 300000\r
+#define dnsLLMNR_FLAGS_IS_REPONSE 0x8000\r
\r
/* NBNS constants. */\r
-#define dnsNBNS_TTL_VALUE 3600u /* 1 hour valid */\r
-#define dnsNBNS_TYPE_NET_BIOS 0x0020u\r
-#define dnsNBNS_CLASS_IN 0x0001u\r
-#define dnsNBNS_NAME_FLAGS 0x6000u\r
+#define dnsNBNS_TTL_VALUE 3600 /* 1 hour valid */\r
+#define dnsNBNS_TYPE_NET_BIOS 0x0020\r
+#define dnsNBNS_CLASS_IN 0x01\r
+#define dnsNBNS_NAME_FLAGS 0x6000\r
#define dnsNBNS_ENCODED_NAME_LENGTH 32\r
\r
/* If the queried NBNS name matches with the device's name,\r
the query will be responded to with these flags: */\r
-#define dnsNBNS_QUERY_RESPONSE_FLAGS 0x8500u\r
+#define dnsNBNS_QUERY_RESPONSE_FLAGS ( 0x8500 )\r
+\r
+/* Flag DNS parsing errors in situations where an IPv4 address is the return \r
+type. */\r
+#define dnsPARSE_ERROR 0UL\r
\r
/*\r
* Create a socket and bind it to the standard DNS port number. Return the\r
/*\r
* Simple routine that jumps over the NAME field of a resource record.\r
*/\r
-static uint8_t *prvSkipNameField( uint8_t *pucByte );\r
+static uint8_t *prvSkipNameField( uint8_t *pucByte, size_t xSourceLen );\r
\r
/*\r
* Process a response packet from a DNS server.\r
*/\r
-static uint32_t prvParseDNSReply( uint8_t *pucUDPPayloadBuffer, TickType_t xIdentifier );\r
+static uint32_t prvParseDNSReply( uint8_t *pucUDPPayloadBuffer, size_t xBufferLength, TickType_t xIdentifier );\r
\r
/*\r
* Prepare and send a message to a DNS server. 'xReadTimeOut_ms' will be passed as\r
#endif\r
\r
#if( ipconfigUSE_NBNS == 1 )\r
- static portINLINE void prvTreatNBNS( uint8_t *pucUDPPayloadBuffer, uint32_t ulIPAddress );\r
+ static portINLINE void prvTreatNBNS( uint8_t *pucUDPPayloadBuffer, size_t xBufferLength, uint32_t ulIPAddress );\r
#endif /* ipconfigUSE_NBNS */\r
\r
#if( ipconfigUSE_DNS_CACHE == 1 )\r
- static uint8_t *prvReadNameField( uint8_t *pucByte, char *pcName, BaseType_t xLen );\r
- static void prvProcessDNSCache( const char *pcName, uint32_t *pulIP, BaseType_t xLookUp );\r
+ static uint8_t *prvReadNameField( uint8_t *pucByte, size_t xSourceLen, char *pcName, size_t xLen );\r
+ static void prvProcessDNSCache( const char *pcName, uint32_t *pulIP, uint32_t ulTTL, BaseType_t xLookUp );\r
\r
typedef struct xDNS_CACHE_TABLE_ROW\r
{\r
uint32_t ulIPAddress; /* The IP address of an ARP cache entry. */\r
- char pcName[ipconfigDNS_CACHE_NAME_LENGTH]; /* The name of the host */\r
- uint8_t ucAge; /* A value that is periodically decremented but can also be refreshed by active communication. The ARP cache entry is removed if the value reaches zero. */\r
+ char pcName[ ipconfigDNS_CACHE_NAME_LENGTH ]; /* The name of the host */\r
+ uint32_t ulTTL; /* Time-to-Live (in seconds) from the DNS server. */\r
+ uint32_t ulTimeWhenAddedInSeconds;\r
} DNSCacheRow_t;\r
\r
static DNSCacheRow_t xDNSCache[ ipconfigDNS_CACHE_ENTRIES ];\r
#include "pack_struct_end.h"\r
typedef struct xDNSTail DNSTail_t;\r
\r
+/* DNS answer record header. */\r
+#include "pack_struct_start.h"\r
+struct xDNSAnswerRecord\r
+{\r
+ uint16_t usType;\r
+ uint16_t usClass;\r
+ uint32_t ulTTL;\r
+ uint16_t usDataLength;\r
+}\r
+#include "pack_struct_end.h"\r
+typedef struct xDNSAnswerRecord DNSAnswerRecord_t;\r
+\r
#if( ipconfigUSE_LLMNR == 1 )\r
\r
#include "pack_struct_start.h"\r
uint32_t FreeRTOS_dnslookup( const char *pcHostName )\r
{\r
uint32_t ulIPAddress = 0UL;\r
- prvProcessDNSCache( pcHostName, &ulIPAddress, pdTRUE );\r
+ prvProcessDNSCache( pcHostName, &ulIPAddress, 0, pdTRUE );\r
return ulIPAddress;\r
}\r
#endif /* ipconfigUSE_DNS_CACHE == 1 */\r
#endif\r
{\r
uint32_t ulIPAddress = 0UL;\r
-static uint16_t usIdentifier = 0u;\r
-TickType_t xReadTimeOut_ms = 1200U;\r
-/* Generate a unique identifier for this query. Keep it in a local variable\r
- as gethostbyname() may be called from different threads */\r
-TickType_t xIdentifier = ( TickType_t )usIdentifier++;\r
-\r
- /* If the supplied hostname is IP address, convert it to uint32_t\r
- and return. */\r
- #if( ipconfigINCLUDE_FULL_INET_ADDR == 1 )\r
- {\r
- ulIPAddress = FreeRTOS_inet_addr( pcHostName );\r
- }\r
- #endif /* ipconfigINCLUDE_FULL_INET_ADDR == 1 */\r
-\r
- /* If a DNS cache is used then check the cache before issuing another DNS\r
- request. */\r
- #if( ipconfigUSE_DNS_CACHE == 1 )\r
- {\r
- if( ulIPAddress == 0UL )\r
- {\r
- ulIPAddress = FreeRTOS_dnslookup( pcHostName );\r
- if( ulIPAddress != 0 )\r
- {\r
- FreeRTOS_debug_printf( ( "FreeRTOS_gethostbyname: found '%s' in cache: %lxip\n", pcHostName, ulIPAddress ) );\r
- }\r
- else\r
- {\r
- /* prvGetHostByName will be called to start a DNS lookup */\r
- }\r
- }\r
- }\r
- #endif /* ipconfigUSE_DNS_CACHE == 1 */\r
-\r
- #if( ipconfigDNS_USE_CALLBACKS != 0 )\r
- {\r
- if( pCallback != NULL )\r
- {\r
- if( ulIPAddress == 0UL )\r
- {\r
- /* The user has provided a callback function, so do not block on recvfrom() */\r
- xReadTimeOut_ms = 0;\r
- vDNSSetCallBack( pcHostName, pvSearchID, pCallback, xTimeout, ( TickType_t ) xIdentifier );\r
- }\r
- else\r
- {\r
- /* The IP address is known, do the call-back now. */\r
- pCallback( pcHostName, pvSearchID, ulIPAddress );\r
- }\r
- }\r
- }\r
- #endif\r
-\r
- if( ulIPAddress == 0UL)\r
- {\r
- ulIPAddress = prvGetHostByName( pcHostName, xIdentifier, xReadTimeOut_ms );\r
- }\r
-\r
- return ulIPAddress;\r
+TickType_t xReadTimeOut_ms = ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME;\r
+TickType_t xIdentifier = 0;\r
+\r
+ /* If the supplied hostname is IP address, convert it to uint32_t\r
+ and return. */\r
+ #if( ipconfigINCLUDE_FULL_INET_ADDR == 1 )\r
+ {\r
+ ulIPAddress = FreeRTOS_inet_addr( pcHostName );\r
+ }\r
+ #endif /* ipconfigINCLUDE_FULL_INET_ADDR == 1 */\r
+\r
+ /* If a DNS cache is used then check the cache before issuing another DNS\r
+ request. */\r
+ #if( ipconfigUSE_DNS_CACHE == 1 )\r
+ {\r
+ if( ulIPAddress == 0UL )\r
+ {\r
+ ulIPAddress = FreeRTOS_dnslookup( pcHostName );\r
+ if( ulIPAddress != 0 )\r
+ {\r
+ FreeRTOS_debug_printf( ( "FreeRTOS_gethostbyname: found '%s' in cache: %lxip\n", pcHostName, ulIPAddress ) );\r
+ }\r
+ else\r
+ {\r
+ /* prvGetHostByName will be called to start a DNS lookup */\r
+ }\r
+ }\r
+ }\r
+ #endif /* ipconfigUSE_DNS_CACHE == 1 */\r
+\r
+ /* Generate a unique identifier. */\r
+ if( 0 == ulIPAddress )\r
+ {\r
+ xIdentifier = ( TickType_t )ipconfigRAND32( );\r
+ }\r
+\r
+ #if( ipconfigDNS_USE_CALLBACKS != 0 )\r
+ {\r
+ if( pCallback != NULL )\r
+ {\r
+ if( ulIPAddress == 0UL )\r
+ {\r
+ /* The user has provided a callback function, so do not block on recvfrom() */\r
+ if( 0 != xIdentifier )\r
+ {\r
+ xReadTimeOut_ms = 0;\r
+ vDNSSetCallBack( pcHostName, pvSearchID, pCallback, xTimeout, ( TickType_t )xIdentifier );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* The IP address is known, do the call-back now. */\r
+ pCallback( pcHostName, pvSearchID, ulIPAddress );\r
+ }\r
+ }\r
+ }\r
+ #endif\r
+\r
+ if( ulIPAddress == 0UL && 0 != xIdentifier )\r
+ {\r
+ ulIPAddress = prvGetHostByName( pcHostName, xIdentifier, xReadTimeOut_ms );\r
+ }\r
+\r
+ return ulIPAddress;\r
}\r
/*-----------------------------------------------------------*/\r
\r
BaseType_t xAttempt;\r
int32_t lBytes;\r
size_t xPayloadLength, xExpectedPayloadLength;\r
-TickType_t xWriteTimeOut_ms = 100U;\r
+TickType_t xWriteTimeOut_ms = ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME;\r
\r
#if( ipconfigUSE_LLMNR == 1 )\r
BaseType_t bHasDot = pdFALSE;\r
if( lBytes > 0 )\r
{\r
/* The reply was received. Process it. */\r
- ulIPAddress = prvParseDNSReply( pucUDPPayloadBuffer, xIdentifier );\r
+ ulIPAddress = prvParseDNSReply( pucUDPPayloadBuffer, lBytes, xIdentifier );\r
\r
/* Finished with the buffer. The zero copy interface\r
is being used, so the buffer must be freed by the\r
\r
#if( ipconfigUSE_DNS_CACHE == 1 )\r
\r
- static uint8_t *prvReadNameField( uint8_t *pucByte, char *pcName, BaseType_t xLen )\r
+ static uint8_t *prvReadNameField( uint8_t *pucByte, size_t xSourceLen, char *pcName, size_t xDestLen )\r
{\r
- BaseType_t xNameLen = 0;\r
+ size_t xNameLen = 0;\r
+ BaseType_t xCount;\r
+\r
+ if( 0 == xSourceLen )\r
+ {\r
+ return NULL;\r
+ }\r
+\r
/* Determine if the name is the fully coded name, or an offset to the name\r
elsewhere in the message. */\r
if( ( *pucByte & dnsNAME_IS_OFFSET ) == dnsNAME_IS_OFFSET )\r
{\r
/* Jump over the two byte offset. */\r
- pucByte += sizeof( uint16_t );\r
-\r
+ if( xSourceLen > sizeof( uint16_t ) )\r
+ {\r
+ pucByte += sizeof( uint16_t );\r
+ }\r
+ else\r
+ {\r
+ pucByte = NULL;\r
+ }\r
}\r
else\r
{\r
- /* pucByte points to the full name. Walk over the string. */\r
- while( *pucByte != 0x00 )\r
+ /* pucByte points to the full name. Walk over the string. */\r
+ while( NULL != pucByte && *pucByte != 0x00 && xSourceLen > 1 )\r
{\r
- BaseType_t xCount;\r
- if( xNameLen && xNameLen < xLen - 1 )\r
- pcName[xNameLen++] = '.';\r
- for( xCount = *(pucByte++); xCount--; pucByte++ )\r
+ /* If this is not the first time through the loop, then add a \r
+ separator in the output. */\r
+ if( xNameLen > 0 && xNameLen < xDestLen - 1 )\r
+ {\r
+ pcName[ xNameLen++ ] = '.';\r
+ }\r
+\r
+ /* Process the first/next sub-string. */\r
+ for( xCount = *(pucByte++), xSourceLen--;\r
+ xCount-- && xSourceLen > 1; \r
+ pucByte++, xSourceLen-- )\r
{\r
- if( xNameLen < xLen - 1 )\r
- pcName[xNameLen++] = *( ( char * ) pucByte );\r
+ if( xNameLen < xDestLen - 1 )\r
+ {\r
+ pcName[ xNameLen++ ] = *( ( char * )pucByte );\r
+ }\r
+ else\r
+ {\r
+ /* DNS name is too big for the provided buffer. */\r
+ pucByte = NULL;\r
+ break;\r
+ }\r
}\r
}\r
\r
- pucByte++;\r
+ /* Confirm that a fully formed name was found. */\r
+ if( NULL != pucByte )\r
+ {\r
+ if( 0x00 == *pucByte )\r
+ {\r
+ pucByte++;\r
+ xSourceLen--;\r
+ pcName[ xNameLen++ ] = '\0';\r
+ }\r
+ else\r
+ {\r
+ pucByte = NULL;\r
+ }\r
+ }\r
}\r
\r
return pucByte;\r
#endif /* ipconfigUSE_DNS_CACHE == 1 */\r
/*-----------------------------------------------------------*/\r
\r
-static uint8_t *prvSkipNameField( uint8_t *pucByte )\r
+static uint8_t *prvSkipNameField( uint8_t *pucByte, size_t xSourceLen )\r
{\r
- /* Determine if the name is the fully coded name, or an offset to the name\r
+ size_t xChunkLength;\r
+\r
+ if( 0 == xSourceLen )\r
+ {\r
+ return NULL;\r
+ }\r
+\r
+ /* Determine if the name is the fully coded name, or an offset to the name\r
elsewhere in the message. */\r
if( ( *pucByte & dnsNAME_IS_OFFSET ) == dnsNAME_IS_OFFSET )\r
{\r
/* Jump over the two byte offset. */\r
- pucByte += sizeof( uint16_t );\r
-\r
+ if( xSourceLen > sizeof( uint16_t ) )\r
+ {\r
+ pucByte += sizeof( uint16_t );\r
+ }\r
+ else\r
+ {\r
+ pucByte = NULL;\r
+ }\r
}\r
else\r
{\r
- /* pucByte points to the full name. Walk over the string. */\r
- while( *pucByte != 0x00 )\r
+ /* pucByte points to the full name. Walk over the string. */\r
+ while( *pucByte != 0x00 && xSourceLen > 1 )\r
{\r
- /* The number of bytes to jump for each name section is stored in the byte\r
- before the name section. */\r
- pucByte += ( *pucByte + 1 );\r
+ xChunkLength = *pucByte + 1;\r
+\r
+ if( xSourceLen > xChunkLength )\r
+ {\r
+ xSourceLen -= xChunkLength;\r
+ pucByte += xChunkLength;\r
+ }\r
+ else\r
+ {\r
+ pucByte = NULL;\r
+ break;\r
+ }\r
}\r
\r
- pucByte++;\r
+ /* Confirm that a fully formed name was found. */\r
+ if( NULL != pucByte )\r
+ {\r
+ if( 0x00 == *pucByte )\r
+ {\r
+ pucByte++;\r
+ }\r
+ else\r
+ {\r
+ pucByte = NULL;\r
+ }\r
+ }\r
}\r
\r
return pucByte;\r
\r
uint32_t ulDNSHandlePacket( NetworkBufferDescriptor_t *pxNetworkBuffer )\r
{\r
-uint8_t *pucUDPPayloadBuffer = pxNetworkBuffer->pucEthernetBuffer + sizeof( UDPPacket_t );\r
-DNSMessage_t *pxDNSMessageHeader = ( DNSMessage_t * ) pucUDPPayloadBuffer;\r
+uint8_t *pucUDPPayloadBuffer;\r
+size_t xPlayloadBufferLength;\r
+DNSMessage_t *pxDNSMessageHeader;\r
\r
- prvParseDNSReply( pucUDPPayloadBuffer, ( uint32_t ) pxDNSMessageHeader->usIdentifier );\r
+ xPlayloadBufferLength = pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t );\r
+ if ( xPlayloadBufferLength < sizeof( DNSMessage_t ) )\r
+ {\r
+ return pdFAIL;\r
+ }\r
+\r
+ pucUDPPayloadBuffer = pxNetworkBuffer->pucEthernetBuffer + sizeof( UDPPacket_t );\r
+ pxDNSMessageHeader = ( DNSMessage_t * ) pucUDPPayloadBuffer;\r
+\r
+ if( pxNetworkBuffer->xDataLength > sizeof( UDPPacket_t ) )\r
+ {\r
+ prvParseDNSReply( pucUDPPayloadBuffer, \r
+ xPlayloadBufferLength,\r
+ ( uint32_t )pxDNSMessageHeader->usIdentifier );\r
+ }\r
\r
/* The packet was not consumed. */\r
return pdFAIL;\r
uint32_t ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer )\r
{\r
UDPPacket_t *pxUDPPacket = ( UDPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer;\r
- uint8_t *pucUDPPayloadBuffer = pxNetworkBuffer->pucEthernetBuffer + sizeof( *pxUDPPacket );\r
+ uint8_t *pucUDPPayloadBuffer = pxNetworkBuffer->pucEthernetBuffer + sizeof( UDPPacket_t );\r
\r
- prvTreatNBNS( pucUDPPayloadBuffer, pxUDPPacket->xIPHeader.ulSourceIPAddress );\r
+ if( pxNetworkBuffer->xDataLength > sizeof( UDPPacket_t) )\r
+ {\r
+ prvTreatNBNS( pucUDPPayloadBuffer, \r
+ pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t ),\r
+ pxUDPPacket->xIPHeader.ulSourceIPAddress );\r
+ }\r
\r
/* The packet was not consumed. */\r
return pdFAIL;\r
#endif /* ipconfigUSE_NBNS */\r
/*-----------------------------------------------------------*/\r
\r
-static uint32_t prvParseDNSReply( uint8_t *pucUDPPayloadBuffer, TickType_t xIdentifier )\r
+static uint32_t prvParseDNSReply( uint8_t *pucUDPPayloadBuffer, size_t xBufferLength, TickType_t xIdentifier )\r
{\r
DNSMessage_t *pxDNSMessageHeader;\r
+DNSAnswerRecord_t *pxDNSAnswerRecord;\r
uint32_t ulIPAddress = 0UL;\r
#if( ipconfigUSE_LLMNR == 1 )\r
char *pcRequestedName = NULL;\r
#endif\r
uint8_t *pucByte;\r
+size_t xSourceBytesRemaining;\r
uint16_t x, usDataLength, usQuestions;\r
#if( ipconfigUSE_LLMNR == 1 )\r
uint16_t usType = 0, usClass = 0;\r
#endif\r
#if( ipconfigUSE_DNS_CACHE == 1 )\r
- char pcName[128] = ""; /*_RB_ What is the significance of 128? Probably too big to go on the stack for a small MCU but don't know how else it could be made re-entrant. Might be necessary. */\r
+ char pcName[ ipconfigDNS_CACHE_NAME_LENGTH ] = ""; \r
#endif\r
\r
+ /* Ensure that the buffer is of at least minimal DNS message length. */\r
+ if( xBufferLength < sizeof( DNSMessage_t ) )\r
+ {\r
+ return dnsPARSE_ERROR;\r
+ }\r
+ else\r
+ {\r
+ xSourceBytesRemaining = xBufferLength;\r
+ }\r
+\r
+ /* Parse the DNS message header. */\r
pxDNSMessageHeader = ( DNSMessage_t * ) pucUDPPayloadBuffer;\r
\r
if( pxDNSMessageHeader->usIdentifier == ( uint16_t ) xIdentifier )\r
{\r
/* Start at the first byte after the header. */\r
pucByte = pucUDPPayloadBuffer + sizeof( DNSMessage_t );\r
+ xSourceBytesRemaining -= sizeof( DNSMessage_t );\r
\r
/* Skip any question records. */\r
usQuestions = FreeRTOS_ntohs( pxDNSMessageHeader->usQuestions );\r
#if( ipconfigUSE_DNS_CACHE == 1 )\r
if( x == 0 )\r
{\r
- pucByte = prvReadNameField( pucByte, pcName, sizeof( pcName ) );\r
+ pucByte = prvReadNameField( pucByte, \r
+ xSourceBytesRemaining,\r
+ pcName, \r
+ sizeof( pcName ) );\r
+ \r
+ /* Check for a malformed response. */\r
+ if( NULL == pucByte )\r
+ {\r
+ return dnsPARSE_ERROR;\r
+ }\r
+ else\r
+ {\r
+ xSourceBytesRemaining = ( pucUDPPayloadBuffer + xBufferLength ) - pucByte;\r
+ }\r
}\r
else\r
#endif /* ipconfigUSE_DNS_CACHE */\r
{\r
/* Skip the variable length pcName field. */\r
- pucByte = prvSkipNameField( pucByte );\r
- }\r
-\r
- #if( ipconfigUSE_LLMNR == 1 )\r
- {\r
- /* usChar2u16 returns value in host endianness. */\r
- usType = usChar2u16( pucByte );\r
- usClass = usChar2u16( pucByte + 2 );\r
- }\r
- #endif /* ipconfigUSE_LLMNR */\r
-\r
- /* Skip the type and class fields. */\r
- pucByte += sizeof( uint32_t );\r
+ pucByte = prvSkipNameField( pucByte, \r
+ xSourceBytesRemaining );\r
+ \r
+ /* Check for a malformed response. */\r
+ if( NULL == pucByte )\r
+ {\r
+ return dnsPARSE_ERROR;\r
+ }\r
+ else\r
+ {\r
+ xSourceBytesRemaining = pucUDPPayloadBuffer + xBufferLength - pucByte;\r
+ }\r
+ }\r
+\r
+ /* Check the remaining buffer size. */\r
+ if( xSourceBytesRemaining >= sizeof( uint32_t ) )\r
+ {\r
+ #if( ipconfigUSE_LLMNR == 1 )\r
+ {\r
+ /* usChar2u16 returns value in host endianness */\r
+ usType = usChar2u16( pucByte );\r
+ usClass = usChar2u16( pucByte + 2 );\r
+ }\r
+ #endif /* ipconfigUSE_LLMNR */\r
+\r
+ /* Skip the type and class fields. */\r
+ pucByte += sizeof( uint32_t );\r
+ xSourceBytesRemaining -= sizeof( uint32_t );\r
+ }\r
+ else\r
+ {\r
+ /* Malformed response. */\r
+ return dnsPARSE_ERROR;\r
+ }\r
}\r
\r
- /* Search through the answers records. */\r
+ /* Search through the answer records. */\r
pxDNSMessageHeader->usAnswers = FreeRTOS_ntohs( pxDNSMessageHeader->usAnswers );\r
\r
if( ( pxDNSMessageHeader->usFlags & dnsRX_FLAGS_MASK ) == dnsEXPECTED_RX_FLAGS )\r
{\r
for( x = 0; x < pxDNSMessageHeader->usAnswers; x++ )\r
{\r
- pucByte = prvSkipNameField( pucByte );\r
-\r
- /* Is the type field that of an A record? */\r
- if( usChar2u16( pucByte ) == dnsTYPE_A_HOST )\r
+ pucByte = prvSkipNameField( pucByte,\r
+ xSourceBytesRemaining );\r
+\r
+ /* Check for a malformed response. */\r
+ if( NULL == pucByte )\r
+ {\r
+ return dnsPARSE_ERROR;\r
+ }\r
+ else\r
+ {\r
+ xSourceBytesRemaining = pucUDPPayloadBuffer + xBufferLength - pucByte;\r
+ }\r
+\r
+ /* Is there enough data for an IPv4 A record answer and, if so, \r
+ is this an A record? */\r
+ if( xSourceBytesRemaining >= sizeof( DNSAnswerRecord_t ) + sizeof( uint32_t ) && \r
+ usChar2u16( pucByte ) == dnsTYPE_A_HOST )\r
{\r
- /* This is the required record. Skip the type, class, and\r
- time to live fields, plus the first byte of the data\r
- length. */\r
- pucByte += ( sizeof( uint32_t ) + sizeof( uint32_t ) + sizeof( uint8_t ) );\r
+ /* This is the required record type and is of sufficient size. */\r
+ pxDNSAnswerRecord = ( DNSAnswerRecord_t * )pucByte;\r
\r
- /* Sanity check the data length. */\r
- if( ( size_t ) *pucByte == sizeof( uint32_t ) )\r
+ /* Sanity check the data length of an IPv4 answer. */\r
+ if( FreeRTOS_ntohs( pxDNSAnswerRecord->usDataLength ) == sizeof( uint32_t ) )\r
{\r
- /* Skip the second byte of the length. */\r
- pucByte++;\r
-\r
/* Copy the IP address out of the record. */\r
- memcpy( ( void * ) &ulIPAddress, ( void * ) pucByte, sizeof( uint32_t ) );\r
+ memcpy( &ulIPAddress, \r
+ pucByte + sizeof( DNSAnswerRecord_t ),\r
+ sizeof( uint32_t ) );\r
\r
#if( ipconfigUSE_DNS_CACHE == 1 )\r
{\r
- prvProcessDNSCache( pcName, &ulIPAddress, pdFALSE );\r
+ prvProcessDNSCache( pcName, &ulIPAddress, pxDNSAnswerRecord->ulTTL, pdFALSE );\r
}\r
#endif /* ipconfigUSE_DNS_CACHE */\r
#if( ipconfigDNS_USE_CALLBACKS != 0 )\r
#endif /* ipconfigDNS_USE_CALLBACKS != 0 */\r
}\r
\r
+ pucByte += sizeof( DNSAnswerRecord_t ) + sizeof( uint32_t );\r
+ xSourceBytesRemaining -= ( sizeof( DNSAnswerRecord_t ) + sizeof( uint32_t ) );\r
break;\r
}\r
- else\r
+ else if( xSourceBytesRemaining >= sizeof( DNSAnswerRecord_t ) )\r
{\r
- /* Skip the type, class and time to live fields. */\r
- pucByte += ( sizeof( uint32_t ) + sizeof( uint32_t ) );\r
-\r
- /* Determine the length of the data in the field. */\r
- memcpy( ( void * ) &usDataLength, ( void * ) pucByte, sizeof( uint16_t ) );\r
- usDataLength = FreeRTOS_ntohs( usDataLength );\r
-\r
- /* Jump over the data length bytes, and the data itself. */\r
- pucByte += usDataLength + sizeof( uint16_t );\r
+ /* It's not an A record, so skip it. Get the header location \r
+ and then jump over the header. */\r
+ pxDNSAnswerRecord = ( DNSAnswerRecord_t * )pucByte;\r
+ pucByte += sizeof( DNSAnswerRecord_t );\r
+ xSourceBytesRemaining -= sizeof( DNSAnswerRecord_t );\r
+ \r
+ /* Determine the length of the answer data from the header. */\r
+ usDataLength = FreeRTOS_ntohs( pxDNSAnswerRecord->usDataLength );\r
+\r
+ /* Jump over the answer. */\r
+ if( xSourceBytesRemaining >= usDataLength )\r
+ {\r
+ pucByte += usDataLength;\r
+ xSourceBytesRemaining -= usDataLength;\r
+ }\r
+ else\r
+ {\r
+ /* Malformed response. */\r
+ return dnsPARSE_ERROR;\r
+ }\r
}\r
}\r
}\r
#if( ipconfigUSE_LLMNR == 1 )\r
- else if( ( usQuestions != ( uint16_t )0u ) && ( usType == ( uint16_t )dnsTYPE_A_HOST ) && ( usClass == ( uint16_t )dnsCLASS_IN ) )\r
+ else if( usQuestions && ( usType == dnsTYPE_A_HOST ) && ( usClass == dnsCLASS_IN ) )\r
{\r
/* If this is not a reply to our DNS request, it might an LLMNR\r
request. */\r
\r
if( ( xBufferAllocFixedSize == pdFALSE ) && ( pxNetworkBuffer != NULL ) )\r
{\r
- BaseType_t xDataLength = pxNetworkBuffer->xDataLength + sizeof( UDPHeader_t ) +\r
+ BaseType_t xDataLength = xBufferLength + sizeof( UDPHeader_t ) +\r
sizeof( EthernetHeader_t ) + sizeof( IPHeader_t );\r
\r
/* The field xDataLength was set to the length of the UDP payload.\r
{\r
pxAnswer = (LLMNRAnswer_t *)pucByte;\r
\r
- /* Leave 'usIdentifier' and 'usQuestions' untouched. */\r
+ /* We leave 'usIdentifier' and 'usQuestions' untouched */\r
vSetField16( pxDNSMessageHeader, DNSMessage_t, usFlags, dnsLLMNR_FLAGS_IS_REPONSE ); /* Set the response flag */\r
vSetField16( pxDNSMessageHeader, DNSMessage_t, usAnswers, 1 ); /* Provide a single answer */\r
vSetField16( pxDNSMessageHeader, DNSMessage_t, usAuthorityRRs, 0 ); /* No authority */\r
\r
#if( ipconfigUSE_NBNS == 1 )\r
\r
- static void prvTreatNBNS( uint8_t *pucUDPPayloadBuffer, uint32_t ulIPAddress )\r
+ static void prvTreatNBNS( uint8_t *pucUDPPayloadBuffer, size_t xBufferLength, uint32_t ulIPAddress )\r
{\r
uint16_t usFlags, usType, usClass;\r
uint8_t *pucSource, *pucTarget;\r
uint8_t ucByte;\r
uint8_t ucNBNSName[ 17 ];\r
\r
+ /* Check for minimum buffer size. */\r
+ if( xBufferLength < sizeof( NBNSRequest_t ) )\r
+ {\r
+ return;\r
+ }\r
+ \r
+ /* Read the request flags in host endianness. */\r
usFlags = usChar2u16( pucUDPPayloadBuffer + offsetof( NBNSRequest_t, usFlags ) );\r
\r
if( ( usFlags & dnsNBNS_FLAGS_OPCODE_MASK ) == dnsNBNS_FLAGS_OPCODE_QUERY )\r
{\r
/* If this is a response from another device,\r
add the name to the DNS cache */\r
- prvProcessDNSCache( ( char * ) ucNBNSName, &ulIPAddress, pdFALSE );\r
+ prvProcessDNSCache( ( char * ) ucNBNSName, &ulIPAddress, 0, pdFALSE );\r
}\r
}\r
#else\r
{\r
NetworkBufferDescriptor_t *pxNewBuffer;\r
BaseType_t xDataLength = pxNetworkBuffer->xDataLength + sizeof( UDPHeader_t ) +\r
-\r
sizeof( EthernetHeader_t ) + sizeof( IPHeader_t );\r
\r
/* The field xDataLength was set to the length of the UDP payload.\r
pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum );\r
\r
/* calculate the UDP checksum for outgoing package */\r
- usGenerateProtocolChecksum( ( uint8_t* ) pxUDPPacket, pdTRUE );\r
+ usGenerateProtocolChecksum( ( uint8_t* ) pxUDPPacket, lNetLength, pdTRUE );\r
}\r
#endif\r
\r
\r
#if( ipconfigUSE_DNS_CACHE == 1 )\r
\r
- static void prvProcessDNSCache( const char *pcName, uint32_t *pulIP, BaseType_t xLookUp )\r
+ static void prvProcessDNSCache( const char *pcName, uint32_t *pulIP, uint32_t ulTTL, BaseType_t xLookUp )\r
{\r
BaseType_t x;\r
BaseType_t xFound = pdFALSE;\r
+ uint32_t ulCurrentTimeSeconds = \r
+ xTaskGetTickCount( ) / portTICK_PERIOD_MS / 1000;\r
static BaseType_t xFreeEntry = 0;\r
\r
/* For each entry in the DNS cache table. */\r
break;\r
}\r
\r
- if( strncmp( xDNSCache[ x ].pcName, pcName, sizeof( xDNSCache[ x ].pcName ) ) == 0 )\r
+ if( 0 == strcmp( xDNSCache[ x ].pcName, pcName ) )\r
{\r
/* Is this function called for a lookup or to add/update an IP address? */\r
if( xLookUp != pdFALSE )\r
{\r
- *pulIP = xDNSCache[ x ].ulIPAddress;\r
+ /* Confirm that the record is still fresh. */\r
+ if( ulCurrentTimeSeconds < \r
+ xDNSCache[ x ].ulTimeWhenAddedInSeconds + \r
+ FreeRTOS_ntohl( xDNSCache[ x ].ulTTL ) )\r
+ {\r
+ *pulIP = xDNSCache[ x ].ulIPAddress;\r
+ }\r
+ else\r
+ {\r
+ /* Age out the old cached record. */\r
+ xDNSCache[ x ].pcName[ 0 ] = 0;\r
+ }\r
}\r
else\r
{\r
xDNSCache[ x ].ulIPAddress = *pulIP;\r
+ xDNSCache[ x ].ulTTL = ulTTL;\r
+ xDNSCache[ x ].ulTimeWhenAddedInSeconds = ulCurrentTimeSeconds;\r
}\r
\r
xFound = pdTRUE;\r
}\r
else\r
{\r
- /* Called to add or update an item */\r
- strncpy( xDNSCache[ xFreeEntry ].pcName, pcName, sizeof( xDNSCache[ xFreeEntry ].pcName ) );\r
- xDNSCache[ xFreeEntry ].ulIPAddress = *pulIP;\r
-\r
- xFreeEntry++;\r
- if( xFreeEntry == ipconfigDNS_CACHE_ENTRIES )\r
- {\r
- xFreeEntry = 0;\r
- }\r
+ /* Add or update the item. */\r
+ if( strlen( pcName ) < ipconfigDNS_CACHE_NAME_LENGTH )\r
+ {\r
+ strcpy( xDNSCache[ xFreeEntry ].pcName, pcName );\r
+\r
+ xDNSCache[ xFreeEntry ].ulIPAddress = *pulIP;\r
+ xDNSCache[ xFreeEntry ].ulTTL = ulTTL;\r
+ xDNSCache[ xFreeEntry ].ulTimeWhenAddedInSeconds = ulCurrentTimeSeconds;\r
+\r
+ xFreeEntry++;\r
+ if( xFreeEntry == ipconfigDNS_CACHE_ENTRIES )\r
+ {\r
+ xFreeEntry = 0;\r
+ }\r
+ }\r
}\r
}\r
\r
\r
#endif /* ipconfigUSE_DNS != 0 */\r
\r
+/*-----------------------------------------------------------*/\r
\r
+/* Provide access to private members for testing. */\r
+#ifdef AMAZON_FREERTOS_ENABLE_UNIT_TESTS\r
+ #include "aws_freertos_tcp_test_access_dns_define.h"\r
+#endif\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
\r
\r
/* Time delay between repeated attempts to initialise the network hardware. */\r
-#ifndef ipINITIALISATION_RETRY_DELAY\r
- #define ipINITIALISATION_RETRY_DELAY ( pdMS_TO_TICKS( 3000 ) )\r
-#endif\r
+#define ipINITIALISATION_RETRY_DELAY ( pdMS_TO_TICKS( 3000 ) )\r
\r
/* Defines how often the ARP timer callback function is executed. The time is\r
shorted in the Windows simulator as simulated time is not real time. */\r
/*\r
* Process incoming IP packets.\r
*/\r
-static eFrameProcessingResult_t prvProcessIPPacket( const IPPacket_t * const pxIPPacket, NetworkBufferDescriptor_t * const pxNetworkBuffer );\r
+static eFrameProcessingResult_t prvProcessIPPacket( IPPacket_t * const pxIPPacket, NetworkBufferDescriptor_t * const pxNetworkBuffer );\r
\r
#if ( ipconfigREPLY_TO_INCOMING_PINGS == 1 ) || ( ipconfigSUPPORT_OUTGOING_PINGS == 1 )\r
/*\r
/* Calculate the acceptable maximum sleep time. */\r
xNextIPSleep = prvCalculateSleepTime();\r
\r
- /* Wait until there is something to do. The event is initialised to "no\r
- event" in case the following call exits due to a time out rather than a\r
- message being received. */\r
- xReceivedEvent.eEventType = eNoEvent;\r
- xQueueReceive( xNetworkEventQueue, ( void * ) &xReceivedEvent, xNextIPSleep );\r
+ /* Wait until there is something to do. If the following call exits\r
+ * due to a time out rather than a message being received, set a\r
+ * 'NoEvent' value. */\r
+ if ( xQueueReceive( xNetworkEventQueue, ( void * ) &xReceivedEvent, xNextIPSleep ) == pdFALSE ) {\r
+ xReceivedEvent.eEventType = eNoEvent;\r
+ }\r
\r
#if( ipconfigCHECK_IP_QUEUE_SPACE != 0 )\r
{\r
#if( ipconfigUSE_TCP == 1 )\r
{\r
BaseType_t xWillSleep;\r
- /* xStart keeps a copy of the last time this function was active,\r
- and during every call it will be updated with xTaskGetTickCount()\r
- '0' means: not yet initialised (although later '0' might be returned\r
- by xTaskGetTickCount(), which is no problem). */\r
- static TickType_t xStart = ( TickType_t ) 0;\r
- TickType_t xTimeNow, xNextTime;\r
+ TickType_t xNextTime;\r
BaseType_t xCheckTCPSockets;\r
- extern uint32_t ulNextInitialSequenceNumber;\r
\r
if( uxQueueMessagesWaiting( xNetworkEventQueue ) == 0u )\r
{\r
xWillSleep = pdFALSE;\r
}\r
\r
- xTimeNow = xTaskGetTickCount();\r
-\r
- if( xStart != ( TickType_t ) 0 )\r
- {\r
- /* It is advised to increment the Initial Sequence Number every 4\r
- microseconds which makes 250 times per ms. This will make it harder\r
- for a third party to 'guess' our sequence number and 'take over'\r
- a TCP connection */\r
- ulNextInitialSequenceNumber += ipINITIAL_SEQUENCE_NUMBER_FACTOR * ( ( xTimeNow - xStart ) * portTICK_PERIOD_MS );\r
- }\r
-\r
- xStart = xTimeNow;\r
-\r
/* Sockets need to be checked if the TCP timer has expired. */\r
xCheckTCPSockets = prvIPTimerCheck( &xTCPTimer );\r
\r
\r
if( pxNetworkBuffer != NULL )\r
{\r
+ /* Set the actual packet size in case a bigger buffer was returned. */\r
+ pxNetworkBuffer->xDataLength = \r
+ sizeof( UDPPacket_t ) + xRequestedSizeBytes;\r
+\r
/* Leave space for the UPD header. */\r
pvReturn = ( void * ) &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );\r
}\r
\r
if( pxNewBuffer != NULL )\r
{\r
+ /* Set the actual packet size in case a bigger buffer than requested \r
+ was returned. */\r
+ pxNewBuffer->xDataLength = xNewLength;\r
+\r
+ /* Copy the original packet information. */\r
pxNewBuffer->ulIPAddress = pxNetworkBuffer->ulIPAddress;\r
pxNewBuffer->usPort = pxNetworkBuffer->usPort;\r
pxNewBuffer->usBoundPort = pxNetworkBuffer->usBoundPort;\r
\r
/* Added to prevent ARP flood to gateway. Ensure the\r
gateway is on the same subnet as the IP address. */\r
- if( xNetworkAddressing.ulGatewayAddress != 0ul )\r
- {\r
- configASSERT( ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) == ( xNetworkAddressing.ulGatewayAddress & xNetworkAddressing.ulNetMask ) );\r
- }\r
+ configASSERT( ( ( *ipLOCAL_IP_ADDRESS_POINTER ) & xNetworkAddressing.ulNetMask ) == ( xNetworkAddressing.ulGatewayAddress & xNetworkAddressing.ulNetMask ) );\r
}\r
#endif /* ipconfigUSE_DHCP == 1 */\r
\r
memcpy( ( void * ) ipLOCAL_MAC_ADDRESS, ( void * ) ucMACAddress, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );\r
\r
/* Prepare the sockets interface. */\r
- vNetworkSocketsInit();\r
-\r
- /* Create the task that processes Ethernet and stack events. */\r
- xReturn = xTaskCreate( prvIPTask, "IP-task", ( uint16_t ) ipconfigIP_TASK_STACK_SIZE_WORDS, NULL, ( UBaseType_t ) ipconfigIP_TASK_PRIORITY, &xIPTaskHandle );\r
+ xReturn = vNetworkSocketsInit();\r
+ \r
+ if( pdTRUE == xReturn )\r
+ {\r
+ /* Create the task that processes Ethernet and stack events. */\r
+ xReturn = xTaskCreate( prvIPTask, "IP-task", ( uint16_t )ipconfigIP_TASK_STACK_SIZE_WORDS, NULL, ( UBaseType_t )ipconfigIP_TASK_PRIORITY, &xIPTaskHandle );\r
+ }\r
}\r
else\r
{\r
static void prvProcessEthernetPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer )\r
{\r
EthernetHeader_t *pxEthernetHeader;\r
-volatile eFrameProcessingResult_t eReturned; /* Volatile to prevent complier warnings when ipCONSIDER_FRAME_FOR_PROCESSING just sets it to eProcessBuffer. */\r
+eFrameProcessingResult_t eReturned = eReleaseBuffer;\r
\r
configASSERT( pxNetworkBuffer );\r
\r
/* Interpret the Ethernet frame. */\r
- eReturned = ipCONSIDER_FRAME_FOR_PROCESSING( pxNetworkBuffer->pucEthernetBuffer );\r
- pxEthernetHeader = ( EthernetHeader_t * ) ( pxNetworkBuffer->pucEthernetBuffer );\r
-\r
- if( eReturned == eProcessBuffer )\r
- {\r
- /* Interpret the received Ethernet packet. */\r
- switch( pxEthernetHeader->usFrameType )\r
- {\r
- case ipARP_FRAME_TYPE :\r
- /* The Ethernet frame contains an ARP packet. */\r
- eReturned = eARPProcessPacket( ( ARPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer );\r
- break;\r
-\r
- case ipIPv4_FRAME_TYPE :\r
- /* The Ethernet frame contains an IP packet. */\r
- eReturned = prvProcessIPPacket( ( IPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer, pxNetworkBuffer );\r
- break;\r
-\r
- default :\r
- /* No other packet types are handled. Nothing to do. */\r
- eReturned = eReleaseBuffer;\r
- break;\r
- }\r
- }\r
+ if( pxNetworkBuffer->xDataLength >= sizeof( EthernetHeader_t ) )\r
+ {\r
+ eReturned = ipCONSIDER_FRAME_FOR_PROCESSING( pxNetworkBuffer->pucEthernetBuffer );\r
+ pxEthernetHeader = ( EthernetHeader_t * )( pxNetworkBuffer->pucEthernetBuffer );\r
+\r
+ if( eReturned == eProcessBuffer )\r
+ {\r
+ /* Interpret the received Ethernet packet. */\r
+ switch( pxEthernetHeader->usFrameType )\r
+ {\r
+ case ipARP_FRAME_TYPE:\r
+ /* The Ethernet frame contains an ARP packet. */\r
+ if( pxNetworkBuffer->xDataLength >= sizeof( ARPPacket_t ) )\r
+ {\r
+ eReturned = eARPProcessPacket( ( ARPPacket_t * )pxNetworkBuffer->pucEthernetBuffer );\r
+ }\r
+ else\r
+ {\r
+ eReturned = eReleaseBuffer;\r
+ }\r
+ break;\r
+\r
+ case ipIPv4_FRAME_TYPE:\r
+ /* The Ethernet frame contains an IP packet. */\r
+ if( pxNetworkBuffer->xDataLength >= sizeof( IPPacket_t ) )\r
+ {\r
+ eReturned = prvProcessIPPacket( ( IPPacket_t * )pxNetworkBuffer->pucEthernetBuffer, pxNetworkBuffer );\r
+ }\r
+ else\r
+ {\r
+ eReturned = eReleaseBuffer;\r
+ }\r
+ break;\r
+\r
+ default:\r
+ /* No other packet types are handled. Nothing to do. */\r
+ eReturned = eReleaseBuffer;\r
+ break;\r
+ }\r
+ }\r
+ }\r
\r
/* Perform any actions that resulted from processing the Ethernet frame. */\r
switch( eReturned )\r
This method may decrease the usage of sparse network buffers. */\r
uint32_t ulDestinationIPAddress = pxIPHeader->ulDestinationIPAddress;\r
\r
- /* Ensure that the incoming packet is not fragmented (fragmentation\r
- was only supported for outgoing packets, and is not currently\r
- not supported at all). */\r
+ /* Ensure that the incoming packet is not fragmented (only outgoing\r
+ packets can be fragmented) as these are the only handled IP frames\r
+ currently. */\r
if( ( pxIPHeader->usFragmentOffset & ipFRAGMENT_OFFSET_BIT_MASK ) != 0U )\r
{\r
/* Can not handle, fragmented packet. */\r
eReturn = eReleaseBuffer;\r
}\r
/* Is the upper-layer checksum (TCP/UDP/ICMP) correct? */\r
- else if( usGenerateProtocolChecksum( ( uint8_t * )( pxNetworkBuffer->pucEthernetBuffer ), pdFALSE ) != ipCORRECT_CRC )\r
+ else if( usGenerateProtocolChecksum( ( uint8_t * )( pxNetworkBuffer->pucEthernetBuffer ), pxNetworkBuffer->xDataLength, pdFALSE ) != ipCORRECT_CRC )\r
{\r
/* Protocol checksum not accepted. */\r
eReturn = eReleaseBuffer;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static eFrameProcessingResult_t prvProcessIPPacket( const IPPacket_t * const pxIPPacket, NetworkBufferDescriptor_t * const pxNetworkBuffer )\r
+static eFrameProcessingResult_t prvProcessIPPacket( IPPacket_t * const pxIPPacket, NetworkBufferDescriptor_t * const pxNetworkBuffer )\r
{\r
eFrameProcessingResult_t eReturn;\r
-const IPHeader_t * pxIPHeader = &( pxIPPacket->xIPHeader );\r
+IPHeader_t * pxIPHeader = &( pxIPPacket->xIPHeader );\r
UBaseType_t uxHeaderLength = ( UBaseType_t ) ( ( pxIPHeader->ucVersionHeaderLength & 0x0Fu ) << 2 );\r
uint8_t ucProtocol;\r
\r
+ /* Bound the calculated header length: take away the Ethernet header size,\r
+ then check if the IP header is claiming to be longer than the remaining\r
+ total packet size. Also check for minimal header field length. */\r
+ if( uxHeaderLength > pxNetworkBuffer->xDataLength - ipSIZE_OF_ETH_HEADER ||\r
+ uxHeaderLength < ipSIZE_OF_IPv4_HEADER )\r
+ {\r
+ return eReleaseBuffer;\r
+ }\r
+\r
ucProtocol = pxIPPacket->xIPHeader.ucProtocol;\r
/* Check if the IP headers are acceptable and if it has our destination. */\r
eReturn = prvAllowIPPacket( pxIPPacket, pxNetworkBuffer, uxHeaderLength );\r
* Note: IP options are mostly use in Multi-cast protocols */\r
const size_t optlen = ( ( size_t ) uxHeaderLength ) - ipSIZE_OF_IPv4_HEADER;\r
/* From: the previous start of UDP/ICMP/TCP data */\r
- uint8_t *pucSource = ( ( uint8_t * ) pxIPHeader ) + uxHeaderLength;\r
+ uint8_t *pucSource = ( uint8_t* )(pxNetworkBuffer->pucEthernetBuffer + sizeof( EthernetHeader_t ) + uxHeaderLength);\r
/* To: the usual start of UDP/ICMP/TCP data at offset 20 from IP header */\r
- uint8_t *pucTarget = ( ( uint8_t * ) pxIPHeader ) + ipSIZE_OF_IPv4_HEADER;\r
+ uint8_t *pucTarget = ( uint8_t* )(pxNetworkBuffer->pucEthernetBuffer + sizeof( EthernetHeader_t ) + ipSIZE_OF_IPv4_HEADER);\r
/* How many: total length minus the options and the lower headers */\r
const size_t xMoveLen = pxNetworkBuffer->xDataLength - optlen - ipSIZE_OF_IPv4_HEADER - ipSIZE_OF_ETH_HEADER;\r
\r
memmove( pucTarget, pucSource, xMoveLen );\r
pxNetworkBuffer->xDataLength -= optlen;\r
+\r
+ /* Fix-up new version/header length field in IP packet. */\r
+ pxIPHeader->ucVersionHeaderLength =\r
+ ( pxIPHeader->ucVersionHeaderLength & 0xF0 ) | /* High nibble is the version. */\r
+ ( ( ipSIZE_OF_IPv4_HEADER >> 2 ) & 0x0F ); /* Low nibble is the header size, in bytes, divided by four. */\r
}\r
+\r
/* Add the IP and MAC addresses to the ARP table if they are not\r
already there - otherwise refresh the age of the existing\r
entry. */\r
be able to validate what it receives. */\r
#if ( ipconfigREPLY_TO_INCOMING_PINGS == 1 ) || ( ipconfigSUPPORT_OUTGOING_PINGS == 1 )\r
{\r
- ICMPPacket_t *pxICMPPacket = ( ICMPPacket_t * ) ( pxNetworkBuffer->pucEthernetBuffer );\r
- if( pxIPHeader->ulDestinationIPAddress == *ipLOCAL_IP_ADDRESS_POINTER )\r
- {\r
- eReturn = prvProcessICMPPacket( pxICMPPacket );\r
- }\r
+ if( pxNetworkBuffer->xDataLength >= sizeof( ICMPPacket_t ) )\r
+ {\r
+ ICMPPacket_t *pxICMPPacket = ( ICMPPacket_t * )( pxNetworkBuffer->pucEthernetBuffer );\r
+ if( pxIPHeader->ulDestinationIPAddress == *ipLOCAL_IP_ADDRESS_POINTER )\r
+ {\r
+ eReturn = prvProcessICMPPacket( pxICMPPacket );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ eReturn = eReleaseBuffer;\r
+ }\r
}\r
#endif /* ( ipconfigREPLY_TO_INCOMING_PINGS == 1 ) || ( ipconfigSUPPORT_OUTGOING_PINGS == 1 ) */\r
break;\r
/* The IP packet contained a UDP frame. */\r
UDPPacket_t *pxUDPPacket = ( UDPPacket_t * ) ( pxNetworkBuffer->pucEthernetBuffer );\r
\r
- /* Note the header values required prior to the\r
- checksum generation as the checksum pseudo header\r
- may clobber some of these values. */\r
- pxNetworkBuffer->xDataLength = FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) - sizeof( UDPHeader_t );\r
- /* HT:endian: fields in pxNetworkBuffer (usPort, ulIPAddress) were network order */\r
- pxNetworkBuffer->usPort = pxUDPPacket->xUDPHeader.usSourcePort;\r
- pxNetworkBuffer->ulIPAddress = pxUDPPacket->xIPHeader.ulSourceIPAddress;\r
-\r
- /* ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM:\r
- * In some cases, the upper-layer checksum has been calculated\r
- * by the NIC driver */\r
- /* Pass the packet payload to the UDP sockets implementation. */\r
- /* HT:endian: xProcessReceivedUDPPacket wanted network order */\r
- if( xProcessReceivedUDPPacket( pxNetworkBuffer, pxUDPPacket->xUDPHeader.usDestinationPort ) == pdPASS )\r
- {\r
- eReturn = eFrameConsumed;\r
- }\r
+ /* Only proceed if the payload length indicated in the header\r
+ appears to be valid. */\r
+ if ( pxNetworkBuffer->xDataLength >= sizeof( UDPPacket_t ) )\r
+ {\r
+ /* Ensure that downstream UDP packet handling has the lesser\r
+ * of: the actual network buffer Ethernet frame length, or \r
+ * the sender's UDP packet header payload length, minus the\r
+ * size of the UDP header. \r
+ *\r
+ * The size of the UDP packet structure in this implementation \r
+ * includes the size of the Ethernet header, the size of \r
+ * the IP header, and the size of the UDP header.\r
+ */\r
+ \r
+ pxNetworkBuffer->xDataLength -= sizeof( UDPPacket_t );\r
+ if( ( FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) - sizeof( UDPHeader_t ) ) <\r
+ pxNetworkBuffer->xDataLength )\r
+ {\r
+ pxNetworkBuffer->xDataLength = FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usLength ) - \r
+ sizeof( UDPHeader_t );\r
+ }\r
+\r
+ /* Fields in pxNetworkBuffer (usPort, ulIPAddress) are network order. */\r
+ pxNetworkBuffer->usPort = pxUDPPacket->xUDPHeader.usSourcePort;\r
+ pxNetworkBuffer->ulIPAddress = pxUDPPacket->xIPHeader.ulSourceIPAddress;\r
+\r
+ /* ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM:\r
+ * In some cases, the upper-layer checksum has been calculated\r
+ * by the NIC driver.\r
+ * \r
+ * Pass the packet payload to the UDP sockets implementation. */\r
+ if( xProcessReceivedUDPPacket( pxNetworkBuffer, \r
+ pxUDPPacket->xUDPHeader.usDestinationPort ) == pdPASS )\r
+ {\r
+ eReturn = eFrameConsumed;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ eReturn = eReleaseBuffer;\r
+ }\r
}\r
break;\r
\r
#endif /* ( ipconfigREPLY_TO_INCOMING_PINGS == 1 ) || ( ipconfigSUPPORT_OUTGOING_PINGS == 1 ) */\r
/*-----------------------------------------------------------*/\r
\r
-uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, BaseType_t xOutgoingPacket )\r
+uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket )\r
{\r
uint32_t ulLength;\r
uint16_t usChecksum, *pusChecksum;\r
const char *pcType;\r
#endif\r
\r
- pxIPPacket = ( const IPPacket_t * ) pucEthernetBuffer;\r
- uxIPHeaderLength = ( UBaseType_t ) ( 4u * ( pxIPPacket->xIPHeader.ucVersionHeaderLength & 0x0Fu ) ); /*_RB_ Why 4? */\r
- pxProtPack = ( ProtocolPacket_t * ) ( pucEthernetBuffer + ( uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ) );\r
- ucProtocol = pxIPPacket->xIPHeader.ucProtocol;\r
+ /* Check for minimum packet size. */\r
+ if( uxBufferLength < sizeof( IPPacket_t ) )\r
+ {\r
+ return ipINVALID_LENGTH;\r
+ }\r
\r
+ /* Parse the packet length. */\r
+ pxIPPacket = ( const IPPacket_t * ) pucEthernetBuffer;\r
+ \r
+ /* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header \r
+ Length field contains the length of the internet header in 32-bit words. */\r
+ uxIPHeaderLength = ( UBaseType_t ) \r
+ ( sizeof( uint32_t ) * ( pxIPPacket->xIPHeader.ucVersionHeaderLength & 0x0Fu ) ); \r
+\r
+ /* Check for minimum packet size. */\r
+ if( uxBufferLength < sizeof( IPPacket_t ) + uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER )\r
+ {\r
+ return ipINVALID_LENGTH;\r
+ }\r
+ if( uxBufferLength < FreeRTOS_ntohs( pxIPPacket->xIPHeader.usLength ) )\r
+ {\r
+ return ipINVALID_LENGTH;\r
+ }\r
+\r
+ /* Identify the next protocol. */\r
+ ucProtocol = pxIPPacket->xIPHeader.ucProtocol; \r
+\r
+ /* N.B., if this IP packet header includes Options, then the following \r
+ assignment results in a pointer into the protocol packet with the Ethernet \r
+ and IP headers incorrectly aligned. However, either way, the "third"\r
+ protocol (Layer 3 or 4) header will be aligned, which is the convenience \r
+ of this calculation. */\r
+ pxProtPack = ( ProtocolPacket_t * ) ( pucEthernetBuffer + ( uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ) );\r
+\r
+ /* Switch on the Layer 3/4 protocol. */\r
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )\r
{\r
+ if( uxBufferLength < uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_UDP_HEADER )\r
+ {\r
+ return ipINVALID_LENGTH;\r
+ }\r
+\r
pusChecksum = ( uint16_t * ) ( &( pxProtPack->xUDPPacket.xUDPHeader.usChecksum ) );\r
#if( ipconfigHAS_DEBUG_PRINTF != 0 )\r
{\r
}\r
else if( ucProtocol == ( uint8_t ) ipPROTOCOL_TCP )\r
{\r
- pusChecksum = ( uint16_t * ) ( &( pxProtPack->xTCPPacket.xTCPHeader.usChecksum ) );\r
+ if( uxBufferLength < uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_TCP_HEADER )\r
+ {\r
+ return ipINVALID_LENGTH;\r
+ }\r
+ \r
+ pusChecksum = ( uint16_t * ) ( &( pxProtPack->xTCPPacket.xTCPHeader.usChecksum ) );\r
#if( ipconfigHAS_DEBUG_PRINTF != 0 )\r
{\r
pcType = "TCP";\r
else if( ( ucProtocol == ( uint8_t ) ipPROTOCOL_ICMP ) ||\r
( ucProtocol == ( uint8_t ) ipPROTOCOL_IGMP ) )\r
{\r
- pusChecksum = ( uint16_t * ) ( &( pxProtPack->xICMPPacket.xICMPHeader.usChecksum ) );\r
-\r
+ if( uxBufferLength < uxIPHeaderLength + ipSIZE_OF_ETH_HEADER + ipSIZE_OF_ICMP_HEADER )\r
+ {\r
+ return ipINVALID_LENGTH;\r
+ }\r
+ \r
+ pusChecksum = ( uint16_t * ) ( &( pxProtPack->xICMPPacket.xICMPHeader.usChecksum ) );\r
#if( ipconfigHAS_DEBUG_PRINTF != 0 )\r
{\r
if( ucProtocol == ( uint8_t ) ipPROTOCOL_ICMP )\r
return ipUNHANDLED_PROTOCOL;\r
}\r
\r
+ /* The protocol and checksum field have been identified. Check the direction\r
+ of the packet. */\r
if( xOutgoingPacket != pdFALSE )\r
{\r
/* This is an outgoing packet. Before calculating the checksum, set it\r
/* And then continue at the IPv4 source and destination addresses. */\r
usChecksum = ( uint16_t )\r
( ~usGenerateChecksum( ( uint32_t ) usChecksum, ( uint8_t * )&( pxIPPacket->xIPHeader.ulSourceIPAddress ),\r
- ( size_t )( 2u * sizeof( pxIPPacket->xIPHeader.ulSourceIPAddress ) + ulLength ) ) );\r
+ ( 2u * sizeof( pxIPPacket->xIPHeader.ulSourceIPAddress ) + ulLength ) ) );\r
\r
/* Sum TCP header and data. */\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/**\r
+ * This method generates a checksum for a given IPv4 header, per RFC791 (page 14).\r
+ * The checksum algorithm is decribed as:\r
+ * "[T]he 16 bit one's complement of the one's complement sum of all 16 bit words in the\r
+ * header. For purposes of computing the checksum, the value of the checksum field is zero."\r
+ *\r
+ * In a nutshell, that means that each 16-bit 'word' must be summed, after which\r
+ * the number of 'carries' (overflows) is added to the result. If that addition\r
+ * produces an overflow, that 'carry' must also be added to the final result. The final checksum\r
+ * should be the bitwise 'not' (ones-complement) of the result if the packet is\r
+ * meant to be transmitted, but this method simply returns the raw value, probably\r
+ * because when a packet is received, the checksum is verified by checking that\r
+ * ((received & calculated) == 0) without applying a bitwise 'not' to the 'calculated' checksum.\r
+ *\r
+ * This logic is optimized for microcontrollers which have limited resources, so the logic looks odd.\r
+ * It iterates over the full range of 16-bit words, but it does so by processing several 32-bit\r
+ * words at once whenever possible. Its first step is to align the memory pointer to a 32-bit boundary,\r
+ * after which it runs a fast loop to process multiple 32-bit words at once and adding their 'carries'.\r
+ * Finally, it finishes up by processing any remaining 16-bit words, and adding up all of the 'carries'.\r
+ * With 32-bit arithmetic, the number of 16-bit 'carries' produced by sequential additions can be found\r
+ * by looking at the 16 most-significant bits of the 32-bit integer, since a 32-bit int will continue\r
+ * counting up instead of overflowing after 16 bits. That is why the actual checksum calculations look like:\r
+ * union.u32 = ( uint32_t ) union.u16[ 0 ] + union.u16[ 1 ];\r
+ *\r
+ * Arguments:\r
+ * ulSum: This argument provides a value to initialize the progressive summation\r
+ * of the header's values to. It is often 0, but protocols like TCP or UDP\r
+ * can have pseudo-header fields which need to be included in the checksum.\r
+ * pucNextData: This argument contains the address of the first byte which this\r
+ * method should process. The method's memory iterator is initialized to this value.\r
+ * uxDataLengthBytes: This argument contains the number of bytes that this method\r
+ * should process.\r
+ */\r
uint16_t usGenerateChecksum( uint32_t ulSum, const uint8_t * pucNextData, size_t uxDataLengthBytes )\r
{\r
xUnion32 xSum2, xSum, xTerm;\r
\r
void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ipMAC_ADDRESS_LENGTH_BYTES] )\r
{\r
- /* Copy the MAC address at the start of the default packet header fragment. */\r
- memcpy( ( void * )ipLOCAL_MAC_ADDRESS, ( void * )ucMACAddress, ( size_t )ipMAC_ADDRESS_LENGTH_BYTES );\r
+ /* Copy the MAC address at the start of the default packet header fragment. */\r
+ memcpy( ( void * )ipLOCAL_MAC_ADDRESS, ( void * )ucMACAddress, ( size_t )ipMAC_ADDRESS_LENGTH_BYTES );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
number then, depending on the FreeRTOSIPConfig.h settings, it might be that a\r
port number is automatically generated for the socket. Automatically generated\r
port numbers will be between socketAUTO_PORT_ALLOCATION_START_NUMBER and\r
-0xffff. */\r
-/* _HT_ thinks that the default of 0xc000 is pretty high */\r
+0xffff. \r
+\r
+Per https://tools.ietf.org/html/rfc6056, "the dynamic ports consist of the range\r
+49152-65535. However, ephemeral port selection algorithms should use the whole \r
+range 1024-65535" excluding those already in use (inbound or outbound). */\r
#if !defined( socketAUTO_PORT_ALLOCATION_START_NUMBER )\r
- #define socketAUTO_PORT_ALLOCATION_START_NUMBER ( ( uint16_t ) 0xc000 )\r
+ #define socketAUTO_PORT_ALLOCATION_START_NUMBER ( ( uint16_t ) 0x0400 )\r
#endif\r
\r
-/* When the automatically generated port numbers overflow, the next value used\r
-is not set back to socketAUTO_PORT_ALLOCATION_START_NUMBER because it is likely\r
-that the first few automatically generated ports will still be in use. Instead\r
-it is reset back to the value defined by this constant. */\r
-#define socketAUTO_PORT_ALLOCATION_RESET_NUMBER ( ( uint16_t ) 0xc100 )\r
-#define socketAUTO_PORT_ALLOCATION_MAX_NUMBER ( ( uint16_t ) 0xff00 )\r
+#define socketAUTO_PORT_ALLOCATION_MAX_NUMBER ( ( uint16_t ) 0xffff )\r
\r
/* The number of octets that make up an IP address. */\r
#define socketMAX_IP_ADDRESS_OCTETS 4u\r
List_t xBoundTCPSocketsList;\r
#endif /* ipconfigUSE_TCP == 1 */\r
\r
-/* Holds the next private port number to use when binding a client socket for\r
-UDP, and if ipconfigUSE_TCP is set to 1, also TCP. UDP uses index\r
-socketNEXT_UDP_PORT_NUMBER_INDEX and TCP uses index\r
-socketNEXT_TCP_PORT_NUMBER_INDEX. The initial value is set to be between\r
-socketAUTO_PORT_ALLOCATION_RESET_NUMBER and socketAUTO_PORT_ALLOCATION_MAX_NUMBER\r
-when the IP stack is initialised. Note ipconfigRAND32() is used, which must be\r
-seeded prior to the IP task being started. */\r
-static uint16_t usNextPortToUse[ socketPROTOCOL_COUNT ] = { 0 };\r
-\r
/*-----------------------------------------------------------*/\r
\r
static BaseType_t prvValidSocket( FreeRTOS_Socket_t *pxSocket, BaseType_t xProtocol, BaseType_t xIsBound )\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vNetworkSocketsInit( void )\r
+BaseType_t vNetworkSocketsInit( void )\r
{\r
-const uint32_t ulAutoPortRange = socketAUTO_PORT_ALLOCATION_MAX_NUMBER - socketAUTO_PORT_ALLOCATION_RESET_NUMBER;\r
-uint32_t ulRandomPort;\r
-\r
- vListInitialise( &xBoundUDPSocketsList );\r
-\r
- /* Determine the first anonymous UDP port number to get assigned. Give it\r
- a random value in order to avoid confusion about port numbers being used\r
- earlier, before rebooting the device. Start with the first auto port\r
- number, then add a random offset up to a maximum of the range of numbers. */\r
- ulRandomPort = socketAUTO_PORT_ALLOCATION_START_NUMBER;\r
- ulRandomPort += ( ipconfigRAND32() % ulAutoPortRange );\r
- usNextPortToUse[ socketNEXT_UDP_PORT_NUMBER_INDEX ] = ( uint16_t ) ulRandomPort;\r
-\r
- #if( ipconfigUSE_TCP == 1 )\r
- {\r
- extern uint32_t ulNextInitialSequenceNumber;\r
+ vListInitialise( &xBoundUDPSocketsList );\r
\r
- ulNextInitialSequenceNumber = ipconfigRAND32();\r
+ #if( ipconfigUSE_TCP == 1 )\r
+ {\r
+ vListInitialise( &xBoundTCPSocketsList );\r
+ }\r
+ #endif /* ipconfigUSE_TCP == 1 */\r
\r
- /* Determine the first anonymous TCP port number to get assigned. */\r
- ulRandomPort = socketAUTO_PORT_ALLOCATION_START_NUMBER;\r
- ulRandomPort += ( ipconfigRAND32() % ulAutoPortRange );\r
- usNextPortToUse[ socketNEXT_TCP_PORT_NUMBER_INDEX ] = ( uint16_t ) ulRandomPort;\r
-\r
- vListInitialise( &xBoundTCPSocketsList );\r
- }\r
- #endif /* ipconfigUSE_TCP == 1 */\r
+ return pdTRUE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
if( xType != FREERTOS_SOCK_DGRAM )\r
{\r
xReturn = pdFAIL;\r
+ configASSERT( xReturn );\r
}\r
/* In case a UDP socket is created, do not allocate space for TCP data. */\r
*pxSocketSize = ( sizeof( *pxSocket ) - sizeof( pxSocket->u ) ) + sizeof( pxSocket->u.xUDP );\r
if( xType != FREERTOS_SOCK_STREAM )\r
{\r
xReturn = pdFAIL;\r
+ configASSERT( xReturn );\r
}\r
\r
*pxSocketSize = ( sizeof( *pxSocket ) - sizeof( pxSocket->u ) ) + sizeof( pxSocket->u.xTCP );\r
else\r
{\r
xReturn = pdFAIL;\r
+ configASSERT( xReturn );\r
}\r
}\r
/* In case configASSERT() is not used */\r
}\r
else\r
{\r
- /* Clear the entire space to avoid nulling individual entries. */\r
+ /* Clear the entire space to avoid nulling individual entries */\r
memset( pxSocket, '\0', uxSocketSize );\r
\r
pxSocket->xEventGroup = xEventGroup;\r
#if( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND == 1 )\r
{\r
/* pxAddress will be NULL if sendto() was called on a socket without the\r
- socket being bound to an address. In this case, automatically allocate\r
- an address to the socket. There is a very tiny chance that the allocated\r
- port will already be in use - if that is the case, then the check below\r
- [pxListFindListItemWithValue()] will result in an error being returned. */\r
+ socket being bound to an address. In this case, automatically allocate\r
+ an address and port to the socket. */\r
if( pxAddress == NULL )\r
{\r
pxAddress = &xAddress;\r
- /* For now, put it to zero, will be assigned later */\r
+ /* Put the port to zero to be assigned later. */\r
pxAddress->sin_port = 0u;\r
}\r
}\r
{\r
if( pxAddress->sin_port == 0u )\r
{\r
- pxAddress->sin_port = prvGetPrivatePortNumber( ( BaseType_t ) pxSocket->ucProtocol );\r
+ pxAddress->sin_port = prvGetPrivatePortNumber( ( BaseType_t )pxSocket->ucProtocol ); \r
+ if( 0 == pxAddress->sin_port )\r
+ {\r
+ return -pdFREERTOS_ERRNO_EADDRNOTAVAIL;\r
+ }\r
}\r
\r
/* If vSocketBind() is called from the API FreeRTOS_bind() it has been\r
if( pxSocket->u.xTCP.xTCPWindow.u.bits.bHasInit != pdFALSE_UNSIGNED )\r
{\r
pxSocket->u.xTCP.xTCPWindow.xSize.ulRxWindowLength = pxSocket->u.xTCP.uxRxWinSize * pxSocket->u.xTCP.usInitMSS;\r
- pxSocket->u.xTCP.xTCPWindow.xSize.ulRxWindowLength = pxSocket->u.xTCP.uxTxWinSize * pxSocket->u.xTCP.usInitMSS;\r
+ pxSocket->u.xTCP.xTCPWindow.xSize.ulTxWindowLength = pxSocket->u.xTCP.uxTxWinSize * pxSocket->u.xTCP.usInitMSS;\r
}\r
}\r
\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* Get a free private ('anonymous') port number */\r
+/* Find an available port number per https://tools.ietf.org/html/rfc6056. */\r
static uint16_t prvGetPrivatePortNumber( BaseType_t xProtocol )\r
{\r
-uint16_t usResult;\r
-BaseType_t xIndex;\r
+const uint16_t usEphemeralPortCount = \r
+ socketAUTO_PORT_ALLOCATION_MAX_NUMBER - socketAUTO_PORT_ALLOCATION_START_NUMBER + 1;\r
+uint16_t usIterations = usEphemeralPortCount; \r
+uint32_t ulRandomSeed = 0;\r
+uint16_t usResult = 0;\r
+BaseType_t xGotZeroOnce = pdFALSE;\r
const List_t *pxList;\r
\r
#if ipconfigUSE_TCP == 1\r
if( xProtocol == ( BaseType_t ) FREERTOS_IPPROTO_TCP )\r
{\r
- xIndex = socketNEXT_TCP_PORT_NUMBER_INDEX;\r
pxList = &xBoundTCPSocketsList;\r
}\r
else\r
#endif\r
{\r
- xIndex = socketNEXT_UDP_PORT_NUMBER_INDEX;\r
pxList = &xBoundUDPSocketsList;\r
}\r
\r
/* Avoid compiler warnings if ipconfigUSE_TCP is not defined. */\r
( void ) xProtocol;\r
\r
- /* Assign the next port in the range. Has it overflowed? */\r
- /*_RB_ This needs to be randomised rather than sequential. */\r
- /* _HT_ Agreed, although many OS's use sequential port numbers, see\r
- https://www.cymru.com/jtk/misc/ephemeralports.html */\r
- for ( ;; )\r
- {\r
- ++( usNextPortToUse[ xIndex ] );\r
-\r
- if( usNextPortToUse[ xIndex ] >= socketAUTO_PORT_ALLOCATION_MAX_NUMBER )\r
- {\r
- /* Don't go right back to the start of the dynamic/private port\r
- range numbers as any persistent sockets are likely to have been\r
- create first so the early port numbers may still be in use. */\r
- usNextPortToUse[ xIndex ] = socketAUTO_PORT_ALLOCATION_RESET_NUMBER;\r
- }\r
-\r
- usResult = FreeRTOS_htons( usNextPortToUse[ xIndex ] );\r
-\r
- if( pxListFindListItemWithValue( pxList, ( TickType_t ) usResult ) == NULL )\r
- {\r
- break;\r
- }\r
- }\r
- return usResult;\r
-} /* Tested */\r
+ /* Find the next available port using the random seed as a starting \r
+ point. */\r
+ do\r
+ {\r
+ /* Generate a random seed. */\r
+ ulRandomSeed = ipconfigRAND32( );\r
+\r
+ /* Only proceed if the random number generator succeeded. */\r
+ if( 0 == ulRandomSeed )\r
+ {\r
+ if( pdFALSE == xGotZeroOnce )\r
+ {\r
+ xGotZeroOnce = pdTRUE;\r
+ continue;\r
+ }\r
+ else\r
+ {\r
+ break;\r
+ }\r
+ }\r
+\r
+ /* Map the random to a candidate port. */\r
+ usResult =\r
+ socketAUTO_PORT_ALLOCATION_START_NUMBER +\r
+ ( ( ( uint16_t )ulRandomSeed ) % usEphemeralPortCount );\r
+\r
+ /* Check if there's already an open socket with the same protocol\r
+ and port. */\r
+ if( NULL == pxListFindListItemWithValue( \r
+ pxList, \r
+ ( TickType_t )FreeRTOS_htons( usResult ) ) )\r
+ {\r
+ usResult = FreeRTOS_htons( usResult );\r
+ break;\r
+ }\r
+ else\r
+ {\r
+ usResult = 0;\r
+ }\r
+\r
+ usIterations--;\r
+ }\r
+ while( usIterations > 0 );\r
+ \r
+ return usResult;\r
+} \r
/*-----------------------------------------------------------*/\r
\r
/* pxListFindListItemWithValue: find a list item in a bound socket list\r
/* This define makes it possible for network-card drivers to inspect\r
* UDP message and see if there is any UDP socket bound to a given port\r
* number.\r
- * This is probably only useful in systems with a minimum of RAM and\r
+ * This is probably only usefull in systems with a minimum of RAM and\r
* when lots of anonymous broadcast messages come in\r
*/\r
BaseType_t xPortHasUDPSocket( uint16_t usPortNr )\r
{\r
xResult = -pdFREERTOS_ERRNO_ENOMEM;\r
}\r
- else if( ( pxSocket->u.xTCP.ucTCPState == eCLOSED ) ||\r
- ( pxSocket->u.xTCP.ucTCPState == eCLOSE_WAIT ) ||\r
- ( pxSocket->u.xTCP.ucTCPState == eCLOSING ) )\r
+ else if( pxSocket->u.xTCP.ucTCPState == eCLOSED )\r
{\r
xResult = -pdFREERTOS_ERRNO_ENOTCONN;\r
}\r
\r
#if( ipconfigUSE_TCP == 1 )\r
\r
- static StreamBuffer_t *prvTCPCreateStream( FreeRTOS_Socket_t *pxSocket, BaseType_t xIsInputStream )\r
+ static StreamBuffer_t *prvTCPCreateStream ( FreeRTOS_Socket_t *pxSocket, BaseType_t xIsInputStream )\r
{\r
StreamBuffer_t *pxBuffer;\r
size_t uxLength;\r
creation, it could still be changed with setsockopt(). */\r
if( xIsInputStream != pdFALSE )\r
{\r
- /* Flow control for input streams works with a low- and a high-water mark.\r
- 1) If the RX-space becomes less than uxLittleSpace, the flag 'bLowWater' will\r
- be set, and a TCP window update message will be sent to the peer.\r
- 2) The data will be read from the socket by recv() and when RX-space becomes\r
- larger than or equal to than 'uxEnoughSpace', a new TCP window update\r
- message will be sent to the peer, and 'bLowWater' will get cleared again.\r
- By default:\r
- uxLittleSpace == 1/5 x uxRxStreamSize\r
- uxEnoughSpace == 4/5 x uxRxStreamSize\r
- How-ever it is very inefficient to make 'uxLittleSpace' smaller than the actual MSS.\r
- */\r
uxLength = pxSocket->u.xTCP.uxRxStreamSize;\r
\r
if( pxSocket->u.xTCP.uxLittleSpace == 0ul )\r
{\r
pxSocket->u.xTCP.uxLittleSpace = ( 1ul * pxSocket->u.xTCP.uxRxStreamSize ) / 5u; /*_RB_ Why divide by 5? Can this be changed to a #define? */\r
- if( ( pxSocket->u.xTCP.uxLittleSpace < pxSocket->u.xTCP.usCurMSS ) && ( pxSocket->u.xTCP.uxRxStreamSize >= 2u * pxSocket->u.xTCP.usCurMSS ) )\r
- {\r
- pxSocket->u.xTCP.uxLittleSpace = pxSocket->u.xTCP.usCurMSS;\r
- }\r
}\r
\r
if( pxSocket->u.xTCP.uxEnoughSpace == 0ul )\r
break;\r
}\r
\r
- if( pxSocket->u.xTCP.pxHandleReceive( (Socket_t *)pxSocket, ( void* )ucReadPtr, ( size_t ) ulCount ) != pdFALSE )\r
- {\r
- uxStreamBufferGet( pxStream, 0ul, NULL, ( size_t ) ulCount, pdFALSE );\r
- }\r
+ pxSocket->u.xTCP.pxHandleReceive( (Socket_t *)pxSocket, ( void* )ucReadPtr, ( size_t ) ulCount );\r
+ uxStreamBufferGet( pxStream, 0ul, NULL, ( size_t ) ulCount, pdFALSE );\r
}\r
} else\r
#endif /* ipconfigUSE_CALLBACKS */\r
char ucChildText[16] = "";\r
if (pxSocket->u.xTCP.ucTCPState == eTCP_LISTEN)\r
{\r
- snprintf( ucChildText, sizeof( ucChildText ), " %d/%d",\r
- pxSocket->u.xTCP.usChildCount,\r
- pxSocket->u.xTCP.usBacklog);\r
+ const int32_t copied_len = snprintf( ucChildText, sizeof( ucChildText ), " %d/%d",\r
+ ( int ) pxSocket->u.xTCP.usChildCount,\r
+ ( int ) pxSocket->u.xTCP.usBacklog);\r
+ /* These should never evaluate to false since the buffers are both shorter than 5-6 characters (<=65535) */\r
+ configASSERT( copied_len >= 0 );\r
+ configASSERT( copied_len < sizeof( ucChildText ) );\r
}\r
- if( age > 999999 )\r
- age = 999999;\r
FreeRTOS_printf( ( "TCP %5d %-16lxip:%5d %d/%d %-13.13s %6lu %6u%s\n",\r
pxSocket->usLocalPort, /* Local port on this machine */\r
pxSocket->u.xTCP.ulRemoteIP, /* IP address of remote machine */\r
pxSocket->u.xTCP.rxStream != NULL,\r
pxSocket->u.xTCP.txStream != NULL,\r
FreeRTOS_GetTCPStateName( pxSocket->u.xTCP.ucTCPState ),\r
- age,\r
+ (age > 999999 ? 999999 : age), /* Format 'age' for printing */\r
pxSocket->u.xTCP.usTimeout,\r
ucChildText ) );\r
/* Remove compiler warnings if FreeRTOS_debug_printf() is not defined. */\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
\r
/* This compile-time test was moved to here because some macro's\r
were unknown within 'FreeRTOSIPConfigDefaults.h'. It tests whether\r
-the defined MTU size can contain at ;east a complete TCP packet. */\r
+the defined MTU size can contain at least a complete TCP packet. */\r
\r
#if ( ( ipconfigTCP_MSS + ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER ) > ipconfigNETWORK_MTU )\r
#error The ipconfigTCP_MSS setting in FreeRTOSIPConfig.h is too large.\r
*/\r
#define REDUCED_MSS_THROUGH_INTERNET ( 1400 )\r
\r
-/*\r
- * Each time a new TCP connection is being made, a new Initial Sequence Number shall be used.\r
- * The variable 'ulNextInitialSequenceNumber' will be incremented with a recommended value\r
- * of 0x102.\r
- */\r
-#define INITIAL_SEQUENCE_NUMBER_INCREMENT ( 0x102UL )\r
-\r
/*\r
* When there are no TCP options, the TCP offset equals 20 bytes, which is stored as\r
* the number 5 (words) in the higher niblle of the TCP-offset byte.\r
*/\r
static BaseType_t prvTCPHandleFin( FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer );\r
\r
-#if( ipconfigUSE_TCP_TIMESTAMPS == 1 )\r
- static UBaseType_t prvTCPSetTimeStamp( BaseType_t lOffset, FreeRTOS_Socket_t *pxSocket, TCPHeader_t *pxTCPHeader );\r
-#endif\r
-\r
/*\r
* Called from prvTCPHandleState(). Find the TCP payload data and check and\r
* return its length.\r
static uint8_t prvWinScaleFactor( FreeRTOS_Socket_t *pxSocket );\r
#endif\r
\r
-/*-----------------------------------------------------------*/\r
-\r
-/* Initial Sequence Number, i.e. the next initial sequence number that will be\r
-used when a new connection is opened. The value should be randomized to prevent\r
-attacks from outside (spoofing). */\r
-uint32_t ulNextInitialSequenceNumber = 0ul;\r
+/* \r
+ * Generate a randomized TCP Initial Sequence Number per RFC.\r
+ */\r
+extern uint32_t ulApplicationGetNextSequenceNumber(\r
+ uint32_t ulSourceAddress,\r
+ uint16_t usSourcePort,\r
+ uint32_t ulDestinationAddress,\r
+ uint16_t usDestinationPort );\r
\r
/*-----------------------------------------------------------*/\r
\r
if( ( pxSocket->u.xTCP.ucTCPState >= eESTABLISHED ) && ( pxSocket->u.xTCP.txStream != NULL ) )\r
{\r
/* The API FreeRTOS_send() might have added data to the TX stream. Add\r
- this data to the windowing system so it can be transmitted. */\r
+ this data to the windowing system to it can be transmitted. */\r
prvTCPAddTxData( pxSocket );\r
}\r
\r
- #if( ipconfigUSE_TCP_WIN == 1 )\r
+ #if ipconfigUSE_TCP_WIN == 1\r
{\r
if( pxSocket->u.xTCP.pxAckMessage != NULL )\r
{\r
\r
if( pxSocket->u.xTCP.ucTCPState != eCONNECT_SYN )\r
{\r
- /* The connection is in a state other than SYN. */\r
+ /* The connection is in s state other than SYN. */\r
pxNetworkBuffer = NULL;\r
\r
/* prvTCPSendRepeated() will only create a network buffer if necessary,\r
the Ethernet address of the peer or the gateway is found. */\r
pxTCPPacket = ( TCPPacket_t * )pxSocket->u.xTCP.xPacket.u.ucLastPacket;\r
\r
- #if( ipconfigUSE_TCP_TIMESTAMPS == 1 )\r
- {\r
- /* When TCP time stamps are enabled, but they will only be applied\r
- if the peer is outside the netmask, usually on the internet.\r
- Packages sent on a LAN are usually too big to carry time stamps. */\r
- if( ( ( pxSocket->u.xTCP.ulRemoteIP ^ FreeRTOS_ntohl( *ipLOCAL_IP_ADDRESS_POINTER ) ) & xNetworkAddressing.ulNetMask ) != 0ul )\r
- {\r
- pxSocket->u.xTCP.xTCPWindow.u.bits.bTimeStamps = pdTRUE_UNSIGNED;\r
- }\r
- }\r
- #endif\r
-\r
/* About to send a SYN packet. Call prvSetSynAckOptions() to set\r
the proper options: The size of MSS and whether SACK's are\r
allowed. */\r
\r
if( pxNetworkBuffer == NULL )\r
{\r
- memset( &xTempBuffer, '\0', sizeof( xTempBuffer ) );\r
pxNetworkBuffer = &xTempBuffer;\r
\r
+ #if( ipconfigUSE_LINKED_RX_MESSAGES != 0 )\r
+ {\r
+ xTempBuffer.pxNextBuffer = NULL;\r
+ }\r
+ #endif\r
xTempBuffer.pucEthernetBuffer = pxSocket->u.xTCP.xPacket.u.ucLastPacket;\r
xTempBuffer.xDataLength = sizeof( pxSocket->u.xTCP.xPacket.u.ucLastPacket );\r
- /* A pseudo network buffer can not be released. */\r
xReleaseAfterSend = pdFALSE;\r
}\r
\r
pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum );\r
\r
/* calculate the TCP checksum for an outgoing packet. */\r
- usGenerateProtocolChecksum( (uint8_t*)pxTCPPacket, pdTRUE );\r
+ usGenerateProtocolChecksum( (uint8_t*)pxTCPPacket, pxNetworkBuffer->xDataLength, pdTRUE );\r
\r
/* A calculated checksum of 0 must be inverted as 0 means the checksum\r
is disabled. */\r
}\r
#endif\r
\r
- #if( ipconfigUSE_LINKED_RX_MESSAGES != 0 )\r
- {\r
- pxNetworkBuffer->pxNextBuffer = NULL;\r
- }\r
- #endif\r
+ #if( ipconfigUSE_LINKED_RX_MESSAGES != 0 )\r
+ pxNetworkBuffer->pxNextBuffer = NULL;\r
+ #endif\r
\r
/* Important: tell NIC driver how many bytes must be sent. */\r
pxNetworkBuffer->xDataLength = ulLen + ipSIZE_OF_ETH_HEADER;\r
sizeof( pxEthernetHeader->xDestinationAddress ) );\r
\r
/* The source MAC addresses is fixed to 'ipLOCAL_MAC_ADDRESS'. */\r
- memcpy( ( void * ) &( pxEthernetHeader->xSourceAddress ), ( void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );\r
+ memcpy( ( void * ) &( pxEthernetHeader->xSourceAddress) , ( void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );\r
\r
#if defined( ipconfigETHERNET_MINIMUM_PACKET_BYTES )\r
{\r
uint32_t ulRemoteIP;\r
MACAddress_t xEthAddress;\r
BaseType_t xReturn = pdTRUE;\r
+uint32_t ulInitialSequenceNumber = 0;\r
\r
#if( ipconfigHAS_PRINTF != 0 )\r
{\r
\r
switch( eReturned )\r
{\r
- case eARPCacheHit: /* An ARP table lookup found a valid entry. */\r
- break; /* We can now prepare the SYN packet. */\r
- case eARPCacheMiss: /* An ARP table lookup did not find a valid entry. */\r
- case eCantSendPacket: /* There is no IP address, or an ARP is still in progress. */\r
- default:\r
- /* Count the number of times it couldn't find the ARP address. */\r
- pxSocket->u.xTCP.ucRepCount++;\r
+ case eARPCacheHit: /* An ARP table lookup found a valid entry. */\r
+ break; /* We can now prepare the SYN packet. */\r
+ case eARPCacheMiss: /* An ARP table lookup did not find a valid entry. */\r
+ case eCantSendPacket: /* There is no IP address, or an ARP is still in progress. */\r
+ default:\r
+ /* Count the number of times it couldn't find the ARP address. */\r
+ pxSocket->u.xTCP.ucRepCount++;\r
\r
- FreeRTOS_debug_printf( ( "ARP for %lxip (using %lxip): rc=%d %02X:%02X:%02X %02X:%02X:%02X\n",\r
- pxSocket->u.xTCP.ulRemoteIP,\r
- FreeRTOS_htonl( ulRemoteIP ),\r
- eReturned,\r
- xEthAddress.ucBytes[ 0 ],\r
- xEthAddress.ucBytes[ 1 ],\r
- xEthAddress.ucBytes[ 2 ],\r
- xEthAddress.ucBytes[ 3 ],\r
- xEthAddress.ucBytes[ 4 ],\r
- xEthAddress.ucBytes[ 5 ] ) );\r
-\r
- /* And issue a (new) ARP request */\r
- FreeRTOS_OutputARPRequest( ulRemoteIP );\r
-\r
- xReturn = pdFALSE;\r
- break;\r
- }\r
+ FreeRTOS_debug_printf( ( "ARP for %lxip (using %lxip): rc=%d %02X:%02X:%02X %02X:%02X:%02X\n",\r
+ pxSocket->u.xTCP.ulRemoteIP,\r
+ FreeRTOS_htonl( ulRemoteIP ),\r
+ eReturned,\r
+ xEthAddress.ucBytes[ 0 ],\r
+ xEthAddress.ucBytes[ 1 ],\r
+ xEthAddress.ucBytes[ 2 ],\r
+ xEthAddress.ucBytes[ 3 ],\r
+ xEthAddress.ucBytes[ 4 ],\r
+ xEthAddress.ucBytes[ 5 ] ) );\r
+\r
+ /* And issue a (new) ARP request */\r
+ FreeRTOS_OutputARPRequest( ulRemoteIP );\r
+\r
+ xReturn = pdFALSE;\r
+ }\r
+\r
+ if( xReturn != pdFALSE )\r
+ {\r
+ /* Get a difficult-to-predict initial sequence number for this 4-tuple. */\r
+ ulInitialSequenceNumber = ulApplicationGetNextSequenceNumber( \r
+ *ipLOCAL_IP_ADDRESS_POINTER, \r
+ pxSocket->usLocalPort, \r
+ pxSocket->u.xTCP.ulRemoteIP, \r
+ pxSocket->u.xTCP.usRemotePort );\r
+\r
+ /* Check for a random number generation error. */\r
+ if( 0 == ulInitialSequenceNumber )\r
+ {\r
+ xReturn = pdFALSE;\r
+ }\r
+ }\r
\r
if( xReturn != pdFALSE )\r
{\r
pxTCPPacket = ( TCPPacket_t * )pxSocket->u.xTCP.xPacket.u.ucLastPacket;\r
pxIPHeader = &pxTCPPacket->xIPHeader;\r
\r
- /* Reset the retry counter to zero... */\r
+ /* reset the retry counter to zero. */\r
pxSocket->u.xTCP.ucRepCount = 0u;\r
\r
- /* ...and remember that the connect/SYN data are prepared. */\r
+ /* And remember that the connect/SYN data are prepared. */\r
pxSocket->u.xTCP.bits.bConnPrepared = pdTRUE_UNSIGNED;\r
\r
/* Now that the Ethernet address is known, the initial packet can be\r
pxSocket->u.xTCP.xTCPWindow.rx.ulCurrentSequenceNumber = 0ul;\r
\r
/* Start with ISN (Initial Sequence Number). */\r
- pxSocket->u.xTCP.xTCPWindow.ulOurSequenceNumber = ulNextInitialSequenceNumber;\r
-\r
- /* And increment it with 268 for the next new connection, which is\r
- recommended value. */\r
- ulNextInitialSequenceNumber += 0x102UL;\r
+ pxSocket->u.xTCP.xTCPWindow.ulOurSequenceNumber = ulInitialSequenceNumber;\r
\r
/* The TCP header size is 20 bytes, divided by 4 equals 5, which is put in\r
the high nibble of the TCP offset field. */\r
pucLast = pucPtr + (((pxTCPHeader->ucTCPOffset >> 4) - 5) << 2);\r
pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;\r
\r
+ /* Validate options size calculation. */\r
+ if( pucLast > ( pxNetworkBuffer->pucEthernetBuffer + pxNetworkBuffer->xDataLength ) )\r
+ {\r
+ return;\r
+ }\r
+\r
/* The comparison with pucLast is only necessary in case the option data are\r
corrupted, we don't like to run into invalid memory and crash. */\r
while( pucPtr < pucLast )\r
{\r
+ UBaseType_t xRemainingOptionsBytes = pucLast - pucPtr;\r
+\r
if( pucPtr[ 0 ] == TCP_OPT_END )\r
{\r
/* End of options. */\r
- return;\r
+ break;\r
}\r
if( pucPtr[ 0 ] == TCP_OPT_NOOP)\r
{\r
- pucPtr++;\r
-\r
- /* NOP option, inserted to make the length a multiple of 4. */\r
+ /* NOP option, inserted to make the length a multiple of 4. */\r
+ pucPtr++;\r
+ continue;\r
}\r
+\r
+ /* Any other well-formed option must be at least two bytes: the option\r
+ type byte followed by a length byte. */\r
+ if( xRemainingOptionsBytes < 2 )\r
+ { \r
+ break;\r
+ }\r
#if( ipconfigUSE_TCP_WIN != 0 )\r
- else if( ( pucPtr[ 0 ] == TCP_OPT_WSOPT ) && ( pucPtr[ 1 ] == TCP_OPT_WSOPT_LEN ) )\r
+ else if( pucPtr[ 0 ] == TCP_OPT_WSOPT )\r
{\r
+ /* Confirm that the option fits in the remaining buffer space. */\r
+ if( xRemainingOptionsBytes < TCP_OPT_WSOPT_LEN ||\r
+ pucPtr[ 1 ] != TCP_OPT_WSOPT_LEN )\r
+ {\r
+ break;\r
+ }\r
+\r
pxSocket->u.xTCP.ucPeerWinScaleFactor = pucPtr[ 2 ];\r
pxSocket->u.xTCP.bits.bWinScaling = pdTRUE_UNSIGNED;\r
pucPtr += TCP_OPT_WSOPT_LEN;\r
}\r
#endif /* ipconfigUSE_TCP_WIN */\r
- else if( ( pucPtr[ 0 ] == TCP_OPT_MSS ) && ( pucPtr[ 1 ] == TCP_OPT_MSS_LEN ) )\r
- {\r
- /* An MSS option with the correct option length. FreeRTOS_htons()\r
+ else if( pucPtr[ 0 ] == TCP_OPT_MSS )\r
+ {\r
+ /* Confirm that the option fits in the remaining buffer space. */\r
+ if( xRemainingOptionsBytes < TCP_OPT_MSS_LEN ||\r
+ pucPtr[ 1 ] != TCP_OPT_MSS_LEN )\r
+ {\r
+ break;\r
+ }\r
+ \r
+ /* An MSS option with the correct option length. FreeRTOS_htons()\r
is not needed here because usChar2u16() already returns a host\r
endian number. */\r
uxNewMSS = usChar2u16( pucPtr + 2 );\r
\r
if( pxSocket->u.xTCP.usInitMSS != uxNewMSS )\r
{\r
+ /* Perform a basic check on the the new MSS. */\r
+ if( uxNewMSS == 0 )\r
+ {\r
+ break;\r
+ }\r
+\r
FreeRTOS_debug_printf( ( "MSS change %u -> %lu\n", pxSocket->u.xTCP.usInitMSS, uxNewMSS ) );\r
}\r
\r
{\r
/* All other options have a length field, so that we easily\r
can skip past them. */\r
- int len = ( int )pucPtr[ 1 ];\r
- if( len == 0 )\r
+ unsigned char len = pucPtr[ 1 ];\r
+ if( len < 2 || len > xRemainingOptionsBytes )\r
{\r
- /* If the length field is zero, the options are malformed\r
- and we don't process them further. */\r
+ /* If the length field is too small or too big, the options are malformed. \r
+ Don't process them further. */\r
break;\r
}\r
\r
}\r
/* len should be 0 by now. */\r
}\r
- #if ipconfigUSE_TCP_TIMESTAMPS == 1\r
- else if( pucPtr[0] == TCP_OPT_TIMESTAMP )\r
- {\r
- len -= 2; /* Skip option and length byte. */\r
- pucPtr += 2;\r
- pxSocket->u.xTCP.xTCPWindow.u.bits.bTimeStamps = pdTRUE_UNSIGNED;\r
- pxSocket->u.xTCP.xTCPWindow.rx.ulTimeStamp = ulChar2u32( pucPtr );\r
- pxSocket->u.xTCP.xTCPWindow.tx.ulTimeStamp = ulChar2u32( pucPtr + 4 );\r
- }\r
- #endif /* ipconfigUSE_TCP_TIMESTAMPS == 1 */\r
}\r
#endif /* ipconfigUSE_TCP_WIN == 1 */\r
\r
}\r
#else\r
{\r
- #if( ipconfigUSE_TCP_TIMESTAMPS == 1 )\r
- if( pxSocket->u.xTCP.xTCPWindow.u.bits.bTimeStamps )\r
- {\r
- uxOptionsLength += prvTCPSetTimeStamp( uxOptionsLength, pxSocket, &pxTCPPacket->xTCPHeader );\r
- pxTCPHeader->ucOptdata[ uxOptionsLength + 0 ] = TCP_OPT_SACK_P; /* 4: Sack-Permitted Option. */\r
- pxTCPHeader->ucOptdata[ uxOptionsLength + 1 ] = 2u;\r
- uxOptionsLength += 2u;\r
- }\r
- else\r
- #endif\r
- {\r
- pxTCPHeader->ucOptdata[ uxOptionsLength + 0 ] = TCP_OPT_NOOP;\r
- pxTCPHeader->ucOptdata[ uxOptionsLength + 1 ] = TCP_OPT_NOOP;\r
- pxTCPHeader->ucOptdata[ uxOptionsLength + 2 ] = TCP_OPT_SACK_P; /* 4: Sack-Permitted Option. */\r
- pxTCPHeader->ucOptdata[ uxOptionsLength + 3 ] = 2; /* 2: length of this option. */\r
- uxOptionsLength += 4u;\r
- }\r
- return uxOptionsLength; /* bytes, not words. */\r
+ pxTCPHeader->ucOptdata[ uxOptionsLength + 0 ] = TCP_OPT_NOOP;\r
+ pxTCPHeader->ucOptdata[ uxOptionsLength + 1 ] = TCP_OPT_NOOP;\r
+ pxTCPHeader->ucOptdata[ uxOptionsLength + 2 ] = TCP_OPT_SACK_P; /* 4: Sack-Permitted Option. */\r
+ pxTCPHeader->ucOptdata[ uxOptionsLength + 3 ] = 2; /* 2: length of this option. */\r
+ uxOptionsLength += 4u;\r
+\r
+ return uxOptionsLength; /* bytes, not words. */\r
}\r
#endif /* ipconfigUSE_TCP_WIN == 0 */\r
}\r
/* Fill in the new state. */\r
pxSocket->u.xTCP.ucTCPState = ( uint8_t ) eTCPState;\r
\r
- /* Touch the alive timers because moving to another state. */\r
+ /* touch the alive timers because moving to another state. */\r
prvTCPTouchSocket( pxSocket );\r
\r
#if( ipconfigHAS_DEBUG_PRINTF == 1 )\r
( int32_t ) ( ipSIZE_OF_ETH_HEADER + ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER + uxOptionsLength ) + lDataLen );\r
/* In case we were called from a TCP timer event, a buffer must be\r
created. Otherwise, test 'xDataLength' of the provided buffer. */\r
- if( ( pxNetworkBuffer == NULL ) || ( pxNetworkBuffer->xDataLength < (size_t)lNeeded ) )\r
- {\r
- xResize = pdTRUE;\r
- }\r
- else\r
- {\r
- xResize = pdFALSE;\r
- }\r
+ xResize = ( pxNetworkBuffer == NULL ) || ( pxNetworkBuffer->xDataLength < (size_t)lNeeded );\r
}\r
\r
if( xResize != pdFALSE )\r
\r
if( pxReturn != NULL )\r
{\r
+ /* Set the actual packet size, in case the returned buffer is larger. */\r
+ pxReturn->xDataLength = lNeeded;\r
+\r
/* Copy the existing data to the new created buffer. */\r
if( pxNetworkBuffer )\r
{\r
pucEthernetBuffer = pxSocket->u.xTCP.xPacket.u.ucLastPacket;\r
}\r
\r
- pxTCPPacket = ( TCPPacket_t * ) pucEthernetBuffer;\r
- pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );\r
+ pxTCPPacket = ( TCPPacket_t * ) ( pucEthernetBuffer );\r
+ pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;\r
lDataLen = 0;\r
lStreamPos = 0;\r
pxTCPPacket->xTCPHeader.ucTCPFlags |= ipTCP_FLAG_ACK;\r
pxTCPPacket->xTCPHeader.ucTCPFlags |= ( uint8_t ) ipTCP_FLAG_PSH;\r
}\r
\r
- #if ipconfigUSE_TCP_TIMESTAMPS == 1\r
- {\r
- if( uxOptionsLength == 0u )\r
- {\r
- if( pxSocket->u.xTCP.xTCPWindow.u.bits.bTimeStamps )\r
- {\r
- TCPPacket_t * pxTCPPacket = ( TCPPacket_t * ) ( pucEthernetBuffer );\r
- uxOptionsLength = prvTCPSetTimeStamp( 0, pxSocket, &pxTCPPacket->xTCPHeader );\r
- }\r
- }\r
- }\r
- #endif\r
-\r
lDataLen += ( int32_t ) ( ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER + uxOptionsLength );\r
}\r
\r
/* A txStream has been created already, see if the socket has new data for\r
the sliding window.\r
\r
- uxStreamBufferMidSpace() returns the distance between rxHead and rxMid. It\r
- contains new Tx data which has not been passed to the sliding window yet.\r
- The oldest data not-yet-confirmed can be found at rxTail. */\r
+ uxStreamBufferMidSpace() returns the distance between rxHead and rxMid. It contains new\r
+ Tx data which has not been passed to the sliding window yet. The oldest\r
+ data not-yet-confirmed can be found at rxTail. */\r
lLength = ( int32_t ) uxStreamBufferMidSpace( pxSocket->u.xTCP.txStream );\r
\r
if( lLength > 0 )\r
}\r
/*-----------------------------------------------------------*/\r
\r
-#if ipconfigUSE_TCP_TIMESTAMPS == 1\r
-\r
- static UBaseType_t prvTCPSetTimeStamp( BaseType_t lOffset, FreeRTOS_Socket_t *pxSocket, TCPHeader_t *pxTCPHeader )\r
- {\r
- uint32_t ulTimes[2];\r
- uint8_t *ucOptdata = &( pxTCPHeader->ucOptdata[ lOffset ] );\r
-\r
- ulTimes[0] = ( xTaskGetTickCount ( ) * 1000u ) / configTICK_RATE_HZ;\r
- ulTimes[0] = FreeRTOS_htonl( ulTimes[0] );\r
- ulTimes[1] = FreeRTOS_htonl( pxSocket->u.xTCP.xTCPWindow.rx.ulTimeStamp );\r
- ucOptdata[0] = ( uint8_t ) TCP_OPT_TIMESTAMP;\r
- ucOptdata[1] = ( uint8_t ) TCP_OPT_TIMESTAMP_LEN;\r
- memcpy( &(ucOptdata[2] ), ulTimes, 8u );\r
- ucOptdata[10] = ( uint8_t ) TCP_OPT_NOOP;\r
- ucOptdata[11] = ( uint8_t ) TCP_OPT_NOOP;\r
- /* Do not return the same timestamps 2 times. */\r
- pxSocket->u.xTCP.xTCPWindow.rx.ulTimeStamp = 0ul;\r
- return 12u;\r
- }\r
-\r
-#endif\r
-/*-----------------------------------------------------------*/\r
-\r
/*\r
* prvCheckRxData(): called from prvTCPHandleState()\r
*\r
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );\r
}\r
\r
- #if( ipconfigUSE_TCP_TIMESTAMPS == 1 )\r
- {\r
- if( pxSocket->u.xTCP.xTCPWindow.u.bits.bTimeStamps )\r
- {\r
- uxOptionsLength += prvTCPSetTimeStamp( uxOptionsLength, pxSocket, pxTCPHeader );\r
- }\r
- }\r
- #endif /* ipconfigUSE_TCP_TIMESTAMPS == 1 */\r
-\r
return uxOptionsLength;\r
}\r
/*-----------------------------------------------------------*/\r
{\r
FreeRTOS_Socket_t *pxSocket;\r
TCPPacket_t * pxTCPPacket = ( TCPPacket_t * ) ( pxNetworkBuffer->pucEthernetBuffer );\r
-uint16_t ucTCPFlags = pxTCPPacket->xTCPHeader.ucTCPFlags;\r
-uint32_t ulLocalIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulDestinationIPAddress );\r
-uint16_t xLocalPort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usDestinationPort );\r
-uint32_t ulRemoteIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulSourceIPAddress );\r
-uint16_t xRemotePort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usSourcePort );\r
+uint16_t ucTCPFlags;\r
+uint32_t ulLocalIP;\r
+uint16_t xLocalPort;\r
+uint32_t ulRemoteIP;\r
+uint16_t xRemotePort;\r
BaseType_t xResult = pdPASS;\r
\r
- /* Find the destination socket, and if not found: return a socket listing to\r
- the destination PORT. */\r
- pxSocket = ( FreeRTOS_Socket_t * ) pxTCPSocketLookup( ulLocalIP, xLocalPort, ulRemoteIP, xRemotePort );\r
+ /* Check for a minimum packet size. */\r
+ if( pxNetworkBuffer->xDataLength >= \r
+ ipSIZE_OF_ETH_HEADER + ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER )\r
+ {\r
+ ucTCPFlags = pxTCPPacket->xTCPHeader.ucTCPFlags;\r
+ ulLocalIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulDestinationIPAddress );\r
+ xLocalPort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usDestinationPort );\r
+ ulRemoteIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulSourceIPAddress );\r
+ xRemotePort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usSourcePort );\r
+\r
+ /* Find the destination socket, and if not found: return a socket listing to\r
+ the destination PORT. */\r
+ pxSocket = ( FreeRTOS_Socket_t * )pxTCPSocketLookup( ulLocalIP, xLocalPort, ulRemoteIP, xRemotePort );\r
+ }\r
+ else\r
+ {\r
+ return pdFAIL;\r
+ }\r
\r
if( ( pxSocket == NULL ) || ( prvTCPSocketIsActive( ( UBaseType_t ) pxSocket->u.xTCP.ucTCPState ) == pdFALSE ) )\r
{\r
static FreeRTOS_Socket_t *prvHandleListen( FreeRTOS_Socket_t *pxSocket, NetworkBufferDescriptor_t *pxNetworkBuffer )\r
{\r
TCPPacket_t * pxTCPPacket = ( TCPPacket_t * ) ( pxNetworkBuffer->pucEthernetBuffer );\r
-FreeRTOS_Socket_t *pxReturn;\r
+FreeRTOS_Socket_t *pxReturn = NULL;\r
+uint32_t ulInitialSequenceNumber;\r
+\r
+ /* Assume that a new Initial Sequence Number will be required. Request \r
+ it now in order to fail out if necessary. */\r
+ ulInitialSequenceNumber = ulApplicationGetNextSequenceNumber(\r
+ *ipLOCAL_IP_ADDRESS_POINTER,\r
+ pxSocket->usLocalPort,\r
+ pxTCPPacket->xIPHeader.ulSourceIPAddress,\r
+ pxTCPPacket->xTCPHeader.usSourcePort );\r
\r
/* A pure SYN (without ACK) has come in, create a new socket to answer\r
it. */\r
- if( pxSocket->u.xTCP.bits.bReuseSocket != pdFALSE_UNSIGNED )\r
- {\r
- /* The flag bReuseSocket indicates that the same instance of the\r
- listening socket should be used for the connection. */\r
- pxReturn = pxSocket;\r
- pxSocket->u.xTCP.bits.bPassQueued = pdTRUE_UNSIGNED;\r
- pxSocket->u.xTCP.pxPeerSocket = pxSocket;\r
- }\r
- else\r
- {\r
- /* The socket does not have the bReuseSocket flag set meaning create a\r
- new socket when a connection comes in. */\r
- pxReturn = NULL;\r
-\r
- if( pxSocket->u.xTCP.usChildCount >= pxSocket->u.xTCP.usBacklog )\r
- {\r
- FreeRTOS_printf( ( "Check: Socket %u already has %u / %u child%s\n",\r
- pxSocket->usLocalPort,\r
- pxSocket->u.xTCP.usChildCount,\r
- pxSocket->u.xTCP.usBacklog,\r
- pxSocket->u.xTCP.usChildCount == 1 ? "" : "ren" ) );\r
- prvTCPSendReset( pxNetworkBuffer );\r
- }\r
- else\r
- {\r
- FreeRTOS_Socket_t *pxNewSocket = (FreeRTOS_Socket_t *)\r
- FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
-\r
- if( ( pxNewSocket == NULL ) || ( pxNewSocket == FREERTOS_INVALID_SOCKET ) )\r
- {\r
- FreeRTOS_debug_printf( ( "TCP: Listen: new socket failed\n" ) );\r
- prvTCPSendReset( pxNetworkBuffer );\r
- }\r
- else if( prvTCPSocketCopy( pxNewSocket, pxSocket ) != pdFALSE )\r
- {\r
- /* The socket will be connected immediately, no time for the\r
- owner to setsockopt's, therefore copy properties of the server\r
- socket to the new socket. Only the binding might fail (due to\r
- lack of resources). */\r
- pxReturn = pxNewSocket;\r
- }\r
- }\r
- }\r
-\r
- if( pxReturn != NULL )\r
+ if( 0 != ulInitialSequenceNumber )\r
+ {\r
+ if( pxSocket->u.xTCP.bits.bReuseSocket != pdFALSE_UNSIGNED )\r
+ {\r
+ /* The flag bReuseSocket indicates that the same instance of the\r
+ listening socket should be used for the connection. */\r
+ pxReturn = pxSocket;\r
+ pxSocket->u.xTCP.bits.bPassQueued = pdTRUE_UNSIGNED;\r
+ pxSocket->u.xTCP.pxPeerSocket = pxSocket;\r
+ }\r
+ else\r
+ {\r
+ /* The socket does not have the bReuseSocket flag set meaning create a\r
+ new socket when a connection comes in. */\r
+ pxReturn = NULL;\r
+\r
+ if( pxSocket->u.xTCP.usChildCount >= pxSocket->u.xTCP.usBacklog )\r
+ {\r
+ FreeRTOS_printf( ( "Check: Socket %u already has %u / %u child%s\n",\r
+ pxSocket->usLocalPort,\r
+ pxSocket->u.xTCP.usChildCount,\r
+ pxSocket->u.xTCP.usBacklog,\r
+ pxSocket->u.xTCP.usChildCount == 1 ? "" : "ren" ) );\r
+ prvTCPSendReset( pxNetworkBuffer );\r
+ }\r
+ else\r
+ {\r
+ FreeRTOS_Socket_t *pxNewSocket = ( FreeRTOS_Socket_t * )\r
+ FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
+\r
+ if( ( pxNewSocket == NULL ) || ( pxNewSocket == FREERTOS_INVALID_SOCKET ) )\r
+ {\r
+ FreeRTOS_debug_printf( ( "TCP: Listen: new socket failed\n" ) );\r
+ prvTCPSendReset( pxNetworkBuffer );\r
+ }\r
+ else if( prvTCPSocketCopy( pxNewSocket, pxSocket ) != pdFALSE )\r
+ {\r
+ /* The socket will be connected immediately, no time for the\r
+ owner to setsockopt's, therefore copy properties of the server\r
+ socket to the new socket. Only the binding might fail (due to\r
+ lack of resources). */\r
+ pxReturn = pxNewSocket;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if( 0 != ulInitialSequenceNumber && pxReturn != NULL )\r
{\r
pxReturn->u.xTCP.usRemotePort = FreeRTOS_htons( pxTCPPacket->xTCPHeader.usSourcePort );\r
pxReturn->u.xTCP.ulRemoteIP = FreeRTOS_htonl( pxTCPPacket->xIPHeader.ulSourceIPAddress );\r
- pxReturn->u.xTCP.xTCPWindow.ulOurSequenceNumber = ulNextInitialSequenceNumber;\r
+ pxReturn->u.xTCP.xTCPWindow.ulOurSequenceNumber = ulInitialSequenceNumber;\r
\r
/* Here is the SYN action. */\r
pxReturn->u.xTCP.xTCPWindow.rx.ulCurrentSequenceNumber = FreeRTOS_ntohl( pxTCPPacket->xTCPHeader.ulSequenceNumber );\r
\r
prvTCPCreateWindow( pxReturn );\r
\r
- /* It is recommended to increase the ISS for each new connection with a value of 0x102. */\r
- ulNextInitialSequenceNumber += INITIAL_SEQUENCE_NUMBER_INCREMENT;\r
-\r
vTCPStateChange( pxReturn, eSYN_FIRST );\r
\r
/* Make a copy of the header up to the TCP header. It is needed later\r
/* A reference to the new socket may be stored and the socket is marked\r
as 'passable'. */\r
\r
- /* When bPassAccept is true, this socket may be returned in a call to\r
+ /* When bPassAccept is pdTRUE_UNSIGNED this socket may be returned in a call to\r
accept(). */\r
pxNewSocket->u.xTCP.bits.bPassAccept = pdTRUE_UNSIGNED;\r
if(pxSocket->u.xTCP.pxPeerSocket == NULL )\r
\r
#endif /* ipconfigUSE_TCP == 1 */\r
\r
+/* Provide access to private members for testing. */\r
+#ifdef AMAZON_FREERTOS_ENABLE_UNIT_TESTS\r
+ #include "aws_freertos_tcp_test_access_tcp_define.h"\r
+#endif\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* TCP segment pool. */\r
+/* TCP segement pool. */\r
#if( ipconfigUSE_TCP_WIN == 1 )\r
static TCPSegment_t *xTCPSegments = NULL;\r
#endif /* ipconfigUSE_TCP_WIN == 1 */\r
pxWhere->pxPrevious = pxNewListItem;\r
\r
/* Remember which list the item is in. */\r
- pxNewListItem->pxContainer = pxList; \r
+ pxNewListItem->pvContainer = ( void * ) pxList; /* If this line fails to build then ensure configENABLE_BACKWARD_COMPATIBILITY is set to 1 in FreeRTOSConfig.h. */\r
\r
( pxList->uxNumberOfItems )++;\r
}\r
prvCreateSectors();\r
}\r
\r
- vListInitialise( &( pxWindow->xTxSegments ) );\r
- vListInitialise( &( pxWindow->xRxSegments ) );\r
+ vListInitialise( &pxWindow->xTxSegments );\r
+ vListInitialise( &pxWindow->xRxSegments );\r
\r
- vListInitialise( &( pxWindow->xPriorityQueue ) ); /* Priority queue: segments which must be sent immediately */\r
- vListInitialise( &( pxWindow->xTxQueue ) ); /* Transmit queue: segments queued for transmission */\r
- vListInitialise( &( pxWindow->xWaitQueue ) ); /* Waiting queue: outstanding segments */\r
+ vListInitialise( &pxWindow->xPriorityQueue ); /* Priority queue: segments which must be sent immediately */\r
+ vListInitialise( &pxWindow->xTxQueue ); /* Transmit queue: segments queued for transmission */\r
+ vListInitialise( &pxWindow->xWaitQueue ); /* Waiting queue: outstanding segments */\r
}\r
#endif /* ipconfigUSE_TCP_WIN == 1 */\r
\r
{\r
ulSavedSequenceNumber = ulCurrentSequenceNumber;\r
\r
- /* Clean up all sequence received between ulSequenceNumber\r
- and ulSequenceNumber + ulLength since they are duplicated.\r
- If the server is forced to retransmit packets several time\r
- in a row it might send a batch of concatenated packet for\r
- speed. So we cannot rely on the packets between\r
- ulSequenceNumber and ulSequenceNumber + ulLength to be\r
- sequential and it is better to just clean them out. */\r
- do\r
- {\r
- pxFound = xTCPWindowRxConfirm( pxWindow, ulSequenceNumber, ulLength );\r
-\r
- if ( pxFound != NULL )\r
- {\r
- /* Remove it because it will be passed to user directly. */\r
- vTCPWindowFree( pxFound );\r
- }\r
- } while ( pxFound );\r
+ /* Clean up all sequence received between ulSequenceNumber and ulSequenceNumber + ulLength since they are duplicated.\r
+ If the server is forced to retransmit packets several time in a row it might send a batch of concatenated packet for speed.\r
+ So we cannot rely on the packets between ulSequenceNumber and ulSequenceNumber + ulLength to be sequential and it is better to just\r
+ clean them out. */\r
+ do\r
+ {\r
+ pxFound = xTCPWindowRxConfirm( pxWindow, ulSequenceNumber, ulLength );\r
+\r
+ if ( pxFound != NULL )\r
+ {\r
+ /* Remove it because it will be passed to user directly. */\r
+ vTCPWindowFree( pxFound );\r
+ }\r
+ } while ( pxFound );\r
\r
/* Check for following segments that are already in the\r
queue and increment ulCurrentSequenceNumber. */\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
and\r
xIPHeader.usHeaderChecksum\r
*/\r
-\r
/* Save options now, as they will be overwritten by memcpy */\r
#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 0 )\r
- {\r
ucSocketOptions = pxNetworkBuffer->pucEthernetBuffer[ ipSOCKET_OPTIONS_OFFSET ];\r
- }\r
#endif\r
-\r
- memcpy( ( void *) &( pxUDPPacket->xEthernetHeader.xSourceAddress ), ( void * ) xDefaultPartUDPPacketHeader.ucBytes, sizeof( xDefaultPartUDPPacketHeader ) );\r
+ /*\r
+ * Offset the memcpy by the size of a MAC address to start at the packet's\r
+ * Ethernet header 'source' MAC address; the preceding 'destination' should not be altered.\r
+ */\r
+ char *pxUdpSrcAddrOffset = ( char *) pxUDPPacket + sizeof( MACAddress_t );\r
+ memcpy( pxUdpSrcAddrOffset, xDefaultPartUDPPacketHeader.ucBytes, sizeof( xDefaultPartUDPPacketHeader ) );\r
\r
#if ipconfigSUPPORT_OUTGOING_PINGS == 1\r
if( pxNetworkBuffer->usPort == ipPACKET_CONTAINS_ICMP_DATA )\r
/* The total transmit size adds on the Ethernet header. */\r
pxNetworkBuffer->xDataLength = pxIPHeader->usLength + sizeof( EthernetHeader_t );\r
pxIPHeader->usLength = FreeRTOS_htons( pxIPHeader->usLength );\r
+ /* HT:endian: changed back to network endian */\r
pxIPHeader->ulDestinationIPAddress = pxNetworkBuffer->ulIPAddress;\r
\r
#if( ipconfigUSE_LLMNR == 1 )\r
\r
if( ( ucSocketOptions & ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT ) != 0u )\r
{\r
- usGenerateProtocolChecksum( (uint8_t*)pxUDPPacket, pdTRUE );\r
+ usGenerateProtocolChecksum( (uint8_t*)pxUDPPacket, pxNetworkBuffer->xDataLength, pdTRUE );\r
}\r
else\r
{\r
\r
UDPPacket_t *pxUDPPacket = (UDPPacket_t *) pxNetworkBuffer->pucEthernetBuffer;\r
\r
- pxSocket = pxUDPSocketLookup( usPort );\r
+ /* Caller must check for minimum packet size. */\r
+ pxSocket = pxUDPSocketLookup( usPort );\r
\r
if( pxSocket )\r
{\r
destinationAddress.sin_addr = pxUDPPacket->xIPHeader.ulDestinationIPAddress;\r
\r
if( xHandler( ( Socket_t * ) pxSocket, ( void* ) pcData, ( size_t ) pxNetworkBuffer->xDataLength,\r
- &xSourceAddress, &destinationAddress ) != pdFALSE )\r
+ &xSourceAddress, &destinationAddress ) )\r
{\r
- xReturn = pdFAIL; /* xHandler has consumed the data, do not add it to .xWaitingPacketsList'. */\r
+ xReturn = pdFAIL; /* FAIL means that we did not consume or release the buffer */\r
}\r
}\r
}\r
/* There is no socket listening to the target port, but still it might\r
be for this node. */\r
\r
- #if( ipconfigUSE_DNS == 1 )\r
- /* A DNS reply, check for the source port. Although the DNS client\r
- does open a UDP socket to send a messages, this socket will be\r
- closed after a short timeout. Messages that come late (after the\r
- socket is closed) will be treated here. */\r
- if( FreeRTOS_ntohs( pxUDPPacket->xUDPHeader.usSourcePort ) == ipDNS_PORT )\r
- {\r
- vARPRefreshCacheEntry( &( pxUDPPacket->xEthernetHeader.xSourceAddress ), pxUDPPacket->xIPHeader.ulSourceIPAddress );\r
- xReturn = ( BaseType_t )ulDNSHandlePacket( pxNetworkBuffer );\r
- }\r
- else\r
- #endif\r
-\r
#if( ipconfigUSE_LLMNR == 1 )\r
- /* An LLMNR request, check for the destination port. */\r
+ /* a LLMNR request, check for the destination port. */\r
if( ( usPort == FreeRTOS_ntohs( ipLLMNR_PORT ) ) ||\r
( pxUDPPacket->xUDPHeader.usSourcePort == FreeRTOS_ntohs( ipLLMNR_PORT ) ) )\r
{\r
-Changes since V2.0.0 release\r
+Changes between 160919 and 180821 releases:\r
+\r
+ + Multiple security improvements and fixes in packet parsing routines, DNS\r
+ caching, and TCP sequence number and ID generation.\r
+ + Disable NBNS and LLMNR by default.\r
+ + Add TCP hang protection by default.\r
+\r
+ We thank Ori Karliner of Zimperium zLabs Team for reporting these issues.\r
\r
+ Update FreeRTOS_gethostbyname() to allow an IP address to be passed in -\r
in which case it is just returned as a uint32_t.\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
\r
#if( ipconfigUSE_DNS_CACHE != 0 )\r
#ifndef ipconfigDNS_CACHE_NAME_LENGTH\r
- #define ipconfigDNS_CACHE_NAME_LENGTH ( 16 )\r
+ /* Per https://tools.ietf.org/html/rfc1035, 253 is the maximum string length\r
+ of a DNS name. The following default accounts for a null terminator. */\r
+ #define ipconfigDNS_CACHE_NAME_LENGTH 254\r
#endif\r
\r
#ifndef ipconfigDNS_CACHE_ENTRIES\r
- #define ipconfigDNS_CACHE_ENTRIES 0\r
+ #define ipconfigDNS_CACHE_ENTRIES 1\r
#endif\r
#endif /* ipconfigUSE_DNS_CACHE != 0 */\r
\r
#endif\r
\r
#ifndef ipconfigTCP_KEEP_ALIVE\r
- #define ipconfigTCP_KEEP_ALIVE 1\r
+ #define ipconfigTCP_KEEP_ALIVE 0\r
#endif\r
\r
#ifndef ipconfigDNS_USE_CALLBACKS\r
#define ipconfigUSE_NBNS 0\r
#endif\r
\r
+/* As an attack surface reduction for ports that listen for inbound \r
+connections, hang protection can help reduce the impact of SYN floods. */\r
#ifndef ipconfigTCP_HANG_PROTECTION\r
#define ipconfigTCP_HANG_PROTECTION 1\r
#endif\r
\r
+/* Non-activity timeout is expressed in seconds. */\r
+#ifndef ipconfigTCP_HANG_PROTECTION_TIME\r
+ #define ipconfigTCP_HANG_PROTECTION_TIME 30\r
+#endif\r
+\r
#ifndef ipconfigTCP_IP_SANITY\r
#define ipconfigTCP_IP_SANITY 0\r
#endif\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
uint16_t usGenerateChecksum( uint32_t ulSum, const uint8_t * pucNextData, size_t uxDataLengthBytes );\r
\r
/* Socket related private functions. */\r
+\r
+/* \r
+ * The caller must ensure that pxNetworkBuffer->xDataLength is the UDP packet \r
+ * payload size (excluding packet headers) and that the packet in pucEthernetBuffer \r
+ * is at least the size of UDPPacket_t. \r
+ */\r
BaseType_t xProcessReceivedUDPPacket( NetworkBufferDescriptor_t *pxNetworkBuffer, uint16_t usPort );\r
-void vNetworkSocketsInit( void );\r
+\r
+/*\r
+ * Initialize the socket list data structures for TCP and UDP. \r
+ */\r
+BaseType_t vNetworkSocketsInit( void );\r
\r
/*\r
* Returns pdTRUE if the IP task has been created and is initialised. Otherwise\r
* bOut = false: checksum will be calculated for incoming packets\r
* returning 0xffff means: checksum was correct\r
*/\r
-uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, BaseType_t xOutgoingPacket );\r
+uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer, size_t uxBufferLength, BaseType_t xOutgoingPacket );\r
\r
/*\r
* An Ethernet frame has been updated (maybe it was an ARP request or a PING\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
*/\r
/* Keep this as a multiple of 4 */\r
#if( ipconfigUSE_TCP_WIN == 1 )\r
- #if( ipconfigUSE_TCP_TIMESTAMPS == 1 )\r
- #define ipSIZE_TCP_OPTIONS ( 16u + 12u )\r
- #else\r
- #define ipSIZE_TCP_OPTIONS 16u\r
- #endif\r
+ #define ipSIZE_TCP_OPTIONS 16u\r
#else\r
- #if ipconfigUSE_TCP_TIMESTAMPS == 1\r
- #define ipSIZE_TCP_OPTIONS ( 12u + 12u )\r
- #else\r
- #define ipSIZE_TCP_OPTIONS 12u\r
- #endif\r
+ #define ipSIZE_TCP_OPTIONS 12u\r
#endif\r
\r
/*\r
* In other words: the sequence number of the left side of the sliding window */\r
uint32_t ulFINSequenceNumber; /* The sequence number which carried the FIN flag */\r
uint32_t ulHighestSequenceNumber;/* Sequence number of the right-most byte + 1 */\r
-#if( ipconfigUSE_TCP_TIMESTAMPS == 1 )\r
- uint32_t ulTimeStamp; /* The value of the TCP timestamp, transmitted or received */\r
-#endif\r
} rx, tx;\r
uint32_t ulOurSequenceNumber; /* The SEQ number we're sending out */\r
uint32_t ulUserDataLength; /* Number of bytes in Rx buffer which may be passed to the user, after having received a 'missing packet' */\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/******************************************************************************\r
*\r
available. */\r
if( xSemaphoreTake( xNetworkBufferSemaphore, xBlockTimeTicks ) == pdPASS )\r
{\r
- /* Protect the structure as it is accessed from tasks and\r
+ /* Protect the structure as they are accessed from tasks and\r
interrupts. */\r
ipconfigBUFFER_ALLOC_LOCK();\r
{\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
+ * FreeRTOS+TCP V2.0.7\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
*\r
- * http://aws.amazon.com/freertos\r
* http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
*/\r
\r
-\r
/******************************************************************************\r
*\r
* See the following web page for essential buffer allocation scheme usage and\r
}\r
taskEXIT_CRITICAL();\r
\r
+ /*\r
+ * Update the network state machine, unless the program fails to release its 'xNetworkBufferSemaphore'.\r
+ * The program should only try to release its semaphore if 'xListItemAlreadyInFreeList' is false.\r
+ */\r
if( xListItemAlreadyInFreeList == pdFALSE )\r
{\r
- xSemaphoreGive( xNetworkBufferSemaphore );\r
+ if ( xSemaphoreGive( xNetworkBufferSemaphore ) == pdTRUE )\r
+ {\r
+ iptraceNETWORK_BUFFER_RELEASED( pxNetworkBuffer );\r
+ }\r
+ }\r
+ else\r
+ {\r
+ iptraceNETWORK_BUFFER_RELEASED( pxNetworkBuffer );\r
}\r
-\r
- iptraceNETWORK_BUFFER_RELEASED( pxNetworkBuffer );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/*****************************************************************************\r
*\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/* Standard includes. */\r
#include <stdint.h>\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/* Standard includes. */\r
#include <stdint.h>\r
}\r
\r
/* Obtain the size of the packet and put it into the "usReceivedLength" variable. */\r
-\r
- /* get received frame */\r
- if( xReceivedLength > 0ul )\r
+ /* In order to make the code easier and faster, only packets in a single buffer\r
+ will be accepted. This can be done by making the buffers large enough to\r
+ hold a complete Ethernet packet (1536 bytes). */\r
+ if( xReceivedLength > 0ul && xReceivedLength < ETH_RX_BUF_SIZE ) \r
{\r
- /* In order to make the code easier and faster, only packets in a single buffer\r
- will be accepted. This can be done by making the buffers large enough to\r
- hold a complete Ethernet packet (1536 bytes).\r
- Therefore, two sanity checks: */\r
- configASSERT( xReceivedLength <= ETH_RX_BUF_SIZE );\r
-\r
if( ( pxDMARxDescriptor->Status & ( ETH_DMARXDESC_CE | ETH_DMARXDESC_IPV4HCE | ETH_DMARXDESC_FT ) ) != ETH_DMARXDESC_FT )\r
{\r
/* Not an Ethernet frame-type or a checmsum error. */\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/* WinPCap includes. */\r
#define HAVE_REMOTE\r
* by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h.\r
*/\r
static void prvOpenSelectedNetworkInterface( pcap_if_t *pxAllNetworkInterfaces );\r
-static void prvOpenInterface( const char *pucName );\r
+static int prvOpenInterface( const char *pucName );\r
\r
/*\r
* Configure the capture filter to allow blocking reads, and to filter out\r
printf( "\r\nThe interface that will be opened is set by " );\r
printf( "\"configNETWORK_INTERFACE_TO_USE\", which\r\nshould be defined in FreeRTOSConfig.h\r\n" );\r
\r
- if( ( xConfigNextworkInterfaceToUse < 1L ) || ( xConfigNextworkInterfaceToUse >= lInterfaceNumber ) )\r
+ if( ( xConfigNextworkInterfaceToUse < 0L ) || ( xConfigNextworkInterfaceToUse >= lInterfaceNumber ) )\r
{\r
printf( "\r\nERROR: configNETWORK_INTERFACE_TO_USE is set to %d, which is an invalid value.\r\n", xConfigNextworkInterfaceToUse );\r
printf( "Please set configNETWORK_INTERFACE_TO_USE to one of the interface numbers listed above,\r\n" );\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvOpenInterface( const char *pucName )\r
+static int prvOpenInterface( const char *pucName )\r
{\r
static char pucInterfaceName[ 256 ];\r
\r
if ( pxOpenedInterfaceHandle == NULL )\r
{\r
printf( "\n%s is not supported by WinPcap and cannot be opened\n", pucInterfaceName );\r
+ return 1;\r
}\r
else\r
{\r
out packets that are not of interest to this demo. */\r
prvConfigureCaptureBehaviour();\r
}\r
+ return 0;\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
/* Walk the list of devices until the selected device is located. */\r
xInterface = pxAllNetworkInterfaces;\r
- for( x = 0L; x < ( xConfigNextworkInterfaceToUse - 1L ); x++ )\r
- {\r
- xInterface = xInterface->next;\r
+ if (0 == xConfigNextworkInterfaceToUse) {\r
+ while (NULL != xInterface) {\r
+ xInterface = xInterface->next;\r
+ if (0 == prvOpenInterface(xInterface->name)) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ else {\r
+ for (x = 1L; x < xConfigNextworkInterfaceToUse; x++)\r
+ {\r
+ xInterface = xInterface->next;\r
+ }\r
+ /* Open the selected interface. */\r
+ (void) prvOpenInterface(xInterface->name);\r
}\r
-\r
- /* Open the selected interface. */\r
- prvOpenInterface( xInterface->name );\r
\r
/* The device list is no longer required. */\r
pcap_freealldevs( pxAllNetworkInterfaces );\r
\r
iptraceNETWORK_INTERFACE_RECEIVE();\r
\r
- eResult = ipCONSIDER_FRAME_FOR_PROCESSING( pucPacketData );\r
+ /* Check for minimal size. */\r
+ if( pxHeader->len >= sizeof( EthernetHeader_t ) )\r
+ {\r
+ eResult = ipCONSIDER_FRAME_FOR_PROCESSING( pucPacketData );\r
+ }\r
+ else\r
+ {\r
+ eResult = eReleaseBuffer;\r
+ }\r
+\r
if( eResult == eProcessBuffer )\r
{\r
/* Will the data fit into the frame buffer? */\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/* Standard includes. */\r
#include <stdint.h>\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
#include "Zynq/x_emacpsif.h"\r
#include "Zynq/x_topology.h"\r
/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
+FreeRTOS+TCP V2.0.7\r
+Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+this software and associated documentation files (the "Software"), to deal in\r
+the Software without restriction, including without limitation the rights to\r
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+the Software, and to permit persons to whom the Software is furnished to do so,\r
+subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+ http://aws.amazon.com/freertos\r
+ http://www.FreeRTOS.org\r
+*/\r
\r
/* Standard includes. */\r
#include <stdint.h>\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-\r
-/* Standard includes. */\r
-#include <stdint.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-\r
-/* FreeRTOS+TCP includes. */\r
-#include "FreeRTOS_IP.h"\r
-#include "FreeRTOS_Sockets.h"\r
-#include "FreeRTOS_TCP_server.h"\r
-#include "FreeRTOS_server_private.h"\r
-\r
-/* Remove the entire file if TCP is not being used. */\r
-#if( ipconfigUSE_TCP == 1 ) && ( ( ipconfigUSE_HTTP == 1 ) || ( ipconfigUSE_FTP == 1 ) )\r
-\r
-#if !defined( ARRAY_SIZE )\r
- #define ARRAY_SIZE(x) ( BaseType_t ) (sizeof( x ) / sizeof( x )[ 0 ] )\r
-#endif\r
-\r
-\r
-static void prvReceiveNewClient( TCPServer_t *pxServer, BaseType_t xIndex, Socket_t xNexSocket );\r
-static char *strnew( const char *pcString );\r
-/* Remove slashes at the end of a path. */\r
-static void prvRemoveSlash( char *pcDir );\r
-\r
-TCPServer_t *FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG *pxConfigs, BaseType_t xCount )\r
-{\r
-TCPServer_t *pxServer;\r
-SocketSet_t xSocketSet;\r
-\r
- /* Create a new server.\r
- xPort / xPortAlt : Make the service available on 1 or 2 public port numbers. */\r
- xSocketSet = FreeRTOS_CreateSocketSet();\r
-\r
- if( xSocketSet != NULL )\r
- {\r
- BaseType_t xSize;\r
-\r
- xSize = sizeof( *pxServer ) - sizeof( pxServer->xServers ) + xCount * sizeof( pxServer->xServers[ 0 ] );\r
-\r
- pxServer = ( TCPServer_t * ) pvPortMallocLarge( xSize );\r
- if( pxServer != NULL )\r
- {\r
- struct freertos_sockaddr xAddress;\r
- BaseType_t xNoTimeout = 0;\r
- BaseType_t xIndex;\r
-\r
- memset( pxServer, '\0', xSize );\r
- pxServer->xServerCount = xCount;\r
- pxServer->xSocketSet = xSocketSet;\r
-\r
- for( xIndex = 0; xIndex < xCount; xIndex++ )\r
- {\r
- BaseType_t xPortNumber = pxConfigs[ xIndex ].xPortNumber;\r
-\r
- if( xPortNumber > 0 )\r
- {\r
- Socket_t xSocket;\r
-\r
- xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
- FreeRTOS_printf( ( "TCP socket on port %d\n", ( int )xPortNumber ) );\r
-\r
- if( xSocket != FREERTOS_NO_SOCKET )\r
- {\r
- xAddress.sin_addr = FreeRTOS_GetIPAddress(); // Single NIC, currently not used\r
- xAddress.sin_port = FreeRTOS_htons( xPortNumber );\r
-\r
- FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );\r
- FreeRTOS_listen( xSocket, pxConfigs[ xIndex ].xBackLog );\r
-\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xNoTimeout, sizeof( BaseType_t ) );\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xNoTimeout, sizeof( BaseType_t ) );\r
-\r
- #if( ipconfigHTTP_RX_BUFSIZE > 0 )\r
- {\r
- if( pxConfigs[ xIndex ].eType == eSERVER_HTTP )\r
- {\r
- WinProperties_t xWinProps;\r
-\r
- memset( &xWinProps, '\0', sizeof( xWinProps ) );\r
- /* The parent socket itself won't get connected. The properties below\r
- will be inherited by each new child socket. */\r
- xWinProps.lTxBufSize = ipconfigHTTP_TX_BUFSIZE;\r
- xWinProps.lTxWinSize = ipconfigHTTP_TX_WINSIZE;\r
- xWinProps.lRxBufSize = ipconfigHTTP_RX_BUFSIZE;\r
- xWinProps.lRxWinSize = ipconfigHTTP_RX_WINSIZE;\r
-\r
- /* Set the window and buffer sizes. */\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );\r
- }\r
- }\r
- #endif\r
-\r
- FreeRTOS_FD_SET( xSocket, xSocketSet, eSELECT_READ|eSELECT_EXCEPT );\r
- pxServer->xServers[ xIndex ].xSocket = xSocket;\r
- pxServer->xServers[ xIndex ].eType = pxConfigs[ xIndex ].eType;\r
- pxServer->xServers[ xIndex ].pcRootDir = strnew( pxConfigs[ xIndex ].pcRootDir );\r
- prvRemoveSlash( ( char * ) pxServer->xServers[ xIndex ].pcRootDir );\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- /* Could not allocate the server, delete the socket set */\r
- FreeRTOS_DeleteSocketSet( xSocketSet );\r
- }\r
- }\r
- else\r
- {\r
- /* Could not create a socket set, return NULL */\r
- pxServer = NULL;\r
- }\r
-\r
- return pxServer;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvReceiveNewClient( TCPServer_t *pxServer, BaseType_t xIndex, Socket_t xNexSocket )\r
-{\r
-TCPClient_t *pxClient = NULL;\r
-BaseType_t xSize = 0;\r
-FTCPWorkFunction fWorkFunc = NULL;\r
-FTCPDeleteFunction fDeleteFunc = NULL;\r
-const char *pcType = "Unknown";\r
-\r
- /*_RB_ Can the work and delete functions be part of the xSERVER_CONFIG structure\r
- becomes generic, with no pre-processing required? */\r
- #if( ipconfigUSE_HTTP != 0 )\r
- {\r
- if( pxServer->xServers[ xIndex ].eType == eSERVER_HTTP )\r
- {\r
- xSize = sizeof( HTTPClient_t );\r
- fWorkFunc = xHTTPClientWork;\r
- fDeleteFunc = vHTTPClientDelete;\r
- pcType = "HTTP";\r
- }\r
- }\r
- #endif /* ipconfigUSE_HTTP != 0 */\r
-\r
- #if( ipconfigUSE_FTP != 0 )\r
- {\r
- if( pxServer->xServers[ xIndex ].eType == eSERVER_FTP )\r
- {\r
- xSize = sizeof( FTPClient_t );\r
- fWorkFunc = xFTPClientWork;\r
- fDeleteFunc = vFTPClientDelete;\r
- pcType = "FTP";\r
- }\r
- }\r
- #endif /* ipconfigUSE_FTP != 0 */\r
-\r
- /* Malloc enough space for a new HTTP-client */\r
- if( xSize )\r
- {\r
- pxClient = ( TCPClient_t* ) pvPortMallocLarge( xSize );\r
- }\r
-\r
- if( pxClient != NULL )\r
- {\r
- memset( pxClient, '\0', xSize );\r
-\r
- /* Put the new client in front of the list. */\r
- pxClient->eType = pxServer->xServers[ xIndex ].eType;\r
- pxClient->pcRootDir = pxServer->xServers[ xIndex ].pcRootDir;\r
- pxClient->pxParent = pxServer;\r
- pxClient->xSocket = xNexSocket;\r
- pxClient->pxNextClient = pxServer->pxClients;\r
- pxClient->fWorkFunction = fWorkFunc;\r
- pxClient->fDeleteFunction = fDeleteFunc;\r
- pxServer->pxClients = pxClient;\r
-\r
- FreeRTOS_FD_SET( xNexSocket, pxServer->xSocketSet, eSELECT_READ|eSELECT_EXCEPT );\r
- }\r
- else\r
- {\r
- pcType = "closed";\r
- FreeRTOS_closesocket( xNexSocket );\r
- }\r
- {\r
- struct freertos_sockaddr xRemoteAddress;\r
- FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );\r
- FreeRTOS_printf( ( "TPC-server: new %s client %xip\n", pcType, (unsigned)FreeRTOS_ntohl( xRemoteAddress.sin_addr ) ) );\r
- }\r
-\r
- /* Remove compiler warnings in case FreeRTOS_printf() is not used. */\r
- ( void ) pcType;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void FreeRTOS_TCPServerWork( TCPServer_t *pxServer, TickType_t xBlockingTime )\r
-{\r
-TCPClient_t **ppxClient;\r
-BaseType_t xIndex;\r
-BaseType_t xRc;\r
-\r
- /* Let the server do one working cycle */\r
- xRc = FreeRTOS_select( pxServer->xSocketSet, xBlockingTime );\r
-\r
- if( xRc != 0 )\r
- {\r
- for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )\r
- {\r
- struct freertos_sockaddr xAddress;\r
- Socket_t xNexSocket;\r
- socklen_t xSocketLength;\r
-\r
- if( pxServer->xServers[ xIndex ].xSocket == FREERTOS_NO_SOCKET )\r
- {\r
- continue;\r
- }\r
-\r
- xSocketLength = sizeof( xAddress );\r
- xNexSocket = FreeRTOS_accept( pxServer->xServers[ xIndex ].xSocket, &xAddress, &xSocketLength);\r
-\r
- if( ( xNexSocket != FREERTOS_NO_SOCKET ) && ( xNexSocket != FREERTOS_INVALID_SOCKET ) )\r
- {\r
- prvReceiveNewClient( pxServer, xIndex, xNexSocket );\r
- }\r
- }\r
- }\r
-\r
- ppxClient = &pxServer->pxClients;\r
-\r
- while( ( * ppxClient ) != NULL )\r
- {\r
- TCPClient_t *pxThis = *ppxClient;\r
-\r
- /* Almost C++ */\r
- xRc = pxThis->fWorkFunction( pxThis );\r
-\r
- if (xRc < 0 )\r
- {\r
- *ppxClient = pxThis->pxNextClient;\r
- /* Close handles, resources */\r
- pxThis->fDeleteFunction( pxThis );\r
- /* Free the space */\r
- vPortFreeLarge( pxThis );\r
- }\r
- else\r
- {\r
- ppxClient = &( pxThis->pxNextClient );\r
- }\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static char *strnew( const char *pcString )\r
-{\r
-BaseType_t xLength;\r
-char *pxBuffer;\r
-\r
- xLength = strlen( pcString ) + 1;\r
- pxBuffer = ( char * ) pvPortMalloc( xLength );\r
- if( pxBuffer != NULL )\r
- {\r
- memcpy( pxBuffer, pcString, xLength );\r
- }\r
-\r
- return pxBuffer;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvRemoveSlash( char *pcDir )\r
-{\r
-BaseType_t xLength = strlen( pcDir );\r
-\r
- while( ( xLength > 0 ) && ( pcDir[ xLength - 1 ] == '/' ) )\r
- {\r
- pcDir[ --xLength ] = '\0';\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ipconfigSUPPORT_SIGNALS != 0 )\r
-\r
- /* FreeRTOS_TCPServerWork() calls select().\r
- The two functions below provide a possibility to interrupt\r
- the call to select(). After the interruption, resume\r
- by calling FreeRTOS_TCPServerWork() again. */\r
- BaseType_t FreeRTOS_TCPServerSignal( TCPServer_t *pxServer )\r
- {\r
- BaseType_t xIndex;\r
- BaseType_t xResult = pdFALSE;\r
- for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )\r
- {\r
- if( pxServer->xServers[ xIndex ].xSocket != FREERTOS_NO_SOCKET )\r
- {\r
- FreeRTOS_SignalSocket( pxServer->xServers[ xIndex ].xSocket );\r
- xResult = pdTRUE;\r
- break;\r
- }\r
- }\r
-\r
- return xResult;\r
- }\r
-\r
-#endif /* ipconfigSUPPORT_SIGNALS */\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ipconfigSUPPORT_SIGNALS != 0 )\r
-\r
- /* Same as above: this function may be called from an ISR,\r
- for instance a GPIO interrupt. */\r
- BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t *pxServer, BaseType_t *pxHigherPriorityTaskWoken )\r
- {\r
- BaseType_t xIndex;\r
- BaseType_t xResult = pdFALSE;\r
- for( xIndex = 0; xIndex < pxServer->xServerCount; xIndex++ )\r
- {\r
- if( pxServer->xServers[ xIndex ].xSocket != FREERTOS_NO_SOCKET )\r
- {\r
- FreeRTOS_SignalSocketFromISR( pxServer->xServers[ xIndex ].xSocket, pxHigherPriorityTaskWoken );\r
- xResult = pdTRUE;\r
- break;\r
- }\r
- }\r
-\r
- return xResult;\r
- }\r
-#endif /* ipconfigSUPPORT_SIGNALS */\r
-/*-----------------------------------------------------------*/\r
-\r
-#endif /* ( ipconfigUSE_TCP == 1 ) && ( ( ipconfigUSE_HTTP == 1 ) || ( ipconfigUSE_FTP == 1 ) ) */\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-\r
-/* FreeRTOS+TCP includes. */\r
-#include "FreeRTOS_FTP_commands.h"\r
-\r
-const FTPCommand_t xFTPCommands[ FTP_CMD_COUNT ] =\r
-{\r
-/* cmdLen cmdName[7] cmdType checkLogin checkNullArg */\r
- { 4, "USER", ECMD_USER, pdFALSE, pdFALSE },\r
- { 4, "PASS", ECMD_PASS, pdFALSE, pdFALSE },\r
- { 4, "ACCT", ECMD_ACCT, pdTRUE, pdFALSE },\r
- { 3, "CWD", ECMD_CWD, pdTRUE, pdTRUE },\r
- { 4, "CDUP", ECMD_CDUP, pdTRUE, pdFALSE },\r
- { 4, "SMNT", ECMD_SMNT, pdTRUE, pdFALSE },\r
- { 4, "QUIT", ECMD_QUIT, pdTRUE, pdFALSE },\r
- { 4, "REIN", ECMD_REIN, pdTRUE, pdFALSE },\r
- { 4, "PORT", ECMD_PORT, pdTRUE, pdFALSE },\r
- { 4, "PASV", ECMD_PASV, pdTRUE, pdFALSE },\r
- { 4, "TYPE", ECMD_TYPE, pdTRUE, pdFALSE },\r
- { 4, "STRU", ECMD_STRU, pdTRUE, pdFALSE },\r
- { 4, "MODE", ECMD_MODE, pdTRUE, pdFALSE },\r
- { 4, "RETR", ECMD_RETR, pdTRUE, pdTRUE },\r
- { 4, "STOR", ECMD_STOR, pdTRUE, pdTRUE },\r
- { 4, "STOU", ECMD_STOU, pdTRUE, pdFALSE },\r
- { 4, "APPE", ECMD_APPE, pdTRUE, pdFALSE },\r
- { 4, "ALLO", ECMD_ALLO, pdTRUE, pdFALSE },\r
- { 4, "REST", ECMD_REST, pdTRUE, pdFALSE },\r
- { 4, "RNFR", ECMD_RNFR, pdTRUE, pdTRUE },\r
- { 4, "RNTO", ECMD_RNTO, pdTRUE, pdTRUE },\r
- { 4, "ABOR", ECMD_ABOR, pdTRUE, pdFALSE },\r
- { 4, "SIZE", ECMD_SIZE, pdTRUE, pdTRUE },\r
- { 4, "MDTM", ECMD_MDTM, pdTRUE, pdTRUE },\r
- { 4, "DELE", ECMD_DELE, pdTRUE, pdTRUE },\r
- { 3, "RMD", ECMD_RMD, pdTRUE, pdTRUE },\r
- { 3, "MKD", ECMD_MKD, pdTRUE, pdTRUE },\r
- { 3, "PWD", ECMD_PWD, pdTRUE, pdFALSE },\r
- { 4, "LIST", ECMD_LIST, pdTRUE, pdFALSE },\r
- { 4, "NLST", ECMD_NLST, pdTRUE, pdFALSE },\r
- { 4, "SITE", ECMD_SITE, pdTRUE, pdFALSE },\r
- { 4, "SYST", ECMD_SYST, pdFALSE, pdFALSE },\r
- { 4, "FEAT", ECMD_FEAT, pdFALSE, pdFALSE },\r
- { 4, "STAT", ECMD_STAT, pdTRUE, pdFALSE },\r
- { 4, "HELP", ECMD_HELP, pdFALSE, pdFALSE },\r
- { 4, "NOOP", ECMD_NOOP, pdFALSE, pdFALSE },\r
- { 4, "EMPT", ECMD_EMPTY, pdFALSE, pdFALSE },\r
- { 4, "CLOS", ECMD_CLOSE, pdTRUE, pdFALSE },\r
- { 4, "UNKN", ECMD_UNKNOWN, pdFALSE, pdFALSE },\r
-};\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-/* Standard includes. */\r
-#include <stdint.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <time.h>\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "portmacro.h"\r
-\r
-/* FreeRTOS+TCP includes. */\r
-#include "FreeRTOS_IP.h"\r
-#include "FreeRTOS_TCP_IP.h"\r
-#include "FreeRTOS_Sockets.h"\r
-#include "FreeRTOS_Stream_Buffer.h"\r
-\r
-/* FreeRTOS Protocol includes. */\r
-#include "FreeRTOS_FTP_commands.h"\r
-#include "FreeRTOS_TCP_server.h"\r
-#include "FreeRTOS_server_private.h"\r
-\r
-/* Remove the whole file if FTP is not supported. */\r
-#if( ipconfigUSE_FTP == 1 )\r
-\r
-#ifndef HTTP_SERVER_BACKLOG\r
- #define HTTP_SERVER_BACKLOG ( 12 )\r
-#endif\r
-\r
-#if !defined( ARRAY_SIZE )\r
- #define ARRAY_SIZE( x ) ( BaseType_t ) (sizeof( x ) / sizeof( x )[ 0 ] )\r
-#endif\r
-\r
-#if defined(__WIN32__) && !defined(ipconfigFTP_FS_USES_BACKSLAH)\r
- #define ipconfigFTP_FS_USES_BACKSLAH 1\r
-#endif\r
-\r
-/* Some defines to make the code more readbale */\r
-#define pcCOMMAND_BUFFER pxClient->pxParent->pcCommandBuffer\r
-#define pcNEW_DIR pxClient->pxParent->pcNewDir\r
-#define pcFILE_BUFFER pxClient->pxParent->pcFileBuffer\r
-\r
-/* This FTP server will only do binary transfers */\r
-#define TMODE_BINARY 1\r
-#define TMODE_ASCII 2\r
-#define TMODE_7BITS 3\r
-#define TMODE_8BITS 4\r
-\r
-/* Ascii character definitions. */\r
-#define ftpASCII_CR 13\r
-#define ftpASCII_LF 10\r
-\r
-#if defined( FTP_WRITES_ALIGNED ) || defined( ipconfigFTP_WRITES_ALIGNED )\r
- #error Name change : please rename the define to the new name 'ipconfigFTP_ZERO_COPY_ALIGNED_WRITES'\r
-#endif\r
-\r
-/*\r
- * ipconfigFTP_ZERO_COPY_ALIGNED_WRITES : experimental optimisation option.\r
- * If non-zero, receiving data will be done with the zero-copy method and also\r
- * writes to disk will be done with sector-alignment as much as possible.\r
- */\r
-#ifndef ipconfigFTP_ZERO_COPY_ALIGNED_WRITES\r
- #define ipconfigFTP_ZERO_COPY_ALIGNED_WRITES 0\r
-#endif\r
-\r
-/*\r
- * This module only has 2 public functions:\r
- */\r
-BaseType_t xFTPClientWork( TCPClient_t *pxClient );\r
-void vFTPClientDelete( TCPClient_t *pxClient );\r
-\r
-/*\r
- * Process a single command.\r
- */\r
-static BaseType_t prvProcessCommand( FTPClient_t *pxClient, BaseType_t xIndex, char *pcRestCommand );\r
-\r
-/*\r
- * Create a socket for a data connection to the FTP client.\r
- */\r
-static BaseType_t prvTransferConnect( FTPClient_t *pxClient, BaseType_t xDoListen );\r
-\r
-/*\r
- * Either call listen() or connect() to start the transfer connection.\r
- */\r
-static BaseType_t prvTransferStart( FTPClient_t *pxClient );\r
-\r
-/*\r
- * See if the socket has got connected or disconnected. Close the socket if\r
- * necessary.\r
- */\r
-static void prvTransferCheck( FTPClient_t *pxClient );\r
-\r
-/*\r
- * Close the data socket and issue some informative logging.\r
- */\r
-static void prvTransferCloseSocket( FTPClient_t *pxClient );\r
-\r
-/*\r
- * Close the file handle (pxReadHandle or pxWriteHandle).\r
- */\r
-static void prvTransferCloseFile( FTPClient_t *pxClient );\r
-\r
-/*\r
- * Close a directory (-handle).\r
- */\r
-static void prvTransferCloseDir( FTPClient_t *pxClient );\r
-\r
-/*\r
- * Translate a string (indicating a transfer type) to a number.\r
- */\r
-static BaseType_t prvGetTransferType( const char *pcType );\r
-\r
-#if( ipconfigHAS_PRINTF != 0 )\r
- /*\r
- * For nice logging: write an amount (number of bytes), e.g. 3512200 as\r
- * "3.45 MB"\r
- */\r
- static const char *pcMkSize( uint32_t ulAmount, char *pcBuffer, BaseType_t xBufferSize );\r
-#endif\r
-\r
-#if( ipconfigHAS_PRINTF != 0 )\r
- /*\r
- * Calculate the average as bytes-per-second, when amount and milliseconds\r
- * are known.\r
- */\r
- static uint32_t ulGetAverage( uint32_t ulAmount, TickType_t xDeltaMs );\r
-#endif\r
-\r
-/*\r
- * A port command looks like: PORT h1,h2,h3,h4,p1,p2. Parse it and translate it\r
- * to an IP-address and a port number.\r
- */\r
-static UBaseType_t prvParsePortData( const char *pcCommand, uint32_t *pulIPAddress );\r
-\r
-/*\r
- * CWD: Change current working directory.\r
- */\r
-\r
-static BaseType_t prvChangeDir( FTPClient_t *pxClient, char *pcDirectory );\r
-\r
-/*\r
- * RNFR: Rename from ...\r
- */\r
-static BaseType_t prvRenameFrom( FTPClient_t *pxClient, const char *pcFileName );\r
-\r
-/*\r
- * RNTO: Rename to ...\r
- */\r
-static BaseType_t prvRenameTo( FTPClient_t *pxClient, const char *pcFileName );\r
-\r
-/*\r
- * SITE: Change file permissions.\r
- */\r
-static BaseType_t prvSiteCmd( FTPClient_t *pxClient, char *pcRestCommand );\r
-\r
-/*\r
- * DELE: Delete a file.\r
- */\r
-static BaseType_t prvDeleteFile( FTPClient_t *pxClient, char *pcFileName );\r
-\r
-/*\r
- * SIZE: get the size of a file (xSendDate = 0).\r
- * MDTM: get data and time properties (xSendDate = 1).\r
- */\r
-static BaseType_t prvSizeDateFile( FTPClient_t *pxClient, char *pcFileName, BaseType_t xSendDate );\r
-\r
-/*\r
- * MKD: Make / create a directory (xDoRemove = 0).\r
- * RMD: Remove a directory (xDoRemove = 1).\r
- */\r
-static BaseType_t prvMakeRemoveDir( FTPClient_t *pxClient, const char *pcDirectory, BaseType_t xDoRemove );\r
-\r
-/*\r
- * The next three commands: LIST, RETR and STOR all require a data socket.\r
- * The data connection is either started with a 'PORT' or a 'PASV' command.\r
- * Each of the commands has a prepare- (Prep) and a working- (Work) function.\r
- * The Work function should be called as long as the data socket is open, and\r
- * there is data to be transmitted.\r
- */\r
-\r
-/*\r
- * LIST: Send a directory listing in Unix style.\r
- */\r
-static BaseType_t prvListSendPrep( FTPClient_t *pxClient );\r
-static BaseType_t prvListSendWork( FTPClient_t *pxClient );\r
-\r
-/*\r
- * RETR: Send a file to the FTP client.\r
- */\r
-static BaseType_t prvRetrieveFilePrep( FTPClient_t *pxClient, char *pcFileName );\r
-static BaseType_t prvRetrieveFileWork( FTPClient_t *pxClient );\r
-\r
-/*\r
- * STOR: Receive a file from the FTP client and store it.\r
- */\r
-static BaseType_t prvStoreFilePrep( FTPClient_t *pxClient, char *pcFileName );\r
-static BaseType_t prvStoreFileWork( FTPClient_t *pxClient );\r
-\r
-/*\r
- * Print/format a single directory entry in Unix style.\r
- */\r
-static BaseType_t prvGetFileInfoStat( FF_DirEnt_t *pxEntry, char *pcLine, BaseType_t xMaxLength );\r
-\r
-/*\r
- * Send a reply to a socket, either the command- or the data-socket.\r
- */\r
-static BaseType_t prvSendReply( Socket_t xSocket, const char *pcBuffer, BaseType_t xLength );\r
-\r
-/*\r
- * Prepend the root directory (if any), plus the current working directory\r
- * (always), to get an absolute path.\r
- */\r
-BaseType_t xMakeAbsolute( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcPath );\r
-\r
-/*\r
-\r
-####### ##### ###### # # ##\r
- # ## # # # # # # # #\r
- # # # # # # #\r
- # # # # # # # #### ### ## # #\r
- ##### # ##### # # # # # # # # # #\r
- # # # # # # # # # ## # ####\r
- # # # ## ## # # # # #\r
- # # # ## ## # # # # #\r
-#### #### #### ## ## #### #### ## ##\r
-\r
- * xFTPClientWork()\r
- * will be called by FreeRTOS_TCPServerWork(), after select has expired().\r
- * FD_ISSET will not be used. This work function will always be called at\r
- * regular intervals, and also after a select() event has occurred.\r
- */\r
-BaseType_t xFTPClientWork( TCPClient_t *pxTCPClient )\r
-{\r
-FTPClient_t *pxClient = ( FTPClient_t * ) pxTCPClient;\r
-BaseType_t xRc;\r
-\r
- if( pxClient->bits.bHelloSent == pdFALSE_UNSIGNED )\r
- {\r
- BaseType_t xLength;\r
-\r
- pxClient->bits.bHelloSent = pdTRUE_UNSIGNED;\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "220 Welcome to the FreeRTOS+TCP FTP server\r\n" );\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- }\r
-\r
- /* Call recv() in a non-blocking way, to see if there is an FTP command\r
- sent to this server. */\r
- xRc = FreeRTOS_recv( pxClient->xSocket, ( void * )pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), 0 );\r
-\r
- if( xRc > 0 )\r
- {\r
- BaseType_t xIndex;\r
- const FTPCommand_t *pxCommand;\r
- char *pcRestCommand;\r
-\r
- if( xRc < ( BaseType_t ) sizeof( pcCOMMAND_BUFFER ) )\r
- {\r
- pcCOMMAND_BUFFER[ xRc ] = '\0';\r
- }\r
-\r
- while( xRc && ( ( pcCOMMAND_BUFFER[ xRc - 1 ] == ftpASCII_CR ) || ( pcCOMMAND_BUFFER[ xRc - 1 ] == ftpASCII_LF ) ) )\r
- {\r
- pcCOMMAND_BUFFER[ --xRc ] = '\0';\r
- }\r
-\r
- /* Now iterate through a list of FTP commands, and look for a match. */\r
- pxCommand = xFTPCommands;\r
- pcRestCommand = pcCOMMAND_BUFFER;\r
- for( xIndex = 0; xIndex < FTP_CMD_COUNT - 1; xIndex++, pxCommand++ )\r
- {\r
- BaseType_t xLength;\r
-\r
- /* The length of each command is stored as well, just to be a bit\r
- quicker here. */\r
- xLength = pxCommand->xCommandLength;\r
-\r
- if( ( xRc >= xLength ) && ( memcmp( ( const void * ) pxCommand->pcCommandName, ( const void * ) pcCOMMAND_BUFFER, xLength ) == 0 ) )\r
- {\r
- /* A match with an existing command is found. Skip any\r
- whitespace to get the first parameter. */\r
- pcRestCommand += xLength;\r
- while( ( *pcRestCommand == ' ' ) || ( *pcRestCommand == '\t' ) )\r
- {\r
- pcRestCommand++;\r
- }\r
- break;\r
- }\r
- }\r
-\r
- /* If the command received was not recognised, xIndex will point to a\r
- fake entry called 'ECMD_UNKNOWN'. */\r
- prvProcessCommand( pxClient, xIndex, pcRestCommand );\r
- }\r
- else if( xRc < 0 )\r
- {\r
- /* The connection will be closed and the client will be deleted. */\r
- FreeRTOS_printf( ( "xFTPClientWork: xRc = %ld\n", xRc ) );\r
- }\r
-\r
- /* Does it have an open data connection? */\r
- if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
- {\r
- /* See if the connection has changed. */\r
- prvTransferCheck( pxClient );\r
-\r
- /* "pcConnectionAck" contains a string like:\r
- "Response: 150 Accepted data connection from 192.168.2.3:6789"\r
- The socket can only be used once this acknowledgement has been sent. */\r
- if( ( pxClient->xTransferSocket != FREERTOS_NO_SOCKET ) && ( pxClient->pcConnectionAck[ 0 ] == '\0' ) )\r
- {\r
- BaseType_t xClientRc = 0;\r
-\r
- if( pxClient->bits1.bDirHasEntry )\r
- {\r
- /* Still listing a directory. */\r
- xClientRc = prvListSendWork( pxClient );\r
- }\r
- else if( pxClient->pxReadHandle != NULL )\r
- {\r
- /* Sending a file. */\r
- xClientRc = prvRetrieveFileWork( pxClient );\r
- }\r
- else if( pxClient->pxWriteHandle != NULL )\r
- {\r
- /* Receiving a file. */\r
- xClientRc = prvStoreFileWork( pxClient );\r
- }\r
-\r
- if( xClientRc < 0 )\r
- {\r
- prvTransferCloseSocket( pxClient );\r
- prvTransferCloseFile( pxClient );\r
- }\r
- }\r
- }\r
-\r
- return xRc;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvTransferCloseDir( FTPClient_t *pxClient )\r
-{\r
- /* Nothing to close for +FAT. */\r
- ( void ) pxClient;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vFTPClientDelete( TCPClient_t *pxTCPClient )\r
-{\r
-FTPClient_t *pxClient = ( FTPClient_t * ) pxTCPClient;\r
-\r
- /* Close any directory-listing-handles (not used by +FAT ). */\r
- prvTransferCloseDir( pxClient );\r
- /* Close the data-socket. */\r
- prvTransferCloseSocket( pxClient );\r
- /* Close any open file handle. */\r
- prvTransferCloseFile( pxClient );\r
-\r
- /* Close the FTP command socket */\r
- if( pxClient->xSocket != FREERTOS_NO_SOCKET )\r
- {\r
- FreeRTOS_FD_CLR( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_ALL );\r
- FreeRTOS_closesocket( pxClient->xSocket );\r
- pxClient->xSocket = FREERTOS_NO_SOCKET;\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvProcessCommand( FTPClient_t *pxClient, BaseType_t xIndex, char *pcRestCommand )\r
-{\r
-const FTPCommand_t *pxFTPCommand = &( xFTPCommands[ xIndex ] );\r
-const char *pcMyReply = NULL;\r
-BaseType_t xResult = 0;\r
-\r
- if( ( pxFTPCommand->ucCommandType != ECMD_PASS ) && ( pxFTPCommand->ucCommandType != ECMD_PORT ) )\r
- {\r
- FreeRTOS_printf( ( " %s %s\n", pxFTPCommand->pcCommandName, pcRestCommand ) );\r
- }\r
-\r
- if( ( pxFTPCommand->checkLogin != pdFALSE ) && ( pxClient->bits.bLoggedIn == pdFALSE_UNSIGNED ) )\r
- {\r
- pcMyReply = REPL_530; /* Please first log in. */\r
- }\r
- else if( ( pxFTPCommand->checkNullArg != pdFALSE ) && ( ( pcRestCommand == NULL ) || ( pcRestCommand[ 0 ] == '\0' ) ) )\r
- {\r
- pcMyReply = REPL_501; /* Command needs a parameter. */\r
- }\r
-\r
- if( pcMyReply == NULL )\r
- {\r
- switch( pxFTPCommand->ucCommandType )\r
- {\r
- case ECMD_USER: /* User. */\r
- /* User name has been entered, expect password. */\r
- pxClient->bits.bStatusUser = pdTRUE_UNSIGNED;\r
-\r
- #if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )/*_RB_ Needs defaulting and adding to the web documentation. */\r
- {\r
- /* Save the user name in 'pcFileName'. */\r
- snprintf( pxClient->pcFileName, sizeof( pxClient->pcFileName ), "%s", pcRestCommand );\r
-\r
- /* The USER name is presented to the application. The function\r
- may return a const string like "331 Please enter your\r
- password\r\n". */\r
- pcMyReply = pcApplicationFTPUserHook( pxClient->pcFileName );\r
- if( pcMyReply == NULL )\r
- {\r
- pcMyReply = REPL_331_ANON;\r
- }\r
- }\r
- #else\r
- {\r
- /* No password checks, any password will be accepted. */\r
- pcMyReply = REPL_331_ANON;\r
- }\r
- #endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 */\r
-\r
- #if( ipconfigFTP_HAS_USER_PROPERTIES_HOOK != 0 )/*_RB_ Needs defaulting and adding to the web documentation. */\r
- {\r
- FTPUserProperties_t xProperties;\r
-\r
- xProperties.pcRootDir = pxClient->pcRootDir;\r
- xProperties.xReadOnly = pdFALSE;\r
- xProperties.usPortNumber = pxClient->usClientPort;\r
- vApplicationFTPUserPropertiesHook( pxClient->pcFileName, &( xProperties ) );\r
-\r
- if( xProperties.pcRootDir != NULL )\r
- {\r
- pxClient->pcRootDir = xProperties.pcRootDir;\r
- }\r
- pxClient->bits.bReadOnly = ( xProperties.xReadOnly != pdFALSE_UNSIGNED );\r
- }\r
- #endif /* ipconfigFTP_HAS_USER_PROPERTIES_HOOK */\r
- break;\r
-\r
- case ECMD_PASS: /* Password. */\r
- pxClient->ulRestartOffset = 0;\r
- if( pxClient->bits.bStatusUser == pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_503; /* "503 Bad sequence of commands.\r\n". */\r
- }\r
- else\r
- {\r
- BaseType_t xAllow;\r
-\r
- pxClient->bits.bStatusUser = pdFALSE_UNSIGNED;\r
- #if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )\r
- {\r
- xAllow = xApplicationFTPPasswordHook( pxClient->pcFileName, pcRestCommand );\r
- }\r
- #else\r
- {\r
- xAllow = 1;\r
- }\r
- #endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
-\r
- if( xAllow > 0 )\r
- {\r
- pxClient->bits.bLoggedIn = pdTRUE_UNSIGNED; /* Client has now logged in. */\r
- pcMyReply = "230 OK. Current directory is /\r\n";\r
- }\r
- else\r
- {\r
- pcMyReply = "530 Login incorrect\r\n"; /* 530 Login incorrect. */\r
- }\r
-\r
- strcpy( pxClient->pcCurrentDir, ( const char * ) "/" );\r
- }\r
- break;\r
-\r
- case ECMD_SYST: /* System. */\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "215 UNIX Type: L8\r\n" );\r
- pcMyReply = pcCOMMAND_BUFFER;\r
- break;\r
-\r
- case ECMD_PWD: /* Get working directory. */\r
- xMakeRelative( pxClient, pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), pxClient->pcCurrentDir );\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), REPL_257_PWD, pcFILE_BUFFER );\r
- pcMyReply = pcCOMMAND_BUFFER;\r
- break;\r
-\r
- case ECMD_REST:\r
- if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_553_READ_ONLY;\r
- }\r
- else\r
- {\r
- const char *pcPtr = pcRestCommand;\r
-\r
- while( *pcPtr == ' ' )\r
- {\r
- pcPtr++;\r
- }\r
-\r
- if( ( *pcPtr >= '0' ) && ( *pcPtr <= '9' ) )\r
- {\r
- sscanf( pcPtr, "%lu", &pxClient->ulRestartOffset );\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "350 Restarting at %lu. Send STORE or RETRIEVE\r\n", pxClient->ulRestartOffset );\r
- pcMyReply = pcCOMMAND_BUFFER;\r
- }\r
- else\r
- {\r
- pcMyReply = REPL_500; /* 500 Syntax error, command unrecognised. */\r
- }\r
- }\r
- break;\r
-\r
- case ECMD_NOOP: /* NOP operation */\r
- if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
- {\r
- pcMyReply = REPL_200_PROGRESS;\r
- }\r
- else\r
- {\r
- pcMyReply = REPL_200;\r
- }\r
- break;\r
-\r
- case ECMD_TYPE: /* Ask or set transfer type. */\r
- {\r
- /* e.g. "TYPE I" for Images (binary). */\r
- BaseType_t xType = prvGetTransferType( pcRestCommand );\r
-\r
- if( xType < 0 )\r
- {\r
- /* TYPE not recognised. */\r
- pcMyReply = REPL_500;\r
- }\r
- else\r
- {\r
- pxClient->xTransType = xType;\r
- pcMyReply = REPL_200;\r
- }\r
- }\r
- break;\r
-\r
- case ECMD_PASV: /* Enter passive mode. */\r
- /* Connect passive: Server will listen() and wait for a connection.\r
- Start up a new data connection with 'xDoListen' set to true. */\r
- if( prvTransferConnect( pxClient, pdTRUE ) == pdFALSE )\r
- {\r
- pcMyReply = REPL_502;\r
- }\r
- else\r
- {\r
- uint32_t ulIP;\r
- uint16_t ulPort;\r
- struct freertos_sockaddr xLocalAddress;\r
- struct freertos_sockaddr xRemoteAddress;\r
-\r
- FreeRTOS_GetLocalAddress( pxClient->xTransferSocket, &xLocalAddress );\r
- FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );\r
-\r
- ulIP = FreeRTOS_ntohl( xLocalAddress.sin_addr );\r
- pxClient->ulClientIP = FreeRTOS_ntohl( xRemoteAddress.sin_addr );\r
- ulPort = FreeRTOS_ntohs( xLocalAddress.sin_port );\r
-\r
- pxClient->usClientPort = FreeRTOS_ntohs( xRemoteAddress.sin_port );\r
-\r
- /* REPL_227_D "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d). */\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), REPL_227_D,\r
- ( unsigned )ulIP >> 24,\r
- ( unsigned )( ulIP >> 16 ) & 0xFF,\r
- ( unsigned )( ulIP >> 8 ) & 0xFF,\r
- ( unsigned )ulIP & 0xFF,\r
- ( unsigned )ulPort >> 8,\r
- ( unsigned )ulPort & 0xFF );\r
-\r
- pcMyReply = pcCOMMAND_BUFFER;\r
- }\r
- break;\r
-\r
- case ECMD_PORT: /* Active connection to the client. */\r
- /* The client uses this command to tell the server to what\r
- client-side port the server should contact; use of this command\r
- indicates an active data transfer. e.g. PORT 192,168,1,2,4,19. */\r
- {\r
- uint32_t ulIPAddress = 0;\r
- UBaseType_t uxPort;\r
-\r
- uxPort = prvParsePortData( pcRestCommand, &ulIPAddress );\r
- FreeRTOS_printf( (" PORT %lxip:%ld\n", ulIPAddress, uxPort ) );\r
-\r
- if( uxPort == 0u )\r
- {\r
- pcMyReply = REPL_501;\r
- }\r
- else if( prvTransferConnect( pxClient, pdFALSE ) == pdFALSE )\r
- {\r
- /* Call prvTransferConnect() with 'xDoListen' = false for an\r
- active connect(). */\r
- pcMyReply = REPL_501;\r
- }\r
- else\r
- {\r
- pxClient->usClientPort = ( uint16_t ) uxPort;\r
- pxClient->ulClientIP = ulIPAddress;\r
- FreeRTOS_printf( ("Client address %lxip:%lu\n", ulIPAddress, uxPort ) );\r
- pcMyReply = REPL_200;\r
- }\r
- }\r
- break;\r
-\r
- case ECMD_CWD: /* Change current working directory. */\r
- prvChangeDir( pxClient, pcRestCommand );\r
- break;\r
-\r
- case ECMD_RNFR:\r
- if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_553_READ_ONLY;\r
- }\r
- else\r
- {\r
- prvRenameFrom( pxClient, pcRestCommand );\r
- }\r
- break;\r
-\r
- case ECMD_RNTO:\r
- if( pxClient->bits.bInRename == pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_503; /* "503 Bad sequence of commands. */\r
- }\r
- else\r
- {\r
- prvRenameTo( pxClient, pcRestCommand );\r
- }\r
- break;\r
-\r
- case ECMD_SITE: /* Set file permissions */\r
- if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_553_READ_ONLY;\r
- }\r
- else if( prvSiteCmd( pxClient, pcRestCommand ) == pdFALSE )\r
- {\r
- pcMyReply = REPL_202;\r
- }\r
- break;\r
-\r
- case ECMD_DELE:\r
- if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_553_READ_ONLY;\r
- }\r
- else\r
- {\r
- prvDeleteFile( pxClient, pcRestCommand );\r
- }\r
- break;\r
-\r
- case ECMD_MDTM:\r
- prvSizeDateFile( pxClient, pcRestCommand, pdTRUE );\r
- break;\r
-\r
- case ECMD_SIZE:\r
- if( pxClient->pxWriteHandle != NULL )\r
- {\r
- /* This SIZE query is probably about a file which is now being\r
- received. If so, return the value of pxClient->ulRecvBytes,\r
- pcRestCommand points to 'pcCommandBuffer', make it free by\r
- copying it to pcNewDir. */\r
-\r
- xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pcRestCommand );\r
-\r
- if( strcmp( pcNEW_DIR, pcRestCommand ) == 0 )\r
- {\r
- BaseType_t xCount;\r
- for( xCount = 0; xCount < 3 && pxClient->pxWriteHandle; xCount++ )\r
- {\r
- prvStoreFileWork( pxClient );\r
- }\r
- if( pxClient->pxWriteHandle != NULL )\r
- {\r
- /* File being queried is still open, return number of\r
- bytes received until now. */\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 %lu\r\n", pxClient->ulRecvBytes );\r
- pcMyReply = pcCOMMAND_BUFFER;\r
- } /* otherwise, do a normal stat(). */\r
- }\r
- strcpy( pcRestCommand, pcNEW_DIR );\r
- }\r
- if( pcMyReply == NULL )\r
- {\r
- prvSizeDateFile( pxClient, pcRestCommand, pdFALSE );\r
- }\r
- break;\r
- case ECMD_MKD:\r
- case ECMD_RMD:\r
- if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_553_READ_ONLY;\r
- }\r
- else\r
- {\r
- prvMakeRemoveDir( pxClient, pcRestCommand, pxFTPCommand->ucCommandType == ECMD_RMD );\r
- }\r
- break;\r
- case ECMD_CDUP:\r
- prvChangeDir( pxClient, ".." );\r
- break;\r
-\r
- case ECMD_QUIT:\r
- prvSendReply( pxClient->xSocket, REPL_221, 0 );\r
- pxClient->bits.bLoggedIn = pdFALSE_UNSIGNED;\r
- break;\r
- case ECMD_LIST:\r
- case ECMD_RETR:\r
- case ECMD_STOR:\r
- if( ( pxClient->xTransferSocket == FREERTOS_NO_SOCKET ) &&\r
- ( ( pxFTPCommand->ucCommandType != ECMD_STOR ) ||\r
- ( pxClient->bits1.bEmptyFile == pdFALSE_UNSIGNED ) ) )\r
- {\r
- /* Sending "425 Can't open data connection." :\r
- Before receiving any of these commands, there must have been a\r
- PORT or PASV command, which causes the creation of a data socket. */\r
- /* There is one exception: a STOR command is received while the\r
- data connection has already been closed. This is tested with the\r
- 'bEmptyFile' flag. */\r
- pcMyReply = REPL_425;\r
- }\r
- else\r
- {\r
- /* In case an empty file was received ( bits1.bEmptyFile ), the\r
- transfer socket never delivered any data. Check if the transfer\r
- socket is still open: */\r
- if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
- {\r
- prvTransferCheck( pxClient );\r
- }\r
- switch( pxFTPCommand->ucCommandType )\r
- {\r
- case ECMD_LIST:\r
- prvListSendPrep( pxClient );\r
- break;\r
- case ECMD_RETR:\r
- prvRetrieveFilePrep( pxClient, pcRestCommand );\r
- break;\r
- case ECMD_STOR:\r
- if( pxClient->bits.bReadOnly != pdFALSE_UNSIGNED )\r
- {\r
- pcMyReply = REPL_553_READ_ONLY;\r
- }\r
- else\r
- {\r
- prvStoreFilePrep( pxClient, pcRestCommand );\r
- if( pxClient->bits1.bEmptyFile != pdFALSE_UNSIGNED )\r
- {\r
- /* Although the 'xTransferSocket' is closed already,\r
- call this function just for the logging. */\r
- prvTransferCloseSocket( pxClient );\r
-\r
- /* Close an empty file. */\r
- prvTransferCloseFile( pxClient );\r
- }\r
- }\r
- break;\r
- }\r
- }\r
- break;\r
-\r
- case ECMD_FEAT:\r
- {\r
- static const char pcFeatAnswer[] =\r
- "211-Features:\x0a"\r
- /* The MDTM command is only allowed when\r
- there is support for date&time. */\r
- #if( ffconfigTIME_SUPPORT != 0 )\r
- " MDTM\x0a"\r
- #endif\r
- " REST STREAM\x0a"\r
- " SIZE\x0d\x0a"\r
- "211 End\x0d\x0a";\r
- pcMyReply = pcFeatAnswer;\r
- }\r
- break;\r
-\r
- case ECMD_UNKNOWN:\r
- FreeRTOS_printf( ("ftp::processCmd: Cmd %s unknown\n", pcRestCommand ) );\r
- pcMyReply = REPL_500;\r
- break;\r
- }\r
- }\r
- if( pxFTPCommand->ucCommandType != ECMD_RNFR )\r
- {\r
- pxClient->bits.bInRename = pdFALSE_UNSIGNED;\r
- }\r
-\r
- if( pcMyReply != NULL )\r
- {\r
- xResult = prvSendReply( pxClient->xSocket, pcMyReply, strlen( pcMyReply ) );\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvTransferConnect( FTPClient_t *pxClient, BaseType_t xDoListen )\r
-{\r
-Socket_t xSocket;\r
-BaseType_t xResult;\r
-\r
- /* Open a socket for a data connection with the FTP client.\r
- Happens after a PORT or a PASV command. */\r
-\r
- /* Make sure the previous socket is deleted and flags reset */\r
- prvTransferCloseSocket( pxClient );\r
-\r
- pxClient->bits1.bEmptyFile = pdFALSE_UNSIGNED;\r
-\r
- xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );\r
-\r
- if( ( xSocket != FREERTOS_NO_SOCKET ) && ( xSocket != FREERTOS_INVALID_SOCKET ) )\r
- {\r
- BaseType_t xSmallTimeout = pdMS_TO_TICKS( 100 );\r
- struct freertos_sockaddr xAddress;\r
-\r
- #if( ipconfigFTP_TX_BUFSIZE > 0 )\r
- WinProperties_t xWinProps;\r
- #endif\r
- xAddress.sin_addr = FreeRTOS_GetIPAddress( ); /* Single NIC, currently not used */\r
- xAddress.sin_port = FreeRTOS_htons( 0 ); /* Bind to any available port number */\r
-\r
- FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );\r
-\r
- #if( ipconfigFTP_TX_BUFSIZE > 0 )\r
- {\r
- /* Fill in the buffer and window sizes that will be used by the\r
- socket. */\r
- xWinProps.lTxBufSize = ipconfigFTP_TX_BUFSIZE;\r
- xWinProps.lTxWinSize = ipconfigFTP_TX_WINSIZE;\r
- xWinProps.lRxBufSize = ipconfigFTP_RX_BUFSIZE;\r
- xWinProps.lRxWinSize = ipconfigFTP_RX_WINSIZE;\r
-\r
- /* Set the window and buffer sizes. */\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );\r
- }\r
- #endif\r
-\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xSmallTimeout, sizeof( BaseType_t ) );\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xSmallTimeout, sizeof( BaseType_t ) );\r
-\r
- /* The same instance of the socket will be used for the connection and\r
- data transport. */\r
- if( xDoListen != pdFALSE )\r
- {\r
- BaseType_t xTrueValue = pdTRUE;\r
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_REUSE_LISTEN_SOCKET, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
- }\r
- pxClient->bits1.bIsListen = xDoListen;\r
- pxClient->xTransferSocket = xSocket;\r
-\r
- if( xDoListen != pdFALSE )\r
- {\r
- FreeRTOS_FD_SET( xSocket, pxClient->pxParent->xSocketSet, eSELECT_EXCEPT | eSELECT_READ );\r
- /* Calling FreeRTOS_listen( ) */\r
- xResult = prvTransferStart( pxClient );\r
- if( xResult >= 0 )\r
- {\r
- xResult = pdTRUE;\r
- }\r
- }\r
- else\r
- {\r
- FreeRTOS_FD_SET( xSocket, pxClient->pxParent->xSocketSet, eSELECT_EXCEPT | eSELECT_READ | eSELECT_WRITE );\r
- xResult = pdTRUE;\r
- }\r
- }\r
- else\r
- {\r
- FreeRTOS_printf( ( "FreeRTOS_socket() failed\n" ) );\r
- xResult = -pdFREERTOS_ERRNO_ENOMEM;\r
- }\r
-\r
- /* An active socket (PORT) should connect() later. */\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvTransferStart( FTPClient_t *pxClient )\r
-{\r
-BaseType_t xResult;\r
-\r
- /* A transfer socket has been opened, now either call listen() for 'PASV'\r
- or connect() for the 'PORT' command. */\r
- if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
- {\r
- xResult = FreeRTOS_listen( pxClient->xTransferSocket, 1 );\r
- }\r
- else\r
- {\r
- struct freertos_sockaddr xAddress;\r
-\r
- xAddress.sin_addr = FreeRTOS_htonl( pxClient->ulClientIP );\r
- xAddress.sin_port = FreeRTOS_htons( pxClient->usClientPort );\r
- /* Start an active connection for this data socket */\r
- xResult = FreeRTOS_connect( pxClient->xTransferSocket, &xAddress, sizeof( xAddress ) );\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvTransferCheck( FTPClient_t *pxClient )\r
-{\r
-BaseType_t xRxSize;\r
-\r
- /* A data transfer is busy. Check if there are changes in connectedness. */\r
- xRxSize = FreeRTOS_rx_size( pxClient->xTransferSocket );\r
-\r
- if( pxClient->bits1.bClientConnected == pdFALSE_UNSIGNED )\r
- {\r
- /* The time to receive a small file can be so short, that we don't even\r
- see that the socket gets connected and disconnected. Therefore, check\r
- the sizeof of the RX buffer. */\r
- {\r
- struct freertos_sockaddr xAddress;\r
- Socket_t xNexSocket;\r
- socklen_t xSocketLength = sizeof( xAddress );\r
-\r
- if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
- {\r
- xNexSocket = FreeRTOS_accept( pxClient->xTransferSocket, &xAddress, &xSocketLength);\r
- if( ( ( xNexSocket != FREERTOS_NO_SOCKET ) && ( xNexSocket != FREERTOS_INVALID_SOCKET ) ) ||\r
- xRxSize > 0 )\r
- {\r
- pxClient->bits1.bClientConnected = pdTRUE_UNSIGNED;\r
- }\r
- }\r
- else\r
- {\r
- if( FreeRTOS_issocketconnected( pxClient->xTransferSocket ) > 0 ||\r
- xRxSize > 0 )\r
- {\r
- pxClient->bits1.bClientConnected = pdTRUE_UNSIGNED;\r
- }\r
- }\r
- if( pxClient->bits1.bClientConnected != pdFALSE_UNSIGNED )\r
- {\r
- pxClient->bits1.bEmptyFile = pdFALSE_UNSIGNED;\r
- #if( ipconfigHAS_PRINTF != 0 )\r
- {\r
- struct freertos_sockaddr xRemoteAddress, xLocalAddress;\r
- FreeRTOS_GetRemoteAddress( pxClient->xTransferSocket, &xRemoteAddress );\r
- FreeRTOS_GetLocalAddress( pxClient->xTransferSocket, &xLocalAddress );\r
- FreeRTOS_printf( ( "%s Connected from %u to %u\n",\r
- pxClient->bits1.bIsListen != pdFALSE_UNSIGNED ? "PASV" : "PORT",\r
- ( unsigned ) FreeRTOS_ntohs( xLocalAddress.sin_port ),\r
- ( unsigned ) FreeRTOS_ntohs( xRemoteAddress.sin_port ) ) );\r
- }\r
- #endif /* ipconfigHAS_PRINTF */\r
- FreeRTOS_FD_CLR( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
- FreeRTOS_FD_SET( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_READ|eSELECT_EXCEPT );\r
- }\r
- }\r
- }\r
-\r
- if ( pxClient->bits1.bClientConnected != pdFALSE_UNSIGNED )\r
- {\r
- if( pxClient->pcConnectionAck[ 0 ] != '\0' )\r
- {\r
- BaseType_t xLength;\r
- BaseType_t xRemotePort;\r
- struct freertos_sockaddr xRemoteAddress;\r
-\r
- FreeRTOS_GetRemoteAddress( pxClient->xTransferSocket, &xRemoteAddress );\r
- xRemotePort = FreeRTOS_ntohs( xRemoteAddress.sin_port );\r
-\r
- /* Tell on the command port 21 we have a data connection */\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- pxClient->pcConnectionAck, pxClient->ulClientIP, xRemotePort );\r
-\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- pxClient->pcConnectionAck[ 0 ] = '\0';\r
- }\r
-\r
- if( ( FreeRTOS_issocketconnected( pxClient->xTransferSocket ) == pdFALSE ) && FreeRTOS_rx_size( pxClient->xTransferSocket ) == 0 )\r
- {\r
- prvTransferCloseSocket( pxClient );\r
- prvTransferCloseFile( pxClient );\r
- }\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvTransferCloseSocket( FTPClient_t *pxClient )\r
-{\r
- if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
- {\r
- /* DEBUGGING ONLY */\r
- BaseType_t xRxSize = FreeRTOS_rx_size( pxClient->xTransferSocket );\r
- if( xRxSize > 0 )\r
- {\r
- BaseType_t xRxSize2;\r
- BaseType_t xStatus;\r
- prvStoreFileWork( pxClient );\r
- xStatus = FreeRTOS_connstatus( pxClient->xTransferSocket );\r
- xRxSize2 = FreeRTOS_rx_size( pxClient->xTransferSocket );\r
- FreeRTOS_printf( ( "FTP: WARNING: %s: RX size = %ld -> %ld (%s)\n",\r
- FreeRTOS_GetTCPStateName( xStatus ),\r
- xRxSize, xRxSize2, pxClient->pcFileName ) );\r
- if( xRxSize2 > 1 )\r
- {\r
- return;\r
- }\r
-\r
- /* Remove compiler warnings in case FreeRTOS_printf() is not\r
- defined. */\r
- ( void ) xStatus;\r
- }\r
- }\r
-\r
- if( ( pxClient->pxWriteHandle != NULL ) || ( pxClient->pxReadHandle != NULL ) )\r
- {\r
- BaseType_t xLength;\r
- char pcStrBuf[ 32 ];\r
-\r
- if( pxClient->bits1.bHadError == pdFALSE_UNSIGNED )\r
- {\r
- xLength = snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ),\r
- "226 Closing connection %d bytes transmitted\r\n", ( int ) pxClient->ulRecvBytes );\r
- }\r
- else\r
- {\r
- xLength = snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ),\r
- "451 Requested action aborted after %d bytes\r\n", ( int ) pxClient->ulRecvBytes );\r
- }\r
-\r
- /* Tell on the command socket the data connection is now closed. */\r
- prvSendReply( pxClient->xSocket, pxClient->pcClientAck, xLength );\r
-\r
- #if( ipconfigHAS_PRINTF != 0 )\r
- {\r
- TickType_t xDelta;\r
- uint32_t ulAverage;\r
- xDelta = xTaskGetTickCount( ) - pxClient->xStartTime;\r
- ulAverage = ulGetAverage( pxClient->ulRecvBytes, xDelta );\r
-\r
- FreeRTOS_printf( ("FTP: %s: '%s' %lu Bytes (%s/sec)\n",\r
- pxClient->pxReadHandle ? "sent" : "recv",\r
- pxClient->pcFileName,\r
- pxClient->ulRecvBytes,\r
- pcMkSize( ulAverage, pcStrBuf, sizeof( pcStrBuf ) ) ) );\r
- }\r
- #endif\r
- }\r
-\r
- if( pxClient->xTransferSocket != FREERTOS_NO_SOCKET )\r
- {\r
- FreeRTOS_FD_CLR( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_ALL );\r
- FreeRTOS_closesocket( pxClient->xTransferSocket );\r
- pxClient->xTransferSocket = FREERTOS_NO_SOCKET;\r
- if( pxClient->ulRecvBytes == 0ul )\r
- {\r
- /* Received zero bytes: an empty file */\r
- pxClient->bits1.bEmptyFile = pdTRUE_UNSIGNED;\r
- }\r
- else\r
- {\r
- pxClient->bits1.bEmptyFile = pdFALSE_UNSIGNED;\r
- }\r
- }\r
- pxClient->bits1.bIsListen = pdFALSE_UNSIGNED;\r
- pxClient->bits1.bDirHasEntry = pdFALSE_UNSIGNED;\r
- pxClient->bits1.bClientConnected = pdFALSE_UNSIGNED;\r
- pxClient->bits1.bHadError = pdFALSE_UNSIGNED;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvTransferCloseFile( FTPClient_t *pxClient )\r
-{\r
- if( pxClient->pxWriteHandle != NULL )\r
- {\r
- ff_fclose( pxClient->pxWriteHandle );\r
- pxClient->pxWriteHandle = NULL;\r
- #if( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )\r
- {\r
- vApplicationFTPReceivedHook( pxClient->pcFileName, pxClient->ulRecvBytes, pxClient );\r
- }\r
- #endif\r
-\r
- }\r
- if( pxClient->pxReadHandle != NULL )\r
- {\r
- ff_fclose( pxClient->pxReadHandle );\r
- pxClient->pxReadHandle = NULL;\r
- }\r
- /* These two field are only used for logging / file-statistics */\r
- pxClient->ulRecvBytes = 0ul;\r
- pxClient->xStartTime = 0ul;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/**\r
- * Guess the transfer type, given the client requested type.\r
- * Actually in unix there is no difference between binary and\r
- * ascii mode when we work with file descriptors.\r
- * If #type is not recognized as a valid client request, -1 is returned.\r
- */\r
-static BaseType_t prvGetTransferType( const char *pcType )\r
-{\r
-BaseType_t xResult = -1;\r
-\r
- if( pcType != NULL )\r
- {\r
- BaseType_t xLength = strlen( pcType );\r
- if( xLength == 0 )\r
- {\r
- return -1;\r
- }\r
- switch( pcType[ 0 ] ) {\r
- case 'I':\r
- xResult = TMODE_BINARY;\r
- break;\r
- case 'A':\r
- xResult = TMODE_ASCII;\r
- break;\r
- case 'L':\r
- if( xLength >= 3 )\r
- {\r
- if( pcType[ 2 ] == '7' )\r
- {\r
- xResult = TMODE_7BITS;\r
- }\r
- else if( pcType[ 2 ] == '8' )\r
- {\r
- xResult = TMODE_7BITS;\r
- }\r
- }\r
- break;\r
- }\r
- }\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ipconfigHAS_PRINTF != 0 )\r
- #define SIZE_1_GB ( 1024ul * 1024ul * 1024ul )\r
- #define SIZE_1_MB ( 1024ul * 1024ul )\r
- #define SIZE_1_KB ( 1024ul )\r
-\r
- static const char *pcMkSize( uint32_t ulAmount, char *pcBuffer, BaseType_t xBufferSize )\r
- {\r
- uint32_t ulGB, ulMB, ulKB, ulByte;\r
-\r
- ulGB = ( ulAmount / SIZE_1_GB );\r
- ulAmount -= ( ulGB * SIZE_1_GB );\r
- ulMB = ( ulAmount / SIZE_1_MB );\r
- ulAmount -= ( ulMB * SIZE_1_MB );\r
- ulKB = ( ulAmount / SIZE_1_KB );\r
- ulAmount -= ( ulKB * SIZE_1_KB );\r
- ulByte = ( ulAmount );\r
-\r
- if (ulGB != 0ul )\r
- {\r
- snprintf( pcBuffer, xBufferSize, "%lu.%02lu GB", ulGB, (100 * ulMB) / SIZE_1_KB );\r
- }\r
- else if( ulMB != 0ul )\r
- {\r
- snprintf( pcBuffer, xBufferSize, "%lu.%02lu MB", ulMB, (100 * ulKB) / SIZE_1_KB );\r
- }\r
- else if( ulKB != 0ul )\r
- {\r
- snprintf(pcBuffer, xBufferSize, "%lu.%02lu KB", ulKB, (100 * ulByte) / SIZE_1_KB );\r
- }\r
- else\r
- {\r
- snprintf( pcBuffer, xBufferSize, "%lu bytes", ulByte );\r
- }\r
-\r
- return pcBuffer;\r
- }\r
- /*-----------------------------------------------------------*/\r
-#endif /* ipconfigHAS_PRINTF != 0 */\r
-\r
-#if( ipconfigHAS_PRINTF != 0 )\r
- static uint32_t ulGetAverage( uint32_t ulAmount, TickType_t xDeltaMs )\r
- {\r
- uint32_t ulAverage;\r
-\r
- /* Get the average amount of bytes per seconds. Ideally this is\r
- calculated by Multiplying with 1000 and dividing by milliseconds:\r
- ulAverage = ( 1000ul * ulAmount ) / xDeltaMs;\r
- Now get a maximum precision, while avoiding an arithmetic overflow:\r
- */\r
- if( xDeltaMs == 0ul )\r
- {\r
- /* Time is zero, there is no average */\r
- ulAverage = 0ul;\r
- }\r
- else if( ulAmount >= ( ~0ul / 10ul ) )\r
- {\r
- /* More than 409 MB has been transferred, do not multiply. */\r
- ulAverage = ( ulAmount / ( xDeltaMs / 1000ul ) );\r
- }\r
- else if( ulAmount >= ( ~0ul / 100ul ) )\r
- {\r
- /* Between 409 and 41 MB has been transferred, can multiply by 10. */\r
- ulAverage = ( ( ulAmount * 10ul ) / ( xDeltaMs / 100ul ) );\r
- }\r
- else if( ulAmount >= ( ~0ul / 1000ul ) )\r
- {\r
- /* Between 4.1 MB and 41 has been transferred, can multiply by 100. */\r
- ulAverage = ( ( ulAmount * 100ul ) / ( xDeltaMs / 10ul ) );\r
- }\r
- else\r
- {\r
- /* Less than 4.1 MB: can multiply by 1000. */\r
- ulAverage = ( ( ulAmount * 1000ul ) / xDeltaMs );\r
- }\r
-\r
- return ulAverage;\r
- }\r
- /*-----------------------------------------------------------*/\r
-#endif /* ipconfigHAS_PRINTF != 0 */\r
-\r
-static UBaseType_t prvParsePortData( const char *pcCommand, uint32_t *pulIPAddress )\r
-{\r
-/*_HT_ Using 'unsigned' here because when sscanf() sees '%u', it expects a pointer to 'unsigned'.\r
-Not sure about the sscanf() format for UBaseType_t ? */\r
-unsigned h1, h2, h3, h4, p1, p2;\r
-char sep;\r
-UBaseType_t uxResult;\r
-\r
- /* Expect PORT h1,h2,h3,h4,p1,p2 */\r
- if (sscanf (pcCommand, "%u%c%u%c%u%c%u%c%u%c%u", &h1, &sep, &h2, &sep, &h3, &sep, &h4, &sep, &p1, &sep, &p2) != 11)\r
- {\r
- uxResult= 0u;\r
- }\r
- else\r
- {\r
- /* Put in network byte order. */\r
- *pulIPAddress =\r
- ( ( uint32_t ) h1 << 24 ) |\r
- ( ( uint32_t ) h2 << 16 ) |\r
- ( ( uint32_t ) h3 << 8 ) |\r
- ( ( uint32_t ) h4 );\r
- uxResult = ( p1 << 8 ) | p2;\r
- }\r
- return uxResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-\r
- #### ####### # ###\r
-# # # # ## # #\r
-# # # # # #\r
-# ###### #### ### ## #### # # ### # ####\r
- ## # # # # # # # # ##### # # # #\r
- ## # # # ## # ###### # # # # ######\r
-# # # # # # # # # # #\r
-# # # ## # # # # ## # # # # ##\r
- #### ## #### #### #### #### ##### ##### ####\r
-\r
-*/\r
-\r
-static BaseType_t prvStoreFilePrep( FTPClient_t *pxClient, char *pcFileName )\r
-{\r
-BaseType_t xResult;\r
-FF_FILE *pxNewHandle;\r
-size_t uxFileSize = 0ul;\r
-int iErrorNo;\r
-\r
- /* Close previous handle (if any) and reset file transfer parameters. */\r
- prvTransferCloseFile( pxClient );\r
-\r
- xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
-\r
- pxNewHandle = NULL;\r
-\r
- if( pxClient->ulRestartOffset != 0 )\r
- {\r
- size_t uxOffset = pxClient->ulRestartOffset;\r
- int32_t lRc;\r
-\r
- pxClient->ulRestartOffset = 0ul; /* Only use 1 time. */\r
- pxNewHandle = ff_fopen( pxClient->pcFileName, "ab" );\r
-\r
- if( pxNewHandle != NULL )\r
- {\r
- uxFileSize = pxNewHandle->ulFileSize;\r
-\r
- if( uxOffset <= uxFileSize )\r
- {\r
- lRc = ff_fseek( pxNewHandle, uxOffset, FF_SEEK_SET );\r
- }\r
- else\r
- {\r
- /* Won't even try to seek after EOF */\r
- lRc = -pdFREERTOS_ERRNO_EINVAL;\r
- }\r
- if( lRc != 0 )\r
- {\r
- BaseType_t xLength;\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "450 Seek invalid %u length %u\r\n",\r
- ( unsigned ) uxOffset, ( unsigned ) uxFileSize );\r
-\r
- /* "Requested file action not taken". */\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
-\r
- FreeRTOS_printf( ( "ftp::storeFile: create %s: Seek %u length %u\n",\r
- pxClient->pcFileName, ( unsigned ) uxOffset, ( unsigned ) uxFileSize ) );\r
-\r
- ff_fclose( pxNewHandle );\r
- pxNewHandle = NULL;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- pxNewHandle = ff_fopen( pxClient->pcFileName, "wb" );\r
- }\r
-\r
- if( pxNewHandle == NULL )\r
- {\r
- iErrorNo = stdioGET_ERRNO();\r
- if( iErrorNo == pdFREERTOS_ERRNO_ENOSPC )\r
- {\r
- prvSendReply( pxClient->xSocket, REPL_552, 0 );\r
- }\r
- else\r
- {\r
- /* "Requested file action not taken". */\r
- prvSendReply( pxClient->xSocket, REPL_450, 0 );\r
- }\r
- FreeRTOS_printf( ( "ftp::storeFile: create %s: %s (errno %d)\n",\r
- pxClient->pcFileName,\r
- ( const char* ) strerror( iErrorNo ), iErrorNo ) );\r
-\r
- xResult = pdFALSE;\r
- }\r
- else\r
- {\r
- if( pxClient->bits1.bIsListen )\r
- {\r
- /* True if PASV is used. */\r
- snprintf( pxClient->pcConnectionAck, sizeof( pxClient->pcConnectionAck ),\r
- "150 Accepted data connection from %%xip:%%u\r\n" );\r
- prvTransferCheck( pxClient );\r
- }\r
- else\r
- {\r
- BaseType_t xLength;\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "150 Opening BIN connection to store file\r\n" );\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- pxClient->pcConnectionAck[ 0 ] = '\0';\r
- prvTransferStart( pxClient ); /* Now active connect. */\r
- }\r
-\r
- pxClient->pxWriteHandle = pxNewHandle;\r
-\r
- /* To get some statistics about the performance. */\r
- pxClient->xStartTime = xTaskGetTickCount( );\r
-\r
- xResult = pdTRUE;\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ipconfigFTP_ZERO_COPY_ALIGNED_WRITES == 0 )\r
-\r
- static BaseType_t prvStoreFileWork( FTPClient_t *pxClient )\r
- {\r
- BaseType_t xRc, xWritten;\r
-\r
- /* Read from the data socket until all has been read or until a negative value\r
- is returned. */\r
- for( ; ; )\r
- {\r
- char *pcBuffer;\r
-\r
- /* The "zero-copy" method: */\r
- xRc = FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) &pcBuffer,\r
- 0x20000u, FREERTOS_ZERO_COPY | FREERTOS_MSG_DONTWAIT );\r
- if( xRc <= 0 )\r
- {\r
- break;\r
- }\r
- pxClient->ulRecvBytes += xRc;\r
- xWritten = ff_fwrite( pcBuffer, 1, xRc, pxClient->pxWriteHandle );\r
- FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) NULL, xRc, 0 );\r
- if( xWritten != xRc )\r
- {\r
- xRc = -1;\r
- /* bHadError: a transfer got aborted because of an error. */\r
- pxClient->bits1.bHadError = pdTRUE_UNSIGNED;\r
- break;\r
- }\r
- }\r
- return xRc;\r
- }\r
-\r
-#else /* ipconfigFTP_ZERO_COPY_ALIGNED_WRITES != 0 */\r
-\r
- #if !defined( ipconfigFTP_PREFERRED_WRITE_SIZE )\r
- /* If you store data on flash, it may be profitable to give 'ipconfigFTP_PREFERRED_WRITE_SIZE'\r
- the same size as the size of the flash' erase blocks, e.g. 4KB */\r
- #define ipconfigFTP_PREFERRED_WRITE_SIZE 512ul\r
- #endif\r
-\r
- static BaseType_t prvStoreFileWork( FTPClient_t *pxClient )\r
- {\r
- BaseType_t xRc, xWritten;\r
-\r
- /* Read from the data socket until all has been read or until a negative\r
- value is returned. */\r
- for( ; ; )\r
- {\r
- char *pcBuffer;\r
- UBaseType_t xStatus;\r
-\r
- /* The "zero-copy" method: */\r
- xRc = FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) &pcBuffer,\r
- 0x20000u, FREERTOS_ZERO_COPY | FREERTOS_MSG_DONTWAIT );\r
-\r
- if( xRc <= 0 )\r
- {\r
- /* There are no data or the connection is closed. */\r
- break;\r
- }\r
- xStatus = FreeRTOS_connstatus( pxClient->xTransferSocket );\r
- if( xStatus != eESTABLISHED )\r
- {\r
- /* The connection is not established (any more), therefore\r
- accept any amount of bytes, probably the last few bytes. */\r
- }\r
- else\r
- {\r
- if( xRc >= ipconfigFTP_PREFERRED_WRITE_SIZE )\r
- {\r
- /* More than a sector to write, round down to a multiple of\r
- PREFERRED_WRITE_SIZE bytes. */\r
- xRc = ( xRc / ipconfigFTP_PREFERRED_WRITE_SIZE ) * ipconfigFTP_PREFERRED_WRITE_SIZE;\r
- }\r
- else\r
- {\r
- const StreamBuffer_t *pxBuffer = FreeRTOS_get_rx_buf( pxClient->xTransferSocket );\r
- size_t uxSpace = pxBuffer->LENGTH - pxBuffer->uxTail;\r
-\r
- if( uxSpace >= ipconfigFTP_PREFERRED_WRITE_SIZE )\r
- {\r
- /* At this moment there are les than PREFERRED_WRITE_SIZE bytes in the RX\r
- buffer, but there is space for more. Just return and\r
- wait for more. */\r
- xRc = 0;\r
- }\r
- else\r
- {\r
- /* Now reading beyond the end of the circular buffer,\r
- use a normal read. */\r
- pcBuffer = pcFILE_BUFFER;\r
- xRc = FreeRTOS_recvcount( pxClient->xTransferSocket );\r
- xRc = ( xRc / ipconfigFTP_PREFERRED_WRITE_SIZE ) * ipconfigFTP_PREFERRED_WRITE_SIZE;\r
- if( xRc > 0 )\r
- {\r
- xRc = FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) pcBuffer,\r
- sizeof( pcFILE_BUFFER ), FREERTOS_MSG_DONTWAIT );\r
- }\r
- }\r
- }\r
- }\r
- if( xRc == 0 )\r
- {\r
- break;\r
- }\r
- pxClient->ulRecvBytes += xRc;\r
-\r
- xWritten = ff_fwrite( pcBuffer, 1, xRc, pxClient->pxWriteHandle );\r
- if( pcBuffer != pcFILE_BUFFER )\r
- {\r
- FreeRTOS_recv( pxClient->xTransferSocket, ( void * ) NULL, xRc, 0 );\r
- }\r
- if( xWritten != xRc )\r
- {\r
- xRc = -1;\r
- /* bHadError: a transfer got aborted because of an error. */\r
- pxClient->bits1.bHadError = pdTRUE_UNSIGNED;\r
- break;\r
- }\r
- }\r
- return xRc;\r
- }\r
-\r
-#endif /* ipconfigFTP_ZERO_COPY_ALIGNED_WRITES */\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-###### # ####### # ###\r
- # # # # # ## # #\r
- # # # # # #\r
- # # #### ###### ### ## ### #### # # #### # # ### # ####\r
- ###### # # # # # # # # # # # # # ##### # # # #\r
- # ## ###### # ## # # ###### # # ###### # # # # ######\r
- # # # # # # # # # # # # # #\r
- # # # ## # ## # # # ## # # # ## # # # # ##\r
-### ## #### ## #### ##### #### ## #### #### ##### ##### ####\r
-*/\r
-static BaseType_t prvRetrieveFilePrep( FTPClient_t *pxClient, char *pcFileName )\r
-{\r
-BaseType_t xResult = pdTRUE;\r
-size_t uxFileSize;\r
-\r
- /* Close previous handle (if any) and reset file transfer parameters */\r
- prvTransferCloseFile( pxClient );\r
-\r
- xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
-\r
- pxClient->pxReadHandle = ff_fopen( pxClient->pcFileName, "rb" );\r
- if( pxClient->pxReadHandle == NULL )\r
- {\r
- int iErrno = stdioGET_ERRNO();\r
- /* "Requested file action not taken". */\r
- prvSendReply( pxClient->xSocket, REPL_450, 0 );\r
- FreeRTOS_printf( ("prvRetrieveFilePrep: open '%s': errno %d: %s\n",\r
- pxClient->pcFileName, iErrno, ( const char * ) strerror( iErrno ) ) );\r
- uxFileSize = 0ul;\r
- xResult = pdFALSE;\r
- }\r
- else\r
- {\r
- uxFileSize = pxClient->pxReadHandle->ulFileSize;\r
- pxClient->uxBytesLeft = uxFileSize;\r
- if( pxClient->ulRestartOffset != 0ul )\r
- {\r
- size_t uxOffset = pxClient->ulRestartOffset;\r
- int32_t iRc;\r
-\r
- /* Only use 1 time. */\r
- pxClient->ulRestartOffset = 0;\r
-\r
- if( uxOffset < uxFileSize )\r
- {\r
- iRc = ff_fseek( pxClient->pxReadHandle, uxOffset, FF_SEEK_SET );\r
- }\r
- else\r
- {\r
- iRc = -pdFREERTOS_ERRNO_EINVAL;\r
- }\r
- if( iRc != 0 )\r
- {\r
- BaseType_t xLength;\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "450 Seek invalid %u length %u\r\n", ( unsigned ) uxOffset, ( unsigned ) uxFileSize );\r
-\r
- /* "Requested file action not taken". */\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
-\r
- FreeRTOS_printf( ( "prvRetrieveFilePrep: create %s: Seek %u length %u\n",\r
- pxClient->pcFileName, ( unsigned ) uxOffset, ( unsigned ) uxFileSize ) );\r
-\r
- ff_fclose( pxClient->pxReadHandle );\r
- pxClient->pxReadHandle = NULL;\r
- xResult = pdFALSE;\r
- }\r
- else\r
- {\r
- pxClient->uxBytesLeft = uxFileSize - pxClient->ulRestartOffset;\r
- }\r
- }\r
- }\r
- if( xResult != pdFALSE )\r
- {\r
- if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
- {\r
- /* True if PASV is used. */\r
- snprintf( pxClient->pcConnectionAck, sizeof( pxClient->pcConnectionAck ),\r
- "150%cAccepted data connection from %%xip:%%u\r\n%s",\r
- pxClient->xTransType == TMODE_ASCII ? '-' : ' ',\r
- pxClient->xTransType == TMODE_ASCII ? "150 NOTE: ASCII mode requested, but binary mode used\r\n" : "" );\r
- } else {\r
- BaseType_t xLength;\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "150%cOpening data connection to %lxip:%u\r\n%s",\r
- pxClient->xTransType == TMODE_ASCII ? '-' : ' ',\r
- pxClient->ulClientIP,\r
- pxClient->usClientPort,\r
- pxClient->xTransType == TMODE_ASCII ? "150 NOTE: ASCII mode requested, but binary mode used\r\n" : "" );\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- pxClient->pcConnectionAck[ 0 ] = '\0';\r
- prvTransferStart( pxClient );\r
- }\r
-\r
- /* Prepare the ACK which will be sent when all data has been sent. */\r
- snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ), "%s", REPL_226 );\r
-\r
- /* To get some statistics about the performance. */\r
- pxClient->xStartTime = xTaskGetTickCount( );\r
- if( uxFileSize == 0ul )\r
- {\r
- FreeRTOS_shutdown( pxClient->xTransferSocket, FREERTOS_SHUT_RDWR );\r
- }\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvRetrieveFileWork( FTPClient_t *pxClient )\r
-{\r
-size_t uxSpace;\r
-size_t uxCount, uxItemsRead;\r
-BaseType_t xRc = 0;\r
-BaseType_t xSetEvent = pdFALSE;\r
-\r
- do\r
- {\r
- #if( ipconfigFTP_TX_ZERO_COPY != 0 )\r
- char *pcBuffer;\r
- BaseType_t xBufferLength;\r
- #endif /* ipconfigFTP_TX_ZERO_COPY */\r
-\r
- /* Take the lesser of the two: tx_space (number of bytes that can be\r
- queued for transmission) and uxBytesLeft (the number of bytes left to\r
- read from the file) */\r
- uxSpace = FreeRTOS_tx_space( pxClient->xTransferSocket );\r
-\r
- if( uxSpace == 0 )\r
- {\r
- FreeRTOS_FD_SET( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE | eSELECT_EXCEPT );\r
- xRc = FreeRTOS_select( pxClient->pxParent->xSocketSet, 200 );\r
- uxSpace = FreeRTOS_tx_space( pxClient->xTransferSocket );\r
- }\r
-\r
- uxCount = FreeRTOS_min_uint32( pxClient->uxBytesLeft, uxSpace );\r
-\r
- if( uxCount == 0 )\r
- {\r
- break;\r
- }\r
-\r
- #if( ipconfigFTP_TX_ZERO_COPY == 0 )\r
- {\r
- if( uxCount > sizeof( pcFILE_BUFFER ) )\r
- {\r
- uxCount = sizeof( pcFILE_BUFFER );\r
- }\r
- uxItemsRead = ff_fread( pcFILE_BUFFER, 1, uxCount, pxClient->pxReadHandle );\r
- if( uxItemsRead != uxCount )\r
- {\r
- FreeRTOS_printf( ( "prvRetrieveFileWork: Got %u Expected %u\n", ( unsigned )uxItemsRead, ( unsigned ) uxCount ) );\r
- xRc = FreeRTOS_shutdown( pxClient->xTransferSocket, FREERTOS_SHUT_RDWR );\r
- pxClient->uxBytesLeft = 0u;\r
- break;\r
- }\r
- pxClient->uxBytesLeft -= uxCount;\r
-\r
- if( pxClient->uxBytesLeft == 0u )\r
- {\r
- BaseType_t xTrueValue = 1;\r
-\r
- FreeRTOS_setsockopt( pxClient->xTransferSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
- }\r
-\r
- xRc = FreeRTOS_send( pxClient->xTransferSocket, pcFILE_BUFFER, uxCount, 0 );\r
- }\r
- #else /* ipconfigFTP_TX_ZERO_COPY != 0 */\r
- {\r
- /* Use zero-copy transmission:\r
- FreeRTOS_get_tx_head() returns a direct pointer to the TX stream and\r
- set xBufferLength to know how much space there is left. */\r
- pcBuffer = ( char * )FreeRTOS_get_tx_head( pxClient->xTransferSocket, &xBufferLength );\r
- if( ( pcBuffer != NULL ) && ( xBufferLength >= 512 ) )\r
- {\r
- /* Will read disk data directly to the TX stream of the socket. */\r
- uxCount = FreeRTOS_min_uint32( uxCount, ( uint32_t )xBufferLength );\r
- if( uxCount > ( size_t ) 0x40000u )\r
- {\r
- uxCount = ( size_t ) 0x40000u;\r
- }\r
- }\r
- else\r
- {\r
- /* Use the normal file i/o buffer. */\r
- pcBuffer = pcFILE_BUFFER;\r
- if( uxCount > sizeof( pcFILE_BUFFER ) )\r
- {\r
- uxCount = sizeof( pcFILE_BUFFER );\r
- }\r
- }\r
-\r
- if ( pxClient->uxBytesLeft >= 1024u )\r
- {\r
- uxCount &= ~( ( size_t ) 512u - 1u );\r
- }\r
-\r
- if( uxCount <= 0u )\r
- {\r
- /* Nothing to send after rounding down to a multiple of a sector size. */\r
- break;\r
- }\r
-\r
- uxItemsRead = ff_fread( pcBuffer, 1, uxCount, pxClient->pxReadHandle );\r
-\r
- if( uxCount != uxItemsRead )\r
- {\r
- FreeRTOS_printf( ( "prvRetrieveFileWork: Got %u Expected %u\n", ( unsigned )uxItemsRead, ( unsigned )uxCount ) );\r
- xRc = FreeRTOS_shutdown( pxClient->xTransferSocket, FREERTOS_SHUT_RDWR );\r
- pxClient->uxBytesLeft = 0u;\r
- break;\r
- }\r
- pxClient->uxBytesLeft -= uxCount;\r
-\r
- if( pxClient->uxBytesLeft == 0u )\r
- {\r
- BaseType_t xTrueValue = 1;\r
-\r
- FreeRTOS_setsockopt( pxClient->xTransferSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
- }\r
- if( pcBuffer != pcFILE_BUFFER )\r
- {\r
- pcBuffer = NULL;\r
- }\r
- xRc = FreeRTOS_send( pxClient->xTransferSocket, pcBuffer, uxCount, 0 );\r
- }\r
- #endif /* ipconfigFTP_TX_ZERO_COPY */\r
-\r
- if( xRc < 0 )\r
- {\r
- break;\r
- }\r
-\r
- pxClient->ulRecvBytes += xRc;\r
- if( pxClient->uxBytesLeft == 0u )\r
- {\r
- break;\r
- }\r
- } while( uxCount > 0u );\r
-\r
- if( xRc < 0 )\r
- {\r
- FreeRTOS_printf( ( "prvRetrieveFileWork: already disconnected\n" ) );\r
- }\r
- else if( pxClient->uxBytesLeft <= 0u )\r
- {\r
- BaseType_t x;\r
-\r
- for( x = 0; x < 5; x++ )\r
- {\r
- xRc = FreeRTOS_recv( pxClient->xTransferSocket, pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), 0 );\r
- if( xRc < 0 )\r
- {\r
- break;\r
- }\r
- }\r
-// FreeRTOS_printf( ( "prvRetrieveFileWork: %s all sent: xRc %ld\n", pxClient->pcFileName, xRc ) );\r
- }\r
- else\r
- {\r
- FreeRTOS_FD_SET( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
- xSetEvent = pdTRUE;\r
- }\r
- if( xSetEvent == pdFALSE )\r
- {\r
- FreeRTOS_FD_CLR( pxClient->xTransferSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
- }\r
- return xRc;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-### ##### #### #####\r
- # # # # # # #\r
- # # # # #\r
- # # # #\r
- # # ## #\r
- # # # ## #\r
- # # # # # #\r
- # # # # # #\r
-####### ##### #### ####\r
-*/\r
-/* Prepare sending a directory LIST */\r
-static BaseType_t prvListSendPrep( FTPClient_t *pxClient )\r
-{\r
-BaseType_t xFindResult;\r
-int iErrorNo;\r
-\r
- if( pxClient->bits1.bIsListen != pdFALSE_UNSIGNED )\r
- {\r
- /* True if PASV is used */\r
- snprintf( pxClient->pcConnectionAck, sizeof( pxClient->pcConnectionAck ),\r
- "150 Accepted data connection from %%xip:%%u\r\n" );\r
- }\r
- else\r
- {\r
- BaseType_t xLength;\r
-\r
- /* Here the FTP server is supposed to connect() */\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "150 Opening ASCII mode data connection to for /bin/ls \r\n" );\r
-\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- /* Clear the current connection acknowledge message */\r
- pxClient->pcConnectionAck[ 0 ] = '\0';\r
- prvTransferStart( pxClient );\r
- }\r
-\r
- pxClient->xDirCount = 0;\r
- xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pxClient->pcCurrentDir );\r
-\r
- xFindResult = ff_findfirst( pcNEW_DIR, &pxClient->xFindData );\r
-\r
- pxClient->bits1.bDirHasEntry = ( xFindResult >= 0 );\r
-\r
- iErrorNo = stdioGET_ERRNO();\r
- if( ( xFindResult < 0 ) && ( iErrorNo == pdFREERTOS_ERRNO_ENMFILE ) )\r
- {\r
- FreeRTOS_printf( ("prvListSendPrep: Empty directory? (%s)\n", pxClient->pcCurrentDir ) );\r
- prvSendReply( pxClient->xTransferSocket, "total 0\r\n", 0 );\r
- pxClient->xDirCount++;\r
- }\r
- else if( xFindResult < 0 )\r
- {\r
- FreeRTOS_printf( ( "prvListSendPrep: rc = %ld iErrorNo = %d\n", xFindResult, iErrorNo ) );\r
- prvSendReply( pxClient->xSocket, REPL_451, 0 );\r
- }\r
- pxClient->pcClientAck[ 0 ] = '\0';\r
-\r
- return pxClient->xDirCount;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#define MAX_DIR_LIST_ENTRY_SIZE 256\r
-\r
-static BaseType_t prvListSendWork( FTPClient_t *pxClient )\r
-{\r
-BaseType_t xTxSpace;\r
-\r
- while( pxClient->bits1.bClientConnected != pdFALSE_UNSIGNED )\r
- {\r
- char *pcWritePtr = pcCOMMAND_BUFFER;\r
- BaseType_t xWriteLength;\r
-\r
- xTxSpace = FreeRTOS_tx_space( pxClient->xTransferSocket );\r
-\r
- if( xTxSpace > ( BaseType_t ) sizeof( pcCOMMAND_BUFFER ) )\r
- {\r
- xTxSpace = sizeof( pcCOMMAND_BUFFER );\r
- }\r
-\r
- while( ( xTxSpace >= MAX_DIR_LIST_ENTRY_SIZE ) && ( pxClient->bits1.bDirHasEntry != pdFALSE_UNSIGNED ) )\r
- {\r
- BaseType_t xLength, xEndOfDir;\r
- int32_t iRc;\r
- int iErrorNo;\r
-\r
- xLength = prvGetFileInfoStat( &( pxClient->xFindData.xDirectoryEntry ), pcWritePtr, xTxSpace );\r
-\r
- pxClient->xDirCount++;\r
- pcWritePtr += xLength;\r
- xTxSpace -= xLength;\r
-\r
- iRc = ff_findnext( &pxClient->xFindData );\r
- iErrorNo = stdioGET_ERRNO();\r
-\r
- xEndOfDir = ( iRc < 0 ) && ( iErrorNo == pdFREERTOS_ERRNO_ENMFILE );\r
-\r
- pxClient->bits1.bDirHasEntry = ( xEndOfDir == pdFALSE ) && ( iRc >= 0 );\r
-\r
- if( ( iRc < 0 ) && ( xEndOfDir == pdFALSE ) )\r
- {\r
- FreeRTOS_printf( ("prvListSendWork: %s (rc %08x)\n",\r
- ( const char * ) strerror( iErrorNo ),\r
- ( unsigned )iRc ) );\r
- }\r
- }\r
- xWriteLength = ( BaseType_t ) ( pcWritePtr - pcCOMMAND_BUFFER );\r
-\r
- if( xWriteLength == 0 )\r
- {\r
- break;\r
- }\r
-\r
- if( pxClient->bits1.bDirHasEntry == pdFALSE_UNSIGNED )\r
- {\r
- uint32_t ulTotalCount;\r
- uint32_t ulFreeCount;\r
- uint32_t ulPercentage;\r
-\r
- ulTotalCount = 1;\r
- ulFreeCount = ff_diskfree( pxClient->pcCurrentDir, &ulTotalCount );\r
- ulPercentage = ( uint32_t ) ( ( 100ULL * ulFreeCount + ulTotalCount / 2 ) / ulTotalCount );\r
-\r
- /* Prepare the ACK which will be sent when all data has been sent. */\r
- snprintf( pxClient->pcClientAck, sizeof( pxClient->pcClientAck ),\r
- "226-Options: -l\r\n"\r
- "226-%ld matches total\r\n"\r
- "226 Total %lu KB (%lu %% free)\r\n",\r
- pxClient->xDirCount, ulTotalCount /1024, ulPercentage );\r
- }\r
-\r
- if( xWriteLength )\r
- {\r
- if( pxClient->bits1.bDirHasEntry == pdFALSE_UNSIGNED )\r
- {\r
- BaseType_t xTrueValue = 1;\r
-\r
- FreeRTOS_setsockopt( pxClient->xTransferSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, ( void * ) &xTrueValue, sizeof( xTrueValue ) );\r
- }\r
-\r
- prvSendReply( pxClient->xTransferSocket, pcCOMMAND_BUFFER, xWriteLength );\r
- }\r
-\r
- if( pxClient->bits1.bDirHasEntry == pdFALSE_UNSIGNED )\r
- {\r
- prvSendReply( pxClient->xSocket, pxClient->pcClientAck, 0 );\r
- break;\r
- }\r
-\r
- } /* while( pxClient->bits1.bClientConnected ) */\r
-\r
- return 0;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static const char *pcMonthAbbrev( BaseType_t xMonth )\r
-{\r
-static const char pcMonthList[] = "JanFebMarAprMayJunJulAugSepOctNovDec";\r
-\r
- if( xMonth < 1 || xMonth > 12 )\r
- xMonth = 12;\r
-\r
- return pcMonthList + 3 * ( xMonth - 1 );\r
-};\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvGetFileInfoStat( FF_DirEnt_t *pxEntry, char *pcLine, BaseType_t xMaxLength )\r
-{\r
- char date[ 16 ];\r
- char mode[ 11 ] = "----------";\r
- BaseType_t st_nlink = 1;\r
- const char user[ 9 ] = "freertos";\r
- const char group[ 8 ] = "plusfat";\r
-\r
-/*\r
- * Creates a unix-style listing, understood by most FTP clients:\r
- *\r
- * -rw-rw-r-- 1 freertos FreeRTOS+FAT 10564588 Sep 01 00:17 03. Metaharmoniks - Star (Instrumental).mp3\r
- * -rw-rw-r-- 1 freertos FreeRTOS+FAT 19087839 Sep 01 00:17 04. Simon Le Grec - Dimitri (Wherever U Are) (Cosmos Mix).mp3\r
- * -rw-rw-r-- 1 freertos FreeRTOS+FAT 11100621 Sep 01 00:16 05. D-Chill - Mistake (feat. Katy Blue).mp3\r
- */\r
-\r
- #if ( ffconfigTIME_SUPPORT == 1 )\r
- const FF_SystemTime_t *pxCreateTime = &( pxEntry->xCreateTime );\r
- #else\r
- #warning Do not use this.\r
- FF_SystemTime_t xCreateTime;\r
- const FF_SystemTime_t *pxCreateTime = &xCreateTime;\r
- #endif\r
- size_t ulSize = ( size_t )pxEntry->ulFileSize;\r
- const char *pcFileName = pxEntry->pcFileName;\r
-\r
- mode[ 0 ] = ( ( pxEntry->ucAttrib & FF_FAT_ATTR_DIR ) != 0 ) ? 'd' : '-';\r
- #if( ffconfigDEV_SUPPORT != 0 )\r
- {\r
- if( ( pxEntry->ucAttrib & FF_FAT_ATTR_DIR ) == 0 )\r
- {\r
- switch( pxEntry->ucIsDeviceDir )\r
- {\r
- case FF_DEV_CHAR_DEV:\r
- mode[ 0 ] = 'c';\r
- break;\r
- case FF_DEV_BLOCK_DEV:\r
- mode[ 0 ] = 'b';\r
- break;\r
- }\r
- }\r
- }\r
- #endif /* ffconfigDEV_SUPPORT != 0 */\r
-\r
- mode[ 1 ] = 'r'; /* Owner. */\r
- mode[ 2 ] = ( ( pxEntry->ucAttrib & FF_FAT_ATTR_READONLY ) != 0 ) ? '-' : 'w';\r
- mode[ 3 ] = '-'; /* x for executable. */\r
-\r
- mode[ 4 ] = 'r'; /* group. */\r
- mode[ 5 ] = ( ( pxEntry->ucAttrib & FF_FAT_ATTR_READONLY ) != 0 ) ? '-' : 'w';\r
- mode[ 6 ] = '-'; /* x for executable. */\r
-\r
- mode[ 7 ] = 'r'; /* world. */\r
- mode[ 8 ] = '-';\r
- mode[ 9 ] = '-'; /* x for executable. */\r
-\r
- if( pxCreateTime->Month && pxCreateTime->Day )\r
- {\r
- snprintf( date, sizeof( date ), "%-3.3s %02d %02d:%02d",\r
- pcMonthAbbrev( pxCreateTime->Month ),\r
- pxCreateTime->Day,\r
- pxCreateTime->Hour,\r
- pxCreateTime->Minute );\r
- }\r
- else\r
- {\r
- snprintf (date, sizeof( date ), "Jan 01 1970");\r
- }\r
- return snprintf( pcLine, xMaxLength, "%s %3ld %-4s %-4s %8d %12s %s\r\n",\r
- mode, st_nlink, user, group, ( int ) ulSize, date, pcFileName );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- #### # # #####\r
- # # # # # #\r
-# # # # # #\r
-# # # # # #\r
-# # # # # #\r
-# # # # # #\r
-# # ## ## # #\r
- # # ## ## # #\r
- #### ## ## #####\r
-*/\r
-static BaseType_t prvChangeDir( FTPClient_t *pxClient, char *pcDirectory )\r
-{\r
-BaseType_t xResult;\r
-BaseType_t xIsRootDir, xLength, xValid;\r
-BaseType_t xIsDotDir = 0;\r
-\r
- if( pcDirectory[ 0 ] == '.' )\r
- {\r
- if( ( pcDirectory[ 1 ] == '.' ) &&\r
- ( pcDirectory[ 2 ] == '\0' ) )\r
- {\r
- xIsDotDir = 2;\r
- }\r
- else if( pcDirectory[ 1 ] == '\0' )\r
- {\r
- xIsDotDir = 1;\r
- }\r
- }\r
-\r
- if( xIsDotDir != 0 )\r
- {\r
- strcpy( pcFILE_BUFFER, pxClient->pcCurrentDir );\r
-\r
- if( pcDirectory[ 1 ] == '.' )\r
- {\r
- char *p = strrchr( pcFILE_BUFFER, '/' );\r
- if( p != NULL )\r
- {\r
- if( p == pcFILE_BUFFER )\r
- {\r
- p[ 1 ] = '\0';\r
- }\r
- else\r
- {\r
- p[ 0 ] = '\0';\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- if(pcDirectory[ 0 ] != '/' )\r
- {\r
- BaseType_t xCurLength;\r
-\r
- xCurLength = strlen( pxClient->pcCurrentDir );\r
- snprintf( pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), "%s%s%s",\r
- pxClient->pcCurrentDir,\r
- pxClient->pcCurrentDir[ xCurLength - 1 ] == '/' ? "" : "/",\r
- pcDirectory );\r
- }\r
- else\r
- {\r
- snprintf( pcFILE_BUFFER, sizeof( pcFILE_BUFFER ), "%s", pcDirectory );\r
- }\r
- }\r
-\r
- xIsRootDir = ( pcFILE_BUFFER[ 0 ] == '/' ) && ( pcFILE_BUFFER[ 1 ] == '\0' );\r
- xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pcFILE_BUFFER );\r
-\r
- if( ( ( xIsRootDir == pdFALSE ) || ( FF_FS_Count() == 0 ) ) && ( ff_finddir( pcNEW_DIR ) == pdFALSE ) )\r
- {\r
- xValid = pdFALSE;\r
- }\r
- else\r
- {\r
- xValid = pdTRUE;\r
- }\r
-\r
- if( xValid == pdFALSE )\r
- {\r
- /* Get the directory cluster, if it exists. */\r
- FreeRTOS_printf( ("FTP: chdir \"%s\": No such dir\n", pcNEW_DIR ) );\r
- //#define REPL_550 "550 Requested action not taken.\r\n"\r
- //550 /home/hein/arch/h8300: No such file or directory\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "550 %s: No such file or directory\r\n",\r
- pcNEW_DIR );\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- xResult = pdFALSE;\r
- }\r
- else\r
- {\r
- memcpy( pxClient->pcCurrentDir, pcNEW_DIR, sizeof( pxClient->pcCurrentDir ) );\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "250 Changed to %s\r\n", pcNEW_DIR );\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- xResult = pdTRUE;\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-###### ## # ####### ######\r
- # # ## # # ## # #\r
- # # ## # # # # #\r
- # # ### # # # # #\r
- ###### # ## # ##### ######\r
- # ## # ## # # # # ##\r
- # # # ### # # #\r
- # # # ## # # #\r
-### ## # ## #### ### ##\r
-*/\r
-static BaseType_t prvRenameFrom( FTPClient_t *pxClient, const char *pcFileName )\r
-{\r
-const char *myReply;\r
-FF_FILE *fh;\r
-\r
- xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
-\r
- myReply = NULL;\r
-\r
- fh = ff_fopen( pxClient->pcFileName, "rb" );\r
-\r
- if( fh != NULL )\r
- {\r
- ff_fclose( fh );\r
- /* REPL_350; "350 Requested file action pending further information." */\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "350 Rename '%s' ...\r\n", pxClient->pcFileName );\r
- myReply = pcCOMMAND_BUFFER;\r
- pxClient->bits.bInRename = pdTRUE_UNSIGNED;\r
- }\r
- else if( stdioGET_ERRNO() == pdFREERTOS_ERRNO_EISDIR )\r
- {\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "350 Rename directory '%s' ...\r\n", pxClient->pcFileName );\r
- myReply = pcCOMMAND_BUFFER;\r
- pxClient->bits.bInRename = pdTRUE_UNSIGNED;\r
- }\r
- else\r
- {\r
- FreeRTOS_printf( ("ftp::renameFrom[%s]\n%s\n", pxClient->pcFileName, strerror( stdioGET_ERRNO() ) ) );\r
- myReply = REPL_451; /* "451 Requested action aborted. Local error in processing." */\r
- }\r
- if( myReply )\r
- {\r
- prvSendReply( pxClient->xSocket, myReply, 0 );\r
- }\r
-\r
- return pdTRUE;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-###### ## # ##### ###\r
- # # ## # # # # ## ##\r
- # # ## # # ## ##\r
- # # ### # # # #\r
- ###### # ## # # # #\r
- # ## # ## # # # #\r
- # # # ### # ## ##\r
- # # # ## # ## ##\r
-### ## # ## #### ###\r
-*/\r
-static BaseType_t prvRenameTo( FTPClient_t *pxClient, const char *pcFileName )\r
-{\r
-const char *myReply = NULL;\r
-int iResult;\r
-\r
- xMakeAbsolute( pxClient, pcNEW_DIR, sizeof( pcNEW_DIR ), pcFileName );\r
-\r
- /* FreeRTOS+FAT rename has an extra parameter: "remove target if already\r
- exists". */\r
- iResult = ff_rename( pxClient->pcFileName, pcNEW_DIR, pdFALSE );\r
-\r
- if( iResult < 0 )\r
- {\r
- iResult = stdioGET_ERRNO();\r
- }\r
- else\r
- {\r
- iResult = 0;\r
- }\r
-\r
- switch( iResult )\r
- {\r
- case 0:\r
- FreeRTOS_printf( ( "ftp::renameTo[%s,%s]: Ok\n", pxClient->pcFileName, pcNEW_DIR ) );\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "250 Rename successful to '%s'\r\n", pcNEW_DIR );\r
- myReply = pcCOMMAND_BUFFER;\r
- break;\r
- case pdFREERTOS_ERRNO_EEXIST:\r
- /* the destination file already exists.\r
- "450 Requested file action not taken.\r\n"*/\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "450 Already exists '%s'\r\n", pcNEW_DIR );\r
- myReply = pcCOMMAND_BUFFER;\r
- break;\r
- case pdFREERTOS_ERRNO_EIO: /* FF_ERR_FILE_COULD_NOT_CREATE_DIRENT */\r
- /* if dirent creation failed (fatal error!).\r
- "553 Requested action not taken.\r\n" */\r
- FreeRTOS_printf( ("ftp::renameTo[%s,%s]: Error creating DirEnt\n",\r
- pxClient->pcFileName, pcNEW_DIR ) );\r
- myReply = REPL_553;\r
- break;\r
- case pdFREERTOS_ERRNO_ENXIO:\r
- case pdFREERTOS_ERRNO_ENOENT:\r
- /* if the source file was not found.\r
- "450 Requested file action not taken.\r\n" */\r
- snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "450 No such file '%s'\r\n", pxClient->pcFileName );\r
- myReply = pcCOMMAND_BUFFER;\r
- break;\r
- default:\r
- FreeRTOS_printf( ("ftp::renameTo[%s,%s]: %s\n", pxClient->pcFileName, pcNEW_DIR,\r
- (const char*)strerror( stdioGET_ERRNO() ) ) );\r
- myReply = REPL_451; /* "451 Requested action aborted. Local error in processing." */\r
- break;\r
- }\r
- prvSendReply( pxClient->xSocket, myReply, 0 );\r
-\r
- return pdTRUE;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- #### #\r
-# # # #\r
-# # #\r
-# ### ###### ####\r
- ## # # # #\r
- ## # # ######\r
-# # # # #\r
-# # # # ## # ##\r
- #### ##### ## ####\r
-*/\r
-static BaseType_t prvSiteCmd( FTPClient_t *pxClient, char *pcRestCommand )\r
-{\r
- ( void ) pxClient;\r
- ( void ) pcRestCommand;\r
-\r
- return 0;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-##### ###\r
- # # # #\r
- # # # #\r
- # # #### # #### ###### ####\r
- # # # # # # # # # #\r
- # # ###### # ###### # ######\r
- # # # # # # #\r
- # # # ## # # ## # ## # ##\r
-##### #### ##### #### ## ####\r
-*/\r
-static BaseType_t prvDeleteFile( FTPClient_t *pxClient, char *pcFileName )\r
-{\r
-BaseType_t xResult, xLength;\r
-int32_t iRc;\r
-int iErrorNo;\r
-\r
- /* DELE: Delete a file. */\r
- xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
-\r
- iRc = ff_remove( pxClient->pcFileName );\r
-\r
- if (iRc >= 0 )\r
- {\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "250 File \"%s\" removed\r\n", pxClient->pcFileName );\r
- xResult = pdTRUE;\r
- }\r
- else\r
- {\r
- const char *errMsg = "other error";\r
-\r
- iErrorNo = stdioGET_ERRNO();\r
- switch( iErrorNo )\r
- { /*_RB_ What do these negative numbers relate to? */\r
- case pdFREERTOS_ERRNO_ENOENT: errMsg = "No such file"; break; /* -31 File was not found. */\r
- case pdFREERTOS_ERRNO_EALREADY: errMsg = "File still open"; break; /* -30 File is in use. */\r
- case pdFREERTOS_ERRNO_EISDIR: errMsg = "Is a dir"; break; /* -32 Tried to FF_Open() a Directory. */\r
- case pdFREERTOS_ERRNO_EROFS: errMsg = "Read-only"; break; /* -33 Tried to FF_Open() a file marked read only. */\r
- case pdFREERTOS_ERRNO_ENOTDIR: errMsg = "Invalid path"; break; /* -34 The path of the file was not found. */\r
- }\r
- FreeRTOS_printf( ( "ftp::delFile: '%s' because %s\n",\r
- pxClient->pcFileName, strerror( iErrorNo ) ) );\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "521-\"%s\" %s;\r\n"\r
- "521 taking no action\r\n",\r
- pxClient->pcFileName, errMsg );\r
-\r
- xResult = pdFALSE;\r
- }\r
-\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- #### # #####\r
-# # # # # #\r
-# # # # #\r
-# ### ###### #### # # #### ###### ####\r
- ## # # # # # # # # # # #\r
- ## # # ###### # # ##### # ######\r
-# # # # # # # # # # #\r
-# # # # # ## # # # # # ## # ##\r
- #### ##### ###### #### ##### ### ## ## ####\r
-*/\r
-static BaseType_t prvSizeDateFile( FTPClient_t *pxClient, char *pcFileName, BaseType_t xSendDate )\r
-{\r
-BaseType_t xResult = pdFALSE;\r
-char *pcPtr;\r
-\r
- /* SIZE: get the size of a file (xSendDate = 0)\r
- MDTM: get data and time properties (xSendDate = 1) */\r
- xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcFileName );\r
-\r
- pcPtr = strrchr( pxClient->pcFileName, '/' );\r
-\r
- if( ( pcPtr != NULL ) && ( pcPtr[ 1 ] != '\0' ) )\r
- {\r
- FF_Stat_t xStatBuf;\r
- int32_t iRc = ff_stat( pxClient->pcFileName, &xStatBuf );\r
- if (iRc < 0 )\r
- FreeRTOS_printf( ("In %s: %s\n", pxClient->pcFileName,\r
- ( const char* )strerror( stdioGET_ERRNO() ) ) );\r
-\r
- if( iRc == 0 )\r
- {\r
- BaseType_t xLength;\r
- /* "YYYYMMDDhhmmss" */\r
- if( xSendDate != pdFALSE )\r
- {\r
- #if( ffconfigTIME_SUPPORT != 0 )\r
- {\r
- FF_TimeStruct_t tmStruct;\r
- time_t secs = xStatBuf.st_mtime;\r
- FreeRTOS_gmtime_r( &secs, &tmStruct );\r
-\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 %04u%02u%02u%02u%02u%02u\r\n",\r
- tmStruct.tm_year + 1900,\r
- tmStruct.tm_mon+1,\r
- tmStruct.tm_mday,\r
- tmStruct.tm_hour,\r
- tmStruct.tm_min,\r
- tmStruct.tm_sec );\r
- }\r
- #else\r
- {\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 19700101000000\r\n",\r
- }\r
- #endif\r
- }\r
- else\r
- {\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "213 %lu\r\n", xStatBuf.st_size );\r
- }\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
- xResult = pdTRUE;\r
- }\r
- else\r
- {\r
- FreeRTOS_printf( ("ftp::sizeDateFile: No such file %s\n", pxClient->pcFileName ) );\r
- }\r
- } else {\r
- FreeRTOS_printf( ("ftp::sizeDateFile: Invalid file name: %s ?\n", pxClient->pcFileName ) );\r
- }\r
- if( xResult == pdFALSE )\r
- {\r
- prvSendReply( pxClient->xSocket, REPL_450, 0 ); /* "Requested file action not taken". */\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
-## ## ## ## ##### ###### ## ## #####\r
-### ### # # # # # # ### ### # #\r
-# ### # # # # # # # # ### # # #\r
-# # # # # # # # # # # # # #\r
-# # # #### # # ###### # # # # #\r
-# # # # # # # ## # # # #\r
-# # # # # # # # # # # #\r
-# # # # # # # # # # # #\r
-# # ### ## ##### ### ## # # #####\r
-*/\r
-static BaseType_t prvMakeRemoveDir( FTPClient_t *pxClient, const char *pcDirectory, BaseType_t xDoRemove )\r
-{\r
-BaseType_t xResult;\r
-BaseType_t xLength;\r
-int32_t iRc;\r
-int iErrorNo;\r
-\r
- /* MKD: Make / create a directory (xDoRemove = 0)\r
- RMD: Remove a directory (xDoRemove = 1) */\r
- xMakeAbsolute( pxClient, pxClient->pcFileName, sizeof( pxClient->pcFileName ), pcDirectory );\r
-\r
- if( xDoRemove )\r
- {\r
- iRc = ff_rmdir( pxClient->pcFileName );\r
- }\r
- else\r
- {\r
- #if( ffconfigMKDIR_RECURSIVE != 0 )\r
- {\r
- iRc = ff_mkdir( pxClient->pcFileName, pdFALSE );\r
- }\r
- #else\r
- {\r
- iRc = ff_mkdir( pxClient->pcFileName );\r
- }\r
- #endif /* ffconfigMKDIR_RECURSIVE */\r
- }\r
- xResult = pdTRUE;\r
-\r
- if( iRc >= 0 )\r
- {\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), "257 \"%s\" directory %s\r\n",\r
- pxClient->pcFileName, xDoRemove ? "removed" : "created" );\r
- }\r
- else\r
- {\r
- const char *errMsg = "other error";\r
- BaseType_t xFTPCode = 521;\r
-\r
- xResult = pdFALSE;\r
- iErrorNo = stdioGET_ERRNO();\r
- switch( iErrorNo )\r
- {\r
- case pdFREERTOS_ERRNO_EEXIST: errMsg = "Directory already exists"; break;\r
- case pdFREERTOS_ERRNO_ENOTDIR: errMsg = "Invalid path"; break; /* -34 The path of the file was not found. *//*_RB_ As before, what do these negative numbers relate to? */\r
- case pdFREERTOS_ERRNO_ENOTEMPTY:errMsg = "Dir not empty"; break;\r
- case pdFREERTOS_ERRNO_EROFS: errMsg = "Read-only"; break; /* -33 Tried to FF_Open() a file marked read only. */\r
- default: errMsg = strerror( iErrorNo ); break;\r
- }\r
- if( iErrorNo == pdFREERTOS_ERRNO_ENOSPC )\r
- {\r
- xFTPCode = 552;\r
- }\r
- xLength = snprintf( pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ),\r
- "%ld-\"%s\" %s;\r\n"\r
- "%ld taking no action\r\n",\r
- xFTPCode, pxClient->pcFileName, errMsg, xFTPCode );\r
- FreeRTOS_printf( ( "%sdir '%s': %s\n", xDoRemove ? "rm" : "mk", pxClient->pcFileName, errMsg ) );\r
- }\r
- prvSendReply( pxClient->xSocket, pcCOMMAND_BUFFER, xLength );\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static portINLINE BaseType_t IsDigit( char cChar )\r
-{\r
-BaseType_t xResult;\r
-\r
- if( cChar >= '0' && cChar <= '9' )\r
- {\r
- xResult = pdTRUE;\r
- }\r
- else\r
- {\r
- xResult = pdFALSE;\r
- }\r
- return xResult;\r
-}\r
-\r
-static BaseType_t prvSendReply( Socket_t xSocket, const char *pcBuffer, BaseType_t xLength )\r
-{\r
-BaseType_t xResult;\r
-\r
- if( xLength == 0 )\r
- {\r
- xLength = strlen( pcBuffer );\r
- }\r
- xResult = FreeRTOS_send( xSocket, ( const void * )pcBuffer, ( size_t ) xLength, 0 );\r
- if( IsDigit( ( int ) pcBuffer[ 0 ] ) &&\r
- IsDigit( ( int ) pcBuffer[ 1 ] ) &&\r
- IsDigit( ( int ) pcBuffer[ 2 ] ) &&\r
- IsDigit( ( int ) pcBuffer[ 3 ] ) )\r
- {\r
- const char *last = pcBuffer + strlen( pcBuffer );\r
- int iLength;\r
- while( ( last > pcBuffer ) && ( ( last[ -1 ] == ftpASCII_CR ) || ( last[ -1 ] == ftpASCII_LF ) ) )\r
- {\r
- last--;\r
- }\r
- iLength = ( int )( last - pcBuffer );\r
- FF_PRINTF( " %-*.*s", iLength, iLength, pcBuffer );\r
- }\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )\r
-\r
- /*\r
- * The following function is called for every file received:\r
- * void vApplicationFTPReceivedHook( pcFileName, ulSize, pxFTPClient );\r
- * This callback function may do a callback to vFTPReplyMessage() to send messages\r
- * to the FTP client like:\r
- * 200-Please wait: Received new firmware\r
- * 200-Please wait: Please wait a few seconds for reboot\r
- */\r
- void vFTPReplyMessage( struct xFTP_CLIENT *pxFTPClient, const char *pcMessage )\r
- {\r
- if( ( pxFTPClient != NULL ) && ( pxFTPClient->xSocket != NULL ) )\r
- {\r
- prvSendReply( pxFTPClient->xSocket, pcMessage, 0 );\r
- }\r
- }\r
- /*-----------------------------------------------------------*/\r
-\r
-#endif /* ipconfigFTP_HAS_RECEIVED_HOOK != 0 */\r
-\r
-/*\r
- * Some explanation:\r
- * The FTP client may send: "DELE readme.txt"\r
- * Here the complete path is constructed consisting of 3 parts:\r
- *\r
- * pxClient->pcRootDir + pxClient->pcCurrentDir + pcFileName\r
- *\r
- * 'pcCurrentDir' will not be applied for an absolute path like in "DELE /.htaccess"\r
- */\r
-BaseType_t xMakeAbsolute( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName )\r
-{\r
-BaseType_t xLength = strlen( pxClient->pcRootDir );\r
-\r
- if( pcFileName[ 0 ] != '/' )\r
- {\r
- char *pcNewDirBuffer = pcNEW_DIR;\r
- BaseType_t xCurLength;\r
-\r
- xCurLength = strlen( pxClient->pcCurrentDir );\r
- if( pcBuffer == pcNEW_DIR )\r
- {\r
- /* In one call, the result already goes into pcNEW_DIR.\r
- Use pcFILE_BUFFER in that case */\r
- pcNewDirBuffer = pcFILE_BUFFER;\r
- }\r
- snprintf( pcNewDirBuffer, sizeof( pcNEW_DIR ), "%s%s%s",\r
- pxClient->pcCurrentDir,\r
- pxClient->pcCurrentDir[ xCurLength - 1 ] == '/' ? "" : "/",\r
- pcFileName );\r
- pcFileName = pcNewDirBuffer;\r
- }\r
- if( strncasecmp( pxClient->pcRootDir, pcFileName, xLength ) == 0 )\r
- {\r
- xLength = snprintf( pcBuffer, xBufferLength, "%s", pcFileName );\r
- }\r
- else\r
- {\r
- xLength = snprintf( pcBuffer, xBufferLength, "%s/%s",\r
- pxClient->pcRootDir,\r
- pcFileName[ 0 ] == '/' ? ( pcFileName + 1 ) : pcFileName );\r
- }\r
-\r
- #if( ipconfigFTP_FS_USES_BACKSLAH == 1 )\r
- for( pcPtr = pcBuffer; *pcPtr; pcPtr++ )\r
- {\r
- if( pcPtr[ 0 ] == '/' )\r
- {\r
- pcPtr[ 0 ] = '\\';\r
- }\r
- }\r
- #endif\r
-\r
- return xLength;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-BaseType_t xMakeRelative( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName )\r
-{\r
-BaseType_t xLength = strlen( pxClient->pcRootDir );\r
-\r
- if( strncasecmp ( pxClient->pcRootDir, pcFileName, xLength ) == 0 )\r
- {\r
- xLength = snprintf( pcBuffer, xBufferLength, "%s", pcFileName + xLength );\r
- }\r
- else\r
- {\r
- xLength = snprintf( pcBuffer, xBufferLength, "%s", pcFileName );\r
- }\r
-\r
- return xLength;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#endif /* ipconfigUSE_FTP */\r
-\r
-\r
-\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-\r
-/* Standard includes. */\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-\r
-#include "FreeRTOS_HTTP_commands.h"\r
-\r
-const struct xWEB_COMMAND xWebCommands[ WEB_CMD_COUNT ] =\r
-{\r
- { 3, "GET", ECMD_GET },\r
- { 4, "HEAD", ECMD_HEAD },\r
- { 4, "POST", ECMD_POST },\r
- { 3, "PUT", ECMD_PUT },\r
- { 6, "DELETE", ECMD_DELETE },\r
- { 5, "TRACE", ECMD_TRACE },\r
- { 7, "OPTIONS", ECMD_OPTIONS },\r
- { 7, "CONNECT", ECMD_CONNECT },\r
- { 5, "PATCH", ECMD_PATCH },\r
- { 4, "UNKN", ECMD_UNK },\r
-};\r
-\r
-const char *webCodename (int aCode)\r
-{\r
- switch (aCode) {\r
- case WEB_REPLY_OK: // = 200,\r
- return "OK";\r
- case WEB_NO_CONTENT: // 204\r
- return "No content";\r
- case WEB_BAD_REQUEST: // = 400,\r
- return "Bad request";\r
- case WEB_UNAUTHORIZED: // = 401,\r
- return "Authorization Required";\r
- case WEB_NOT_FOUND: // = 404,\r
- return "Not Found";\r
- case WEB_GONE: // = 410,\r
- return "Done";\r
- case WEB_PRECONDITION_FAILED: // = 412,\r
- return "Precondition Failed";\r
- case WEB_INTERNAL_SERVER_ERROR: // = 500,\r
- return "Internal Server Error";\r
- }\r
- return "Unknown";\r
-}\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-/* Standard includes. */\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-\r
-/* FreeRTOS+TCP includes. */\r
-#include "FreeRTOS_IP.h"\r
-#include "FreeRTOS_Sockets.h"\r
-\r
-/* FreeRTOS Protocol includes. */\r
-#include "FreeRTOS_HTTP_commands.h"\r
-#include "FreeRTOS_TCP_server.h"\r
-#include "FreeRTOS_server_private.h"\r
-\r
-/* Remove the whole file if HTTP is not supported. */\r
-#if( ipconfigUSE_HTTP == 1 )\r
-\r
-/* FreeRTOS+FAT includes. */\r
-#include "ff_stdio.h"\r
-\r
-#ifndef HTTP_SERVER_BACKLOG\r
- #define HTTP_SERVER_BACKLOG ( 12 )\r
-#endif\r
-\r
-#ifndef USE_HTML_CHUNKS\r
- #define USE_HTML_CHUNKS ( 0 )\r
-#endif\r
-\r
-#if !defined( ARRAY_SIZE )\r
- #define ARRAY_SIZE(x) ( BaseType_t ) (sizeof( x ) / sizeof( x )[ 0 ] )\r
-#endif\r
-\r
-/* Some defines to make the code more readbale */\r
-#define pcCOMMAND_BUFFER pxClient->pxParent->pcCommandBuffer\r
-#define pcNEW_DIR pxClient->pxParent->pcNewDir\r
-#define pcFILE_BUFFER pxClient->pxParent->pcFileBuffer\r
-\r
-#ifndef ipconfigHTTP_REQUEST_CHARACTER\r
- #define ipconfigHTTP_REQUEST_CHARACTER '?'\r
-#endif\r
-\r
-/*_RB_ Need comment block, although fairly self evident. */\r
-static void prvFileClose( HTTPClient_t *pxClient );\r
-static BaseType_t prvProcessCmd( HTTPClient_t *pxClient, BaseType_t xIndex );\r
-static const char *pcGetContentsType( const char *apFname );\r
-static BaseType_t prvOpenURL( HTTPClient_t *pxClient );\r
-static BaseType_t prvSendFile( HTTPClient_t *pxClient );\r
-static BaseType_t prvSendReply( HTTPClient_t *pxClient, BaseType_t xCode );\r
-\r
-static const char pcEmptyString[1] = { '\0' };\r
-\r
-typedef struct xTYPE_COUPLE\r
-{\r
- const char *pcExtension;\r
- const char *pcType;\r
-} TypeCouple_t;\r
-\r
-static TypeCouple_t pxTypeCouples[ ] =\r
-{\r
- { "html", "text/html" },\r
- { "css", "text/css" },\r
- { "js", "text/javascript" },\r
- { "png", "image/png" },\r
- { "jpg", "image/jpeg" },\r
- { "gif", "image/gif" },\r
- { "txt", "text/plain" },\r
- { "mp3", "audio/mpeg3" },\r
- { "wav", "audio/wav" },\r
- { "flac", "audio/ogg" },\r
- { "pdf", "application/pdf" },\r
- { "ttf", "application/x-font-ttf" },\r
- { "ttc", "application/x-font-ttf" }\r
-};\r
-\r
-void vHTTPClientDelete( TCPClient_t *pxTCPClient )\r
-{\r
-HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;\r
-\r
- /* This HTTP client stops, close / release all resources. */\r
- if( pxClient->xSocket != FREERTOS_NO_SOCKET )\r
- {\r
- FreeRTOS_FD_CLR( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_ALL );\r
- FreeRTOS_closesocket( pxClient->xSocket );\r
- pxClient->xSocket = FREERTOS_NO_SOCKET;\r
- }\r
- prvFileClose( pxClient );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvFileClose( HTTPClient_t *pxClient )\r
-{\r
- if( pxClient->pxFileHandle != NULL )\r
- {\r
- FreeRTOS_printf( ( "Closing file: %s\n", pxClient->pcCurrentFilename ) );\r
- ff_fclose( pxClient->pxFileHandle );\r
- pxClient->pxFileHandle = NULL;\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvSendReply( HTTPClient_t *pxClient, BaseType_t xCode )\r
-{\r
-struct xTCP_SERVER *pxParent = pxClient->pxParent;\r
-BaseType_t xRc;\r
-\r
- /* A normal command reply on the main socket (port 21). */\r
- char *pcBuffer = pxParent->pcFileBuffer;\r
-\r
- xRc = snprintf( pcBuffer, sizeof( pxParent->pcFileBuffer ),\r
- "HTTP/1.1 %d %s\r\n"\r
-#if USE_HTML_CHUNKS\r
- "Transfer-Encoding: chunked\r\n"\r
-#endif\r
- "Content-Type: %s\r\n"\r
- "Connection: keep-alive\r\n"\r
- "%s\r\n",\r
- ( int ) xCode,\r
- webCodename (xCode),\r
- pxParent->pcContentsType[0] ? pxParent->pcContentsType : "text/html",\r
- pxParent->pcExtraContents );\r
-\r
- pxParent->pcContentsType[0] = '\0';\r
- pxParent->pcExtraContents[0] = '\0';\r
-\r
- xRc = FreeRTOS_send( pxClient->xSocket, ( const void * ) pcBuffer, xRc, 0 );\r
- pxClient->bits.bReplySent = pdTRUE_UNSIGNED;\r
-\r
- return xRc;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvSendFile( HTTPClient_t *pxClient )\r
-{\r
-size_t uxSpace;\r
-size_t uxCount;\r
-BaseType_t xRc = 0;\r
-\r
- if( pxClient->bits.bReplySent == pdFALSE_UNSIGNED )\r
- {\r
- pxClient->bits.bReplySent = pdTRUE_UNSIGNED;\r
-\r
- strcpy( pxClient->pxParent->pcContentsType, pcGetContentsType( pxClient->pcCurrentFilename ) );\r
- snprintf( pxClient->pxParent->pcExtraContents, sizeof( pxClient->pxParent->pcExtraContents ),\r
- "Content-Length: %d\r\n", ( int ) pxClient->uxBytesLeft );\r
-\r
- /* "Requested file action OK". */\r
- xRc = prvSendReply( pxClient, WEB_REPLY_OK );\r
- }\r
-\r
- if( xRc >= 0 ) do\r
- {\r
- uxSpace = FreeRTOS_tx_space( pxClient->xSocket );\r
-\r
- if( pxClient->uxBytesLeft < uxSpace )\r
- {\r
- uxCount = pxClient->uxBytesLeft;\r
- }\r
- else\r
- {\r
- uxCount = uxSpace;\r
- }\r
-\r
- if( uxCount > 0u )\r
- {\r
- if( uxCount > sizeof( pxClient->pxParent->pcFileBuffer ) )\r
- {\r
- uxCount = sizeof( pxClient->pxParent->pcFileBuffer );\r
- }\r
- ff_fread( pxClient->pxParent->pcFileBuffer, 1, uxCount, pxClient->pxFileHandle );\r
- pxClient->uxBytesLeft -= uxCount;\r
-\r
- xRc = FreeRTOS_send( pxClient->xSocket, pxClient->pxParent->pcFileBuffer, uxCount, 0 );\r
- if( xRc < 0 )\r
- {\r
- break;\r
- }\r
- }\r
- } while( uxCount > 0u );\r
-\r
- if( pxClient->uxBytesLeft == 0u )\r
- {\r
- /* Writing is ready, no need for further 'eSELECT_WRITE' events. */\r
- FreeRTOS_FD_CLR( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
- prvFileClose( pxClient );\r
- }\r
- else\r
- {\r
- /* Wake up the TCP task as soon as this socket may be written to. */\r
- FreeRTOS_FD_SET( pxClient->xSocket, pxClient->pxParent->xSocketSet, eSELECT_WRITE );\r
- }\r
-\r
- return xRc;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvOpenURL( HTTPClient_t *pxClient )\r
-{\r
-BaseType_t xRc;\r
-char pcSlash[ 2 ];\r
-\r
- pxClient->bits.ulFlags = 0;\r
-\r
- #if( ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK != 0 )\r
- {\r
- if( strchr( pxClient->pcUrlData, ipconfigHTTP_REQUEST_CHARACTER ) != NULL )\r
- {\r
- size_t xResult;\r
-\r
- xResult = uxApplicationHTTPHandleRequestHook( pxClient->pcUrlData, pxClient->pcCurrentFilename, sizeof( pxClient->pcCurrentFilename ) );\r
- if( xResult > 0 )\r
- {\r
- strcpy( pxClient->pxParent->pcContentsType, "text/html" );\r
- snprintf( pxClient->pxParent->pcExtraContents, sizeof( pxClient->pxParent->pcExtraContents ),\r
- "Content-Length: %d\r\n", ( int ) xResult );\r
- xRc = prvSendReply( pxClient, WEB_REPLY_OK ); /* "Requested file action OK" */\r
- if( xRc > 0 )\r
- {\r
- xRc = FreeRTOS_send( pxClient->xSocket, pxClient->pcCurrentFilename, xResult, 0 );\r
- }\r
- /* Although against the coding standard of FreeRTOS, a return is\r
- done here to simplify this conditional code. */\r
- return xRc;\r
- }\r
- }\r
- }\r
- #endif /* ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK */\r
-\r
- if( pxClient->pcUrlData[ 0 ] != '/' )\r
- {\r
- /* Insert a slash before the file name. */\r
- pcSlash[ 0 ] = '/';\r
- pcSlash[ 1 ] = '\0';\r
- }\r
- else\r
- {\r
- /* The browser provided a starting '/' already. */\r
- pcSlash[ 0 ] = '\0';\r
- }\r
- snprintf( pxClient->pcCurrentFilename, sizeof( pxClient->pcCurrentFilename ), "%s%s%s",\r
- pxClient->pcRootDir,\r
- pcSlash,\r
- pxClient->pcUrlData);\r
-\r
- pxClient->pxFileHandle = ff_fopen( pxClient->pcCurrentFilename, "rb" );\r
-\r
- FreeRTOS_printf( ( "Open file '%s': %s\n", pxClient->pcCurrentFilename,\r
- pxClient->pxFileHandle != NULL ? "Ok" : strerror( stdioGET_ERRNO() ) ) );\r
-\r
- if( pxClient->pxFileHandle == NULL )\r
- {\r
- /* "404 File not found". */\r
- xRc = prvSendReply( pxClient, WEB_NOT_FOUND );\r
- }\r
- else\r
- {\r
- pxClient->uxBytesLeft = ( size_t ) pxClient->pxFileHandle->ulFileSize;\r
- xRc = prvSendFile( pxClient );\r
- }\r
-\r
- return xRc;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static BaseType_t prvProcessCmd( HTTPClient_t *pxClient, BaseType_t xIndex )\r
-{\r
-BaseType_t xResult = 0;\r
-\r
- /* A new command has been received. Process it. */\r
- switch( xIndex )\r
- {\r
- case ECMD_GET:\r
- xResult = prvOpenURL( pxClient );\r
- break;\r
-\r
- case ECMD_HEAD:\r
- case ECMD_POST:\r
- case ECMD_PUT:\r
- case ECMD_DELETE:\r
- case ECMD_TRACE:\r
- case ECMD_OPTIONS:\r
- case ECMD_CONNECT:\r
- case ECMD_PATCH:\r
- case ECMD_UNK:\r
- {\r
- FreeRTOS_printf( ( "prvProcessCmd: Not implemented: %s\n",\r
- xWebCommands[xIndex].pcCommandName ) );\r
- }\r
- break;\r
- }\r
-\r
- return xResult;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-BaseType_t xHTTPClientWork( TCPClient_t *pxTCPClient )\r
-{\r
-BaseType_t xRc;\r
-HTTPClient_t *pxClient = ( HTTPClient_t * ) pxTCPClient;\r
-\r
- if( pxClient->pxFileHandle != NULL )\r
- {\r
- prvSendFile( pxClient );\r
- }\r
-\r
- xRc = FreeRTOS_recv( pxClient->xSocket, ( void * )pcCOMMAND_BUFFER, sizeof( pcCOMMAND_BUFFER ), 0 );\r
-\r
- if( xRc > 0 )\r
- {\r
- BaseType_t xIndex;\r
- const char *pcEndOfCmd;\r
- const struct xWEB_COMMAND *curCmd;\r
- char *pcBuffer = pcCOMMAND_BUFFER;\r
-\r
- if( xRc < ( BaseType_t ) sizeof( pcCOMMAND_BUFFER ) )\r
- {\r
- pcBuffer[ xRc ] = '\0';\r
- }\r
- while( xRc && ( pcBuffer[ xRc - 1 ] == 13 || pcBuffer[ xRc - 1 ] == 10 ) )\r
- {\r
- pcBuffer[ --xRc ] = '\0';\r
- }\r
- pcEndOfCmd = pcBuffer + xRc;\r
-\r
- curCmd = xWebCommands;\r
-\r
- /* Pointing to "/index.html HTTP/1.1". */\r
- pxClient->pcUrlData = pcBuffer;\r
-\r
- /* Pointing to "HTTP/1.1". */\r
- pxClient->pcRestData = pcEmptyString;\r
-\r
- /* Last entry is "ECMD_UNK". */\r
- for( xIndex = 0; xIndex < WEB_CMD_COUNT - 1; xIndex++, curCmd++ )\r
- {\r
- BaseType_t xLength;\r
-\r
- xLength = curCmd->xCommandLength;\r
- if( ( xRc >= xLength ) && ( memcmp( curCmd->pcCommandName, pcBuffer, xLength ) == 0 ) )\r
- {\r
- char *pcLastPtr;\r
-\r
- pxClient->pcUrlData += xLength + 1;\r
- for( pcLastPtr = (char *)pxClient->pcUrlData; pcLastPtr < pcEndOfCmd; pcLastPtr++ )\r
- {\r
- char ch = *pcLastPtr;\r
- if( ( ch == '\0' ) || ( strchr( "\n\r \t", ch ) != NULL ) )\r
- {\r
- *pcLastPtr = '\0';\r
- pxClient->pcRestData = pcLastPtr + 1;\r
- break;\r
- }\r
- }\r
- break;\r
- }\r
- }\r
-\r
- if( xIndex < ( WEB_CMD_COUNT - 1 ) )\r
- {\r
- xRc = prvProcessCmd( pxClient, xIndex );\r
- }\r
- }\r
- else if( xRc < 0 )\r
- {\r
- /* The connection will be closed and the client will be deleted. */\r
- FreeRTOS_printf( ( "xHTTPClientWork: rc = %ld\n", xRc ) );\r
- }\r
- return xRc;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static const char *pcGetContentsType (const char *apFname)\r
-{\r
- const char *slash = NULL;\r
- const char *dot = NULL;\r
- const char *ptr;\r
- const char *pcResult = "text/html";\r
- BaseType_t x;\r
-\r
- for( ptr = apFname; *ptr; ptr++ )\r
- {\r
- if (*ptr == '.') dot = ptr;\r
- if (*ptr == '/') slash = ptr;\r
- }\r
- if( dot > slash )\r
- {\r
- dot++;\r
- for( x = 0; x < ARRAY_SIZE( pxTypeCouples ); x++ )\r
- {\r
- if( strcasecmp( dot, pxTypeCouples[ x ].pcExtension ) == 0 )\r
- {\r
- pcResult = pxTypeCouples[ x ].pcType;\r
- break;\r
- }\r
- }\r
- }\r
- return pcResult;\r
-}\r
-\r
-#endif /* ipconfigUSE_HTTP */\r
-\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-/*\r
- * NTPDemo.c\r
- *\r
- * An example of how to lookup a domain using DNS\r
- * And also how to send and receive UDP messages to get the NTP time\r
- *\r
- */\r
-\r
-/* Standard includes. */\r
-#include <stdint.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <time.h>\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "semphr.h"\r
-\r
-/* FreeRTOS+TCP includes. */\r
-#include "FreeRTOS_IP.h"\r
-#include "FreeRTOS_Sockets.h"\r
-#include "FreeRTOS_DNS.h"\r
-#include "FreeRTOS_Stream_Buffer.h"\r
-\r
-/* Use the date & time functions from +FAT. */\r
-#include "ff_time.h"\r
-\r
-#include "NTPDemo.h"\r
-#include "ntpClient.h"\r
-\r
-#include "date_and_time.h"\r
-\r
-enum EStatus {\r
- EStatusLookup,\r
- EStatusAsking,\r
- EStatusPause,\r
- EStatusFailed,\r
-};\r
-\r
-static struct SNtpPacket xNTPPacket;\r
-\r
-#if( ipconfigUSE_CALLBACKS == 0 )\r
- static char cRecvBuffer[ sizeof( struct SNtpPacket ) + 64 ];\r
-#endif\r
-\r
-static enum EStatus xStatus = EStatusLookup;\r
-\r
-static const char *pcTimeServers[] = {\r
- "0.asia.pool.ntp.org",\r
- "0.europe.pool.ntp.org",\r
- "0.id.pool.ntp.org",\r
- "0.south-america.pool.ntp.org",\r
- "0.oceania.pool.ntp.org",\r
- "0.north-america.pool.ntp.org"\r
-};\r
-\r
-static SemaphoreHandle_t xNTPWakeupSem = NULL;\r
-static uint32_t ulIPAddressFound;\r
-static Socket_t xUDPSocket = NULL;\r
-static TaskHandle_t xNTPTaskhandle = NULL;\r
-static TickType_t uxSendTime;\r
-\r
-static void prvNTPTask( void *pvParameters );\r
-\r
-static void vSignalTask( void )\r
-{\r
- #if( ipconfigUSE_CALLBACKS == 0 )\r
- if( xUDPSocket != NULL )\r
- {\r
- /* Send a signal to the socket so that the\r
- FreeRTOS_recvfrom will get interrupted. */\r
- FreeRTOS_SignalSocket( xUDPSocket );\r
- }\r
- else\r
- #endif\r
- if( xNTPWakeupSem != NULL )\r
- {\r
- xSemaphoreGive( xNTPWakeupSem );\r
- }\r
-}\r
-\r
-void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority )\r
-{\r
- /* The only public function in this module: start a task to contact\r
- some NTP server. */\r
-\r
- if( xNTPTaskhandle != NULL )\r
- {\r
- switch( xStatus )\r
- {\r
- case EStatusPause:\r
- xStatus = EStatusAsking;\r
- vSignalTask();\r
- break;\r
- case EStatusLookup:\r
- FreeRTOS_printf( ( "NTP looking up server\n" ) );\r
- break;\r
- case EStatusAsking:\r
- FreeRTOS_printf( ( "NTP still asking\n" ) );\r
- break;\r
- case EStatusFailed:\r
- FreeRTOS_printf( ( "NTP failed somehow\n" ) );\r
- ulIPAddressFound = 0ul;\r
- xStatus = EStatusLookup;\r
- vSignalTask();\r
- break;\r
- }\r
- }\r
- else\r
- {\r
- xUDPSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );\r
- if( xUDPSocket != NULL )\r
- {\r
- struct freertos_sockaddr xAddress;\r
- #if( ipconfigUSE_CALLBACKS != 0 )\r
- BaseType_t xReceiveTimeOut = pdMS_TO_TICKS( 0 );\r
- #else\r
- BaseType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );\r
- #endif\r
-\r
- xAddress.sin_addr = 0ul;\r
- xAddress.sin_port = FreeRTOS_htons( NTP_PORT );\r
-\r
- FreeRTOS_bind( xUDPSocket, &xAddress, sizeof( xAddress ) );\r
- FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );\r
- xTaskCreate( prvNTPTask, /* The function that implements the task. */\r
- ( const char * ) "NTP client", /* Just a text name for the task to aid debugging. */\r
- usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */\r
- NULL, /* The task parameter, not used in this case. */\r
- uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */\r
- &xNTPTaskhandle ); /* The task handle. */\r
- }\r
- else\r
- {\r
- FreeRTOS_printf( ( "Creating socket failed\n" ) );\r
- }\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void vDNS_callback( const char *pcName, void *pvSearchID, uint32_t ulIPAddress )\r
-{\r
-char pcBuf[16];\r
-\r
- /* The DNS lookup has a result, or it has reached the time-out. */\r
- FreeRTOS_inet_ntoa( ulIPAddress, pcBuf );\r
- FreeRTOS_printf( ( "IP address of %s found: %s\n", pcName, pcBuf ) );\r
- if( ulIPAddressFound == 0ul )\r
- {\r
- ulIPAddressFound = ulIPAddress;\r
- }\r
- /* For testing: in case DNS doen't respond, still try some NTP server\r
- with a known IP-address. */\r
- if( ulIPAddressFound == 0ul )\r
- {\r
- ulIPAddressFound = FreeRTOS_inet_addr_quick( 184, 105, 182, 7 );\r
-/* ulIPAddressFound = FreeRTOS_inet_addr_quick( 103, 242, 70, 4 ); */\r
- }\r
- xStatus = EStatusAsking;\r
-\r
- vSignalTask();\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvSwapFields( struct SNtpPacket *pxPacket)\r
-{\r
- /* NTP messages are big-endian */\r
- pxPacket->rootDelay = FreeRTOS_htonl( pxPacket->rootDelay );\r
- pxPacket->rootDispersion = FreeRTOS_htonl( pxPacket->rootDispersion );\r
-\r
- pxPacket->referenceTimestamp.seconds = FreeRTOS_htonl( pxPacket->referenceTimestamp.seconds );\r
- pxPacket->referenceTimestamp.fraction = FreeRTOS_htonl( pxPacket->referenceTimestamp.fraction );\r
-\r
- pxPacket->originateTimestamp.seconds = FreeRTOS_htonl( pxPacket->originateTimestamp.seconds );\r
- pxPacket->originateTimestamp.fraction = FreeRTOS_htonl( pxPacket->originateTimestamp.fraction );\r
-\r
- pxPacket->receiveTimestamp.seconds = FreeRTOS_htonl( pxPacket->receiveTimestamp.seconds );\r
- pxPacket->receiveTimestamp.fraction = FreeRTOS_htonl( pxPacket->receiveTimestamp.fraction );\r
-\r
- pxPacket->transmitTimestamp.seconds = FreeRTOS_htonl( pxPacket->transmitTimestamp.seconds );\r
- pxPacket->transmitTimestamp.fraction = FreeRTOS_htonl( pxPacket->transmitTimestamp.fraction );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvNTPPacketInit( )\r
-{\r
- memset (&xNTPPacket, '\0', sizeof( xNTPPacket ) );\r
-\r
- xNTPPacket.flags = 0xDB; /* value 0xDB : mode 3 (client), version 3, leap indicator unknown 3 */\r
- xNTPPacket.poll = 10; /* 10 means 1 << 10 = 1024 seconds */\r
- xNTPPacket.precision = 0xFA; /* = 250 = 0.015625 seconds */\r
- xNTPPacket.rootDelay = 0x5D2E; /* 0x5D2E = 23854 or (23854/65535)= 0.3640 sec */\r
- xNTPPacket.rootDispersion = 0x0008CAC8; /* 0x0008CAC8 = 8.7912 seconds */\r
-\r
- /* use the recorded NTP time */\r
- time_t uxSecs = FreeRTOS_time( NULL );/* apTime may be NULL, returns seconds */\r
-\r
- xNTPPacket.referenceTimestamp.seconds = uxSecs; /* Current time */\r
- xNTPPacket.transmitTimestamp.seconds = uxSecs + 3;\r
-\r
- /* Transform the contents of the fields from native to big endian. */\r
- prvSwapFields( &xNTPPacket );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvReadTime( struct SNtpPacket * pxPacket )\r
-{\r
- FF_TimeStruct_t xTimeStruct;\r
- time_t uxPreviousSeconds;\r
- time_t uxPreviousMS;\r
-\r
- time_t uxCurrentSeconds;\r
- time_t uxCurrentMS;\r
-\r
- const char *pcTimeUnit;\r
- int32_t ilDiff;\r
- TickType_t uxTravelTime;\r
-\r
- uxTravelTime = xTaskGetTickCount() - uxSendTime;\r
-\r
- /* Transform the contents of the fields from big to native endian. */\r
- prvSwapFields( pxPacket );\r
-\r
- uxCurrentSeconds = pxPacket->receiveTimestamp.seconds - TIME1970;\r
- uxCurrentMS = pxPacket->receiveTimestamp.fraction / 4294967;\r
- uxCurrentSeconds += uxCurrentMS / 1000;\r
- uxCurrentMS = uxCurrentMS % 1000;\r
-\r
- // Get the last time recorded\r
- uxPreviousSeconds = FreeRTOS_get_secs_msec( &uxPreviousMS );\r
-\r
- // Set the new time with precision in msec. */\r
- FreeRTOS_set_secs_msec( &uxCurrentSeconds, &uxCurrentMS );\r
-\r
- if( uxCurrentSeconds >= uxPreviousSeconds )\r
- {\r
- ilDiff = ( int32_t ) ( uxCurrentSeconds - uxPreviousSeconds );\r
- }\r
- else\r
- {\r
- ilDiff = 0 - ( int32_t ) ( uxPreviousSeconds - uxCurrentSeconds );\r
- }\r
-\r
- if( ( ilDiff < -5 ) || ( ilDiff > 5 ) )\r
- {\r
- /* More than 5 seconds difference. */\r
- pcTimeUnit = "sec";\r
- }\r
- else\r
- {\r
- /* Less than or equal to 5 second difference. */\r
- pcTimeUnit = "ms";\r
- uint32_t ulLowest = ( uxCurrentSeconds <= uxPreviousSeconds ) ? uxCurrentSeconds : uxPreviousSeconds;\r
- int32_t iCurMS = 1000 * ( uxCurrentSeconds - ulLowest ) + uxCurrentMS;\r
- int32_t iPrevMS = 1000 * ( uxPreviousSeconds - ulLowest ) + uxPreviousMS;\r
- ilDiff = iCurMS - iPrevMS;\r
- }\r
- uxCurrentSeconds -= iTimeZone;\r
-\r
- FreeRTOS_gmtime_r( &uxCurrentSeconds, &xTimeStruct );\r
-\r
- /*\r
- 378.067 [NTP client] NTP time: 9/11/2015 16:11:19.559 Diff -20 ms (289 ms)\r
- 379.441 [NTP client] NTP time: 9/11/2015 16:11:20.933 Diff 0 ms (263 ms)\r
- */\r
-\r
- FreeRTOS_printf( ("NTP time: %d/%d/%02d %2d:%02d:%02d.%03u Diff %d %s (%lu ms)\n",\r
- xTimeStruct.tm_mday,\r
- xTimeStruct.tm_mon + 1,\r
- xTimeStruct.tm_year + 1900,\r
- xTimeStruct.tm_hour,\r
- xTimeStruct.tm_min,\r
- xTimeStruct.tm_sec,\r
- ( unsigned )uxCurrentMS,\r
- ( unsigned )ilDiff,\r
- pcTimeUnit,\r
- uxTravelTime ) );\r
-\r
- /* Remove compiler warnings in case FreeRTOS_printf() is not used. */\r
- ( void ) pcTimeUnit;\r
- ( void ) uxTravelTime;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ipconfigUSE_CALLBACKS != 0 )\r
-\r
- static BaseType_t xOnUDPReceive( Socket_t xSocket, void * pvData, size_t xLength,\r
- const struct freertos_sockaddr *pxFrom, const struct freertos_sockaddr *pxDest )\r
- {\r
- if( xLength >= sizeof( xNTPPacket ) )\r
- {\r
- prvReadTime( ( struct SNtpPacket *)pvData );\r
- if( xStatus != EStatusPause )\r
- {\r
- xStatus = EStatusPause;\r
- }\r
- }\r
- vSignalTask();\r
- /* Tell the driver not to store the RX data */\r
- return 1;\r
- }\r
- /*-----------------------------------------------------------*/\r
-\r
-#endif /* ipconfigUSE_CALLBACKS != 0 */\r
-\r
-static void prvNTPTask( void *pvParameters )\r
-{\r
-BaseType_t xServerIndex = 3;\r
-struct freertos_sockaddr xAddress;\r
-#if( ipconfigUSE_CALLBACKS != 0 )\r
- F_TCP_UDP_Handler_t xHandler;\r
-#endif /* ipconfigUSE_CALLBACKS != 0 */\r
-\r
- xStatus = EStatusLookup;\r
- #if( ipconfigSOCKET_HAS_USER_SEMAPHORE != 0 ) || ( ipconfigUSE_CALLBACKS != 0 )\r
- {\r
- xNTPWakeupSem = xSemaphoreCreateBinary();\r
- }\r
- #endif\r
-\r
- #if( ipconfigUSE_CALLBACKS != 0 )\r
- {\r
- memset( &xHandler, '\0', sizeof( xHandler ) );\r
- xHandler.pxOnUDPReceive = xOnUDPReceive;\r
- FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_UDP_RECV_HANDLER, ( void * ) &xHandler, sizeof( xHandler ) );\r
- }\r
- #endif\r
- #if( ipconfigSOCKET_HAS_USER_SEMAPHORE != 0 )\r
- {\r
- FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_SET_SEMAPHORE, ( void * ) &xNTPWakeupSem, sizeof( xNTPWakeupSem ) );\r
- }\r
- #endif\r
- for( ; ; )\r
- {\r
- switch( xStatus )\r
- {\r
- case EStatusLookup:\r
- if( ( ulIPAddressFound == 0ul ) || ( ulIPAddressFound == ~0ul ) )\r
- {\r
- if( ++xServerIndex == sizeof( pcTimeServers ) / sizeof( pcTimeServers[ 0 ] ) )\r
- {\r
- xServerIndex = 0;\r
- }\r
- FreeRTOS_printf( ( "Looking up server '%s'\n", pcTimeServers[ xServerIndex ] ) );\r
- FreeRTOS_gethostbyname_a( pcTimeServers[ xServerIndex ], vDNS_callback, (void *)NULL, 1200 );\r
- }\r
- else\r
- {\r
- xStatus = EStatusAsking;\r
- }\r
- break;\r
-\r
- case EStatusAsking:\r
- {\r
- char pcBuf[16];\r
-\r
- prvNTPPacketInit( );\r
- xAddress.sin_addr = ulIPAddressFound;\r
- xAddress.sin_port = FreeRTOS_htons( NTP_PORT );\r
-\r
- FreeRTOS_inet_ntoa( xAddress.sin_addr, pcBuf );\r
- FreeRTOS_printf( ( "Sending UDP message to %s:%u\n",\r
- pcBuf,\r
- FreeRTOS_ntohs( xAddress.sin_port ) ) );\r
-\r
- uxSendTime = xTaskGetTickCount( );\r
- FreeRTOS_sendto( xUDPSocket, ( void * )&xNTPPacket, sizeof( xNTPPacket ), 0, &xAddress, sizeof( xAddress ) );\r
- }\r
- break;\r
-\r
- case EStatusPause:\r
- break;\r
-\r
- case EStatusFailed:\r
- break;\r
- }\r
-\r
- #if( ipconfigUSE_CALLBACKS != 0 )\r
- {\r
- xSemaphoreTake( xNTPWakeupSem, 5000 );\r
- }\r
- #else\r
- {\r
- uint32_t xAddressSize;\r
- BaseType_t xReturned;\r
-\r
- xAddressSize = sizeof( xAddress );\r
- xReturned = FreeRTOS_recvfrom( xUDPSocket, ( void * ) cRecvBuffer, sizeof( cRecvBuffer ), 0, &xAddress, &xAddressSize );\r
- switch( xReturned )\r
- {\r
- case 0:\r
- case -pdFREERTOS_ERRNO_EAGAIN:\r
- case -pdFREERTOS_ERRNO_EINTR:\r
- break;\r
- default:\r
- if( xReturned < sizeof( xNTPPacket ) )\r
- {\r
- FreeRTOS_printf( ( "FreeRTOS_recvfrom: returns %ld\n", xReturned ) );\r
- }\r
- else\r
- {\r
- prvReadTime( ( struct SNtpPacket *)cRecvBuffer );\r
- if( xStatus != EStatusPause )\r
- {\r
- xStatus = EStatusPause;\r
- }\r
- }\r
- break;\r
- }\r
- }\r
- #endif\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.1\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-#ifndef __FTPCMD_H__\r
-\r
-#define __FTPCMD_H__\r
-\r
-#define REPL_110 "110 Restart marker reply.\r\n"\r
-#define REPL_120 "120 Try again in 2 minutes.\r\n"\r
-#define REPL_125 "125 Data connection already open; transfer starting.\r\n"\r
-#define REPL_150 "150 File status okay; about to open data connection.\r\n"\r
-#define REPL_200 "200 NOOP command successful.\r\n"\r
-#define REPL_200_PROGRESS "200 NOOP: data transfer in progress.\r\n"\r
-#define REPL_202 "202 Command not implemented, superfluous at this site.\r\n"\r
-#define REPL_211 "221 System status, or system help reply.\r\n"\r
-#define REPL_211_STATUS "221-status of %s.\r\n"\r
-#define REPL_211_END "221 End of status.\r\n"\r
-#define REPL_212 "212 Directory status.\r\n"\r
-#define REPL_213 "213 File status.\r\n"\r
-#define REPL_214 "214 Help message.\r\n"\r
-#define REPL_214_END "214 End Help message.\r\n"\r
-#define REPL_215 "215 %s system type.\r\n"\r
-#define REPL_220 "220 Service ready for new user.\r\n"\r
-#define REPL_221 "221 Service closing control connection.\r\n"\r
-#define REPL_225 "225 Data connection open; no transfer in progress.\r\n"\r
-#define REPL_226 "226 Closing data connection.\r\n"\r
-#define REPL_227 "227 Entering Passive Mode (%s,%s,%s,%s,%s,%s).\r\n"\r
-#define REPL_227_D "227 Entering Passive Mode (%u,%u,%u,%u,%u,%u).\r\n"\r
-#define REPL_230 "230 User logged in, proceed.\r\n"\r
-#define REPL_250 "250 Requested file action okay, completed.\r\n"\r
-#define REPL_257 "257 %s created.\r\n"\r
-// #define REPL_257_PWD "257 \"%s\" is current working dir.\r\n"\r
-#define REPL_257_PWD "257 \"%s\"\r\n"\r
-#define REPL_331 "331 Only anonymous user is accepted.\r\n"\r
-#define REPL_331_ANON "331 Anonymous login okay\r\n"\r
-#define REPL_332 "332 Need account for login.\r\n"\r
-#define REPL_350 "350 Requested file action pending further information.\r\n"\r
-#define REPL_421 "421 Service not available, closing control connection.\r\n"\r
-#define REPL_425 "425 Can't open data connection.\r\n"\r
-#define REPL_426 "426 Connection closed; transfer aborted.\r\n"\r
-#define REPL_450 "450 Requested file action not taken.\r\n"\r
-#define REPL_451 "451 Requested action aborted. Local error in processing.\r\n"\r
-#define REPL_452 "452 Requested action not taken.\r\n"\r
-#define REPL_500 "500 Syntax error, command unrecognized.\r\n"\r
-#define REPL_501 "501 Syntax error in parameters or arguments.\r\n"\r
-#define REPL_502 "502 Command not implemented.\r\n"\r
-#define REPL_503 "503 Bad sequence of commands.\r\n"\r
-#define REPL_504 "504 Command not implemented for that parameter.\r\n"\r
-#define REPL_530 "530 Not logged in.\r\n"\r
-#define REPL_532 "532 Need account for storing files.\r\n"\r
-#define REPL_550 "550 Requested action not taken.\r\n"\r
-#define REPL_551 "551 Requested action aborted. Page type unknown.\r\n"\r
-#define REPL_552 "552 Requested file action aborted.\r\n"\r
-#define REPL_553 "553 Requested action not taken.\r\n"\r
-#define REPL_553_READ_ONLY "553 Read-only file-system.\r\n"\r
-\r
-enum EFTPCommand {\r
- ECMD_USER,\r
- ECMD_PASS,\r
- ECMD_ACCT,\r
- ECMD_CWD,\r
- ECMD_CDUP,\r
- ECMD_SMNT,\r
- ECMD_QUIT,\r
- ECMD_REIN,\r
- ECMD_PORT,\r
- ECMD_PASV,\r
- ECMD_TYPE,\r
- ECMD_STRU,\r
- ECMD_MODE,\r
- ECMD_RETR,\r
- ECMD_STOR,\r
- ECMD_STOU,\r
- ECMD_APPE,\r
- ECMD_ALLO,\r
- ECMD_REST,\r
- ECMD_RNFR,\r
- ECMD_RNTO,\r
- ECMD_ABOR,\r
- ECMD_SIZE,\r
- ECMD_MDTM,\r
- ECMD_DELE,\r
- ECMD_RMD,\r
- ECMD_MKD,\r
- ECMD_PWD,\r
- ECMD_LIST,\r
- ECMD_NLST,\r
- ECMD_SITE,\r
- ECMD_SYST,\r
- ECMD_FEAT,\r
- ECMD_STAT,\r
- ECMD_HELP,\r
- ECMD_NOOP,\r
- ECMD_EMPTY,\r
- ECMD_CLOSE,\r
- ECMD_UNKNOWN,\r
-};\r
-\r
-typedef struct xFTP_COMMAND {\r
- BaseType_t xCommandLength;\r
- const char pcCommandName[7];\r
- const unsigned char ucCommandType;\r
- const unsigned char checkLogin;\r
- const unsigned char checkNullArg;\r
-} FTPCommand_t;\r
-\r
-#define FTP_CMD_COUNT (ECMD_UNKNOWN+1)\r
-\r
-extern const FTPCommand_t xFTPCommands[ FTP_CMD_COUNT ];\r
-\r
-#endif // __FTPCMD_H__\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-#ifndef FREERTOS_HTTP_COMMANDS_H\r
-#define FREERTOS_HTTP_COMMANDS_H\r
-\r
-enum {\r
- WEB_REPLY_OK = 200,\r
- WEB_NO_CONTENT = 204,\r
- WEB_BAD_REQUEST = 400,\r
- WEB_UNAUTHORIZED = 401,\r
- WEB_NOT_FOUND = 404,\r
- WEB_GONE = 410,\r
- WEB_PRECONDITION_FAILED = 412,\r
- WEB_INTERNAL_SERVER_ERROR = 500,\r
-};\r
-\r
-enum EWebCommand {\r
- ECMD_GET,\r
- ECMD_HEAD,\r
- ECMD_POST,\r
- ECMD_PUT,\r
- ECMD_DELETE,\r
- ECMD_TRACE,\r
- ECMD_OPTIONS,\r
- ECMD_CONNECT,\r
- ECMD_PATCH,\r
- ECMD_UNK,\r
-};\r
-\r
-struct xWEB_COMMAND\r
-{\r
- BaseType_t xCommandLength;\r
- const char *pcCommandName;\r
- const unsigned char ucCommandType;\r
-};\r
-\r
-#define WEB_CMD_COUNT (ECMD_UNK+1)\r
-\r
-extern const struct xWEB_COMMAND xWebCommands[WEB_CMD_COUNT];\r
-\r
-extern const char *webCodename (int aCode);\r
-\r
-#endif /* FREERTOS_HTTP_COMMANDS_H */\r
-\r
-\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
-/*\r
- Some code which is common to TCP servers like HTTP en FTP\r
-*/\r
-\r
-#ifndef FREERTOS_TCP_SERVER_H\r
-#define FREERTOS_TCP_SERVER_H\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#ifndef FTP_SERVER_USES_RELATIVE_DIRECTORY\r
- #define FTP_SERVER_USES_RELATIVE_DIRECTORY 0\r
-#endif\r
-\r
-enum eSERVER_TYPE\r
-{\r
- eSERVER_NONE,\r
- eSERVER_HTTP,\r
- eSERVER_FTP,\r
-};\r
-\r
-struct xFTP_CLIENT;\r
-\r
-#if( ipconfigFTP_HAS_RECEIVED_HOOK != 0 )\r
- extern void vApplicationFTPReceivedHook( const char *pcFileName, uint32_t ulSize, struct xFTP_CLIENT *pxFTPClient );\r
- extern void vFTPReplyMessage( struct xFTP_CLIENT *pxFTPClient, const char *pcMessage );\r
-#endif /* ipconfigFTP_HAS_RECEIVED_HOOK != 0 */\r
-\r
-#if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )\r
- /*\r
- * Function is called when a user name has been submitted.\r
- * The function may return a string such as: "331 Please enter your password"\r
- * or return NULL to use the default reply.\r
- */\r
- extern const char *pcApplicationFTPUserHook( const char *pcUserName );\r
-#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
-\r
-#if( ipconfigFTP_HAS_USER_PASSWORD_HOOK != 0 )\r
- /*\r
- * Function is called when a password was received.\r
- * Return positive value to allow the user\r
- */\r
- extern BaseType_t xApplicationFTPPasswordHook( const char *pcUserName, const char *pcPassword );\r
-#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
-\r
-#if( ipconfigFTP_HAS_USER_PROPERTIES_HOOK != 0 )\r
- /*\r
- * The FTP server is asking for user-specific properties\r
- */\r
- typedef struct\r
- {\r
- uint16_t usPortNumber; /* For reference only. Host-endian. */\r
- const char *pcRootDir;\r
- BaseType_t xReadOnly;\r
- }\r
- FTPUserProperties_t;\r
- extern void vApplicationFTPUserPropertiesHook( const char *pcUserName, FTPUserProperties_t *pxProperties );\r
-#endif /* ipconfigFTP_HAS_USER_PASSWORD_HOOK */\r
-\r
-#if( ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK != 0 )\r
- /*\r
- * A GET request is received containing a special character,\r
- * usually a question mark.\r
- * const char *pcURLData; // A request, e.g. "/request?limit=75"\r
- * char *pcBuffer; // Here the answer can be written\r
- * size_t uxBufferLength; // Size of the buffer\r
- *\r
- */\r
- extern size_t uxApplicationHTTPHandleRequestHook( const char *pcURLData, char *pcBuffer, size_t uxBufferLength );\r
-#endif /* ipconfigHTTP_HAS_HANDLE_REQUEST_HOOK */\r
-\r
-struct xSERVER_CONFIG\r
-{\r
- enum eSERVER_TYPE eType; /* eSERVER_HTTP | eSERVER_FTP */\r
- BaseType_t xPortNumber; /* e.g. 80, 8080, 21 */\r
- BaseType_t xBackLog; /* e.g. 10, maximum number of connected TCP clients */\r
- const char * const pcRootDir; /* Treat this directory as the root directory */\r
-};\r
-\r
-struct xTCP_SERVER;\r
-typedef struct xTCP_SERVER TCPServer_t;\r
-\r
-TCPServer_t *FreeRTOS_CreateTCPServer( const struct xSERVER_CONFIG *pxConfigs, BaseType_t xCount );\r
-void FreeRTOS_TCPServerWork( TCPServer_t *pxServer, TickType_t xBlockingTime );\r
-\r
-#if( ipconfigSUPPORT_SIGNALS != 0 )\r
- /* FreeRTOS_TCPServerWork() calls select().\r
- The two functions below provide a possibility to interrupt\r
- the call to select(). After the interruption, resume\r
- by calling FreeRTOS_TCPServerWork() again. */\r
- BaseType_t FreeRTOS_TCPServerSignal( TCPServer_t *pxServer );\r
- BaseType_t FreeRTOS_TCPServerSignalFromISR( TCPServer_t *pxServer, BaseType_t *pxHigherPriorityTaskWoken );\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-} /* extern "C" */\r
-#endif\r
-\r
-#endif /* FREERTOS_TCP_SERVER_H */\r
+++ /dev/null
-/*\r
- * FreeRTOS+TCP V2.0.3\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://aws.amazon.com/freertos\r
- * http://www.FreeRTOS.org\r
- */\r
-\r
- /*\r
- Some code which is common to TCP servers like HTTP and FTP\r
-*/\r
-\r
-#ifndef FREERTOS_SERVER_PRIVATE_H\r
-#define FREERTOS_SERVER_PRIVATE_H\r
-\r
-#define FREERTOS_NO_SOCKET NULL\r
-\r
-/* FreeRTOS+FAT */\r
-#include "ff_stdio.h"\r
-\r
-/* Each HTTP server has 1, at most 2 sockets */\r
-#define HTTP_SOCKET_COUNT 2\r
-\r
-/*\r
- * ipconfigTCP_COMMAND_BUFFER_SIZE sets the size of:\r
- * pcCommandBuffer': a buffer to receive and send TCP commands\r
- *\r
- * ipconfigTCP_FILE_BUFFER_SIZE sets the size of:\r
- * pcFileBuffer' : a buffer to access the file system: read or write data.\r
- *\r
- * The buffers are both used for FTP as well as HTTP.\r
- */\r
-\r
-#ifndef ipconfigTCP_COMMAND_BUFFER_SIZE\r
- #define ipconfigTCP_COMMAND_BUFFER_SIZE ( 2048 )\r
-#endif\r
-\r
-#ifndef ipconfigTCP_FILE_BUFFER_SIZE\r
- #define ipconfigTCP_FILE_BUFFER_SIZE ( 2048 )\r
-#endif\r
-\r
-struct xTCP_CLIENT;\r
-\r
-typedef BaseType_t ( * FTCPWorkFunction ) ( struct xTCP_CLIENT * /* pxClient */ );\r
-typedef void ( * FTCPDeleteFunction ) ( struct xTCP_CLIENT * /* pxClient */ );\r
-\r
-#define TCP_CLIENT_FIELDS \\r
- enum eSERVER_TYPE eType; \\r
- struct xTCP_SERVER *pxParent; \\r
- Socket_t xSocket; \\r
- const char *pcRootDir; \\r
- FTCPWorkFunction fWorkFunction; \\r
- FTCPDeleteFunction fDeleteFunction; \\r
- struct xTCP_CLIENT *pxNextClient\r
-\r
-typedef struct xTCP_CLIENT\r
-{\r
- /* This define contains fields which must come first within each of the client structs */\r
- TCP_CLIENT_FIELDS;\r
- /* --- Keep at the top --- */\r
-\r
-} TCPClient_t;\r
-\r
-struct xHTTP_CLIENT\r
-{\r
- /* This define contains fields which must come first within each of the client structs */\r
- TCP_CLIENT_FIELDS;\r
- /* --- Keep at the top --- */\r
-\r
- const char *pcUrlData;\r
- const char *pcRestData;\r
- char pcCurrentFilename[ ffconfigMAX_FILENAME ];\r
- size_t uxBytesLeft;\r
- FF_FILE *pxFileHandle;\r
- union {\r
- struct {\r
- uint32_t\r
- bReplySent : 1;\r
- };\r
- uint32_t ulFlags;\r
- } bits;\r
-};\r
-\r
-typedef struct xHTTP_CLIENT HTTPClient_t;\r
-\r
-struct xFTP_CLIENT\r
-{\r
- /* This define contains fields which must come first within each of the client structs */\r
- TCP_CLIENT_FIELDS;\r
- /* --- Keep at the top --- */\r
-\r
- uint32_t ulRestartOffset;\r
- uint32_t ulRecvBytes;\r
- size_t uxBytesLeft; /* Bytes left to send */\r
- uint32_t ulClientIP;\r
- TickType_t xStartTime;\r
- uint16_t usClientPort;\r
- Socket_t xTransferSocket;\r
- BaseType_t xTransType;\r
- BaseType_t xDirCount;\r
- FF_FindData_t xFindData;\r
- FF_FILE *pxReadHandle;\r
- FF_FILE *pxWriteHandle;\r
- char pcCurrentDir[ ffconfigMAX_FILENAME ];\r
- char pcFileName[ ffconfigMAX_FILENAME ];\r
- char pcConnectionAck[ 128 ];\r
- char pcClientAck[ 128 ];\r
- union {\r
- struct {\r
- uint32_t\r
- bHelloSent : 1,\r
- bLoggedIn : 1,\r
- bStatusUser : 1,\r
- bInRename : 1,\r
- bReadOnly : 1;\r
- };\r
- uint32_t ulFTPFlags;\r
- } bits;\r
- union {\r
- struct {\r
- uint32_t\r
- bIsListen : 1, /* pdTRUE for passive data connections (using list()). */\r
- bDirHasEntry : 1, /* pdTRUE if ff_findfirst() was successful. */\r
- bClientConnected : 1, /* pdTRUE after connect() or accept() has succeeded. */\r
- bEmptyFile : 1, /* pdTRUE if a connection-without-data was received. */\r
- bHadError : 1; /* pdTRUE if a transfer got aborted because of an error. */\r
- };\r
- uint32_t ulConnFlags;\r
- } bits1;\r
-};\r
-\r
-typedef struct xFTP_CLIENT FTPClient_t;\r
-\r
-BaseType_t xHTTPClientWork( TCPClient_t *pxClient );\r
-BaseType_t xFTPClientWork( TCPClient_t *pxClient );\r
-\r
-void vHTTPClientDelete( TCPClient_t *pxClient );\r
-void vFTPClientDelete( TCPClient_t *pxClient );\r
-\r
-BaseType_t xMakeAbsolute( struct xFTP_CLIENT *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName );\r
-BaseType_t xMakeRelative( FTPClient_t *pxClient, char *pcBuffer, BaseType_t xBufferLength, const char *pcFileName );\r
-\r
-struct xTCP_SERVER\r
-{\r
- SocketSet_t xSocketSet;\r
- /* A buffer to receive and send TCP commands, either HTTP of FTP. */\r
- char pcCommandBuffer[ ipconfigTCP_COMMAND_BUFFER_SIZE ];\r
- /* A buffer to access the file system: read or write data. */\r
- char pcFileBuffer[ ipconfigTCP_FILE_BUFFER_SIZE ];\r
-\r
- #if( ipconfigUSE_FTP != 0 )\r
- char pcNewDir[ ffconfigMAX_FILENAME ];\r
- #endif\r
- #if( ipconfigUSE_HTTP != 0 )\r
- char pcContentsType[40]; /* Space for the msg: "text/javascript" */\r
- char pcExtraContents[40]; /* Space for the msg: "Content-Length: 346500" */\r
- #endif\r
- BaseType_t xServerCount;\r
- TCPClient_t *pxClients;\r
- struct xSERVER\r
- {\r
- enum eSERVER_TYPE eType; /* eSERVER_HTTP | eSERVER_FTP */\r
- const char *pcRootDir;\r
- Socket_t xSocket;\r
- } xServers[ 1 ];\r
-};\r
-\r
-#endif /* FREERTOS_SERVER_PRIVATE_H */\r
+++ /dev/null
-//\r
-// ntpClient.h\r
-//\r
-\r
-#ifndef __NTPCLIENT_H__\r
-\r
-#define __NTPCLIENT_H__\r
-\r
-#define NTP_PORT 123\r
-\r
-typedef uint32_t quint32;\r
-typedef int32_t qint32;\r
-typedef uint8_t quint8;\r
-typedef int8_t qint8;\r
-\r
-typedef union _SNtpFlags SNtpFlags;\r
-\r
-/**\r
- * 64-bit NTP timestamp.\r
- */\r
-struct __attribute__ ((__packed__)) _SNtpTimestamp {\r
- /** Number of seconds passed since Jan 1 1900, in big-endian format. */\r
- quint32 seconds;\r
-\r
- /** Fractional time part, in <tt>1/0xFFFFFFFF</tt>s of a second. */\r
- quint32 fraction;\r
-};\r
-\r
-typedef struct _SNtpTimestamp SNtpTimestamp;\r
-/**\r
- * Mandatory part of an NTP packet\r
- */\r
-struct SNtpPacket {\r
- /** Flags. */\r
- unsigned char flags; // value 0xDB : mode 3 (client), version 3, leap indicator unknown 3\r
-\r
- /** Stratum of the clock. */\r
- quint8 stratum; // value 0 : unspecified\r
-\r
- /** Maximum interval between successive messages, in log2 seconds. Note that the value is signed. */\r
- qint8 poll; // 10 means 1 << 10 = 1024 seconds\r
-\r
- /** Precision of the clock, in log2 seconds. Note that the value is signed. */\r
- qint8 precision; // 0xFA = 250 = 0.015625 seconds\r
-\r
- /** Round trip time to the primary reference source, in NTP short format. */\r
- qint32 rootDelay; // 0x5D2E = 23854 or (23854/65535)= 0.3640 sec\r
-\r
- /** Nominal error relative to the primary reference source. */\r
- qint32 rootDispersion; // 0x0008 CAC8 = 8.7912 seconds\r
-\r
- /** Reference identifier (either a 4 character string or an IP address). */\r
- qint8 referenceID[4]; // or just 0000\r
-\r
- /** The time at which the clock was last set or corrected. */\r
- SNtpTimestamp referenceTimestamp; // Current time\r
-\r
- /** The time at which the request departed the client for the server. */\r
- SNtpTimestamp originateTimestamp; // Keep 0\r
-\r
- /** The time at which the request arrived at the server. */\r
- SNtpTimestamp receiveTimestamp; // Keep 0\r
-\r
- /** The time at which the reply departed the server for client. */\r
- SNtpTimestamp transmitTimestamp;\r
-};\r
-\r
-/* Add this number to get secs since 1-1-1900 */\r
-#define TIME1970 2208988800UL\r
-\r
-#endif // __NTPCLIENT_H__\r
+++ /dev/null
-/*\r
- * A simple demo for NTP using FreeRTOS+TCP\r
- */\r
-\r
-#ifndef NTPDEMO_H\r
-\r
-#define NTPDEMO_H\r
-\r
-void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );\r
-\r
-#endif
\ No newline at end of file
<name>General</name>\r
<archiveVersion>3</archiveVersion>\r
<data>\r
- <version>29</version>\r
+ <version>30</version>\r
<wantNonLocal>1</wantNonLocal>\r
<debug>1</debug>\r
<option>\r
</option>\r
<option>\r
<name>Output description</name>\r
- <state>No specifier a, A, no specifier n, no float nor long long, no flags.</state>\r
+ <state>No specifier a, A, no specifier n, no float nor long long, no flags, without multibyte support.</state>\r
</option>\r
<option>\r
<name>GOutputBinary</name>\r
</option>\r
<option>\r
<name>OGLastSavedByProductVersion</name>\r
- <state>8.20.1.14181</state>\r
+ <state>8.22.1.15696</state>\r
</option>\r
<option>\r
<name>GeneralEnableMisra</name>\r
<name>DSPExtension</name>\r
<state>0</state>\r
</option>\r
+ <option>\r
+ <name>TrustZone</name>\r
+ <state>1</state>\r
+ </option>\r
</data>\r
</settings>\r
<settings>\r
<option>\r
<name>AUserIncludes</name>\r
<state>$PROJ_DIR$/.</state>\r
+ <state>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC</state>\r
</option>\r
<option>\r
<name>AExtraOptionsCheckV2</name>\r
\r
@echo on \r
\r
-"C:\devtools\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\temp\rc\FreeRTOSv10.0.0\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.general.xcl" --backend -f "C:\temp\rc\FreeRTOSv10.0.0\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.driver.xcl" \r
+"C:\devtools\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.general.xcl" --backend -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.driver.xcl" \r
\r
@echo off \r
goto end \r
\r
@echo on \r
\r
-"C:\devtools\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\temp\rc\FreeRTOSv10.0.0\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.general.xcl" "--debug_file=%~1" --backend -f "C:\temp\rc\FreeRTOSv10.0.0\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.driver.xcl" \r
+"C:\devtools\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.general.xcl" "--debug_file=%~1" --backend -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\settings\RTOSDemo.sram.driver.xcl" \r
\r
@echo off \r
:end
\ No newline at end of file
\r
"-p" \r
\r
-"C:\devtools\IAR Systems\Embedded Workbench 8.0\arm\CONFIG\debugger\Atmel\ATSAMA5D27.ddf" \r
+"C:\devtools\IAR Systems\Embedded Workbench 8.0\arm\CONFIG\debugger\Microchip\ATSAMA5D27.ddf" \r
\r
"--drv_verify_download" \r
\r
\r
"C:\devtools\IAR Systems\Embedded Workbench 8.0\arm\bin\armJET.dll" \r
\r
-"C:\temp\rc\FreeRTOSv10.0.0\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\sram\bin\sram.out" \r
+"C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\sram\bin\sram.out" \r
\r
--plugin "C:\devtools\IAR Systems\Embedded Workbench 8.0\arm\bin\armbat.dll" \r
\r
---device_macro "C:\devtools\IAR Systems\Embedded Workbench 8.0\arm\config\debugger\Atmel\SAMA5D2.dmac" \r
+--device_macro "C:\devtools\IAR Systems\Embedded Workbench 8.0\arm\config\debugger\Microchip\SAMA5D2.dmac" \r
\r
---macro "C:\temp\rc\FreeRTOSv10.0.0\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\AtmelFiles\target\sama5d2\toolchain\iar\sram.mac" \r
+--macro "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D2x_Xplained_IAR\AtmelFiles\target\sama5d2\toolchain\iar\sram.mac" \r
\r
\r
\r
<ColumnWidth0>21</ColumnWidth0>\r
<ColumnWidth1>1862</ColumnWidth1>\r
<FilterLevel>2</FilterLevel>\r
- <LiveFile></LiveFile>\r
+ <LiveFile />\r
<LiveLogEnabled>0</LiveLogEnabled>\r
<LiveFilterLevel>-1</LiveFilterLevel>\r
</IarPane-34056>\r
</IarPane-34063>\r
<ControlBarVersion>\r
<Major>14</Major>\r
- <Minor>10</Minor>\r
+ <Minor>11</Minor>\r
</ControlBarVersion>\r
<MFCToolBarParameters>\r
<Tooltips>1</Tooltips>\r
<CommandsUsage>000000000000</CommandsUsage>\r
</MFCToolBarParameters>\r
<CommandManager>\r
- <CommandsWithoutImages>060020F1000010F0000000F0000020F0000030F0000060F00000</CommandsWithoutImages>\r
- <MenuUserImages>0000</MenuUserImages>\r
+ <CommandsWithoutImages>110020F1000010F0000000F0000020F0000030F0000060F000000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000D48400000E84000030840000</CommandsWithoutImages>\r
+ <MenuUserImages>02000B8100001C0000000D8100001E000000</MenuUserImages>\r
</CommandManager>\r
<Pane-59393>\r
<ID>0</ID>\r
<IarPane-34050 />\r
<Pane--1>\r
<ID>4294967295</ID>\r
- <RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
- <RectRecentDocked>00000000390000001801000044020000</RectRecentDocked>\r
+ <RectRecentFloat>00000000730000001801000061020000</RectRecentFloat>\r
+ <RectRecentDocked>00000000560000001801000044020000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34053>\r
<ID>34053</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>00000000650200008007000023030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000690200007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34057>\r
<ID>34057</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>04000000690200007C07000003030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000690200007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34058>\r
<ID>34058</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>04000000690200007C07000003030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000690200007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34059>\r
<ID>34059</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>04000000690200007C07000003030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000690200007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34060>\r
<ID>34060</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>04000000690200007C07000003030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000690200007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34062>\r
<ID>34062</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>04000000690200007C07000003030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000690200007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34061>\r
<ID>34061</ID>\r
<RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
- <RectRecentDocked>040000005A00000014010000D0010000</RectRecentDocked>\r
+ <RectRecentDocked>04000000770000001401000024020000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<BasePane-34061>\r
<IsVisible>0</IsVisible>\r
</BasePane-34061>\r
- <IarPane-34061 />\r
+ <IarPane-34061>\r
+ <TypeFilter>2147483647</TypeFilter>\r
+ <FileFilter>1</FileFilter>\r
+ </IarPane-34061>\r
<Pane-34063>\r
<ID>34063</ID>\r
<RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
- <RectRecentDocked>00000000560000001801000044020000</RectRecentDocked>\r
+ <RectRecentDocked>00000000730000001801000044020000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<IsVisible>1</IsVisible>\r
</BasePane-34063>\r
<DockingManager-256>\r
- <DockingPaneAndPaneDividers>000000000C000000000000000010000001000000FFFFFFFFFFFFFFFF18010000390000001C01000044020000010000000200001004000000010000000000000000000000FFFFFFFF020000000D8500000F850000FFFF02000B004354616262656450616E650010000001000000000000001D00000018010000D401000000000000390000001801000044020000000000004010005602000000FFFEFF0E53006F0075007200630065002000420072006F007700730065007200000000000D85000001000000FFFFFFFFFFFFFFFFFFFEFF0957006F0072006B0073007000610063006500010000000F85000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0D85000001000000FFFFFFFF0D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF000000004402000080070000480200000100000001000010040000000100000041FDFFFF8B000000FFFFFFFF08000000038500000585000008850000098500000A8500000B8500000C8500000E85000001800080000001000000000000001D00000036010000F8000000000000004802000080070000DC030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF0E43004D005300490053002D005000610063006B0020004C006F006700000000000585000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000</DockingPaneAndPaneDividers>\r
+ <DockingPaneAndPaneDividers>000000000C000000000000000010000001000000FFFFFFFFFFFFFFFF18010000560000001C01000044020000010000000200001004000000010000000000000000000000FFFFFFFF020000000D8500000F850000FFFF02000B004354616262656450616E6500100000010000000000000073000000180100006102000000000000560000001801000044020000000000004010005602000000FFFEFF1C53006F0075007200630065002000420072006F00770073006500720020002D0020004E006F007400200065006E00610062006C0065006400000000000D85000001000000FFFFFFFFFFFFFFFFFFFEFF0957006F0072006B0073007000610063006500010000000F85000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0D85000001000000FFFFFFFF0D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF000000004402000080070000480200000100000001000010040000000100000041FDFFFF8B000000FFFFFFFF08000000038500000585000008850000098500000A8500000B8500000C8500000E85000001800080000001000000000000006502000080070000F9030000000000004802000080070000DC030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF0E43004D005300490053002D005000610063006B0020004C006F006700000000000585000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000</DockingPaneAndPaneDividers>\r
</DockingManager-256>\r
<MFCToolBar-34048>\r
<Name>CMSIS-Pack</Name>\r
- <Buttons>00200000010000000200FFFF01001100434D4643546F6F6C426172427574746F6ED0840000000004000C000000FFFEFF0000000000000000000000000001000000010000000180D1840000000000000D000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B00FF7F0000</Buttons>\r
+ <Buttons>00200000010000000200FFFF01001100434D4643546F6F6C426172427574746F6ED0840000000004000C000000FFFEFF0000000000000000000000000001000000010000000180D1840000000000000D000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B002F000000</Buttons>\r
</MFCToolBar-34048>\r
<Pane-34048>\r
<ID>34048</ID>\r
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
- <RectRecentDocked>000300001C0000004703000038000000</RectRecentDocked>\r
+ <RectRecentDocked>000300001D0000004703000039000000</RectRecentDocked>\r
<RecentFrameAlignment>8192</RecentFrameAlignment>\r
<RecentRowIndex>1</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
- <MRUWidth>32767</MRUWidth>\r
+ <MRUWidth>47</MRUWidth>\r
<PinState>0</PinState>\r
</Pane-34048>\r
<BasePane-34048>\r
</BasePane-34048>\r
<MFCToolBar-34049>\r
<Name>Main</Name>\r
- <Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000036000000FFFEFF000000000000000000000000000100000001000000018001E100000000000037000000FFFEFF000000000000000000000000000100000001000000018003E100000000040039000000FFFEFF000000000000000000000000000100000001000000018000810000000000001A000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018025E100000000040040000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040043000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040044000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002D000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003F000000FFFEFF000000000000000000000000000100000001000000018028E100000000040041000000FFFEFF000000000000000000000000000100000001000000018029E100000000040042000000FFFEFF000000000000000000000000000100000001000000018002810000000004001C000000FFFEFF0000000000000000000000000001000000010000000180298100000000040031000000FFFEFF000000000000000000000000000100000001000000018027810000000004002F000000FFFEFF0000000000000000000000000001000000010000000180288100000000040030000000FFFEFF00000000000000000000000000010000000100000001801D8100000000000029000000FFFEFF00000000000000000000000000010000000100000001801E810000000004002A000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B8100000000040020000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000021000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000035000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000023000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000024000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF7F0000</Buttons>\r
+ <Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000032000000FFFEFF000000000000000000000000000100000001000000018001E100000000000033000000FFFEFF000000000000000000000000000100000001000000018003E100000000040035000000FFFEFF0000000000000000000000000001000000010000000180008100000000000016000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000040038000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003A000000FFFEFF000000000000000000000000000100000001000000018022E100000000040039000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE10000000004003F000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040040000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF00960000000000000000000180218100000000040029000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003B000000FFFEFF000000000000000000000000000100000001000000018028E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018029E10000000004003E000000FFFEFF0000000000000000000000000001000000010000000180028100000000040018000000FFFEFF000000000000000000000000000100000001000000018029810000000004002D000000FFFEFF000000000000000000000000000100000001000000018027810000000004002B000000FFFEFF000000000000000000000000000100000001000000018028810000000004002C000000FFFEFF00000000000000000000000000010000000100000001801D8100000000000025000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040026000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001C000000FFFEFF00000000000000000000000000010000000100000001800C810000000000001D000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000031000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E810000000000001F000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000020000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>\r
</MFCToolBar-34049>\r
<Pane-34049>\r
<ID>34049</ID>\r
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
- <RectRecentDocked>000000001C0000000003000039000000</RectRecentDocked>\r
+ <RectRecentDocked>000000001D000000000300003A000000</RectRecentDocked>\r
<RecentFrameAlignment>8192</RecentFrameAlignment>\r
<RecentRowIndex>1</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
- <MRUWidth>32767</MRUWidth>\r
+ <MRUWidth>744</MRUWidth>\r
<PinState>0</PinState>\r
</Pane-34049>\r
<BasePane-34049>\r
</Desktop>\r
<MDIWindows>\r
<MDIClientArea-0>\r
- <MDITabsState>01000000030000000100000000000000000000000100000001000000FFFFFFFF00000000010000000100000000000000280000002800000001000000030000000200000001000000FFFEFF242400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C006500760065006E0074005F00670072006F007500700073002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF28013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003200320038003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0039003000300035003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0039003000320035003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0E6500760065006E0074005F00670072006F007500700073002E00630000000000FFFFFFFFFFFFFFFFFFFEFF282400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C0069006E0063006C007500640065005C004600720065006500520054004F0053002E006800010000000180FFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003700310030003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00320031003400320034003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00320031003400330033003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0A4600720065006500520054004F0053002E00680000000000FFFFFFFFFFFFFFFFFFFEFF3D2400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C0070006F0072007400610062006C0065005C004900410052005C00410052004D005F004300410035005F004E006F005F004700490043005C0070006F00720074006D006100630072006F002E006800010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00380031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0033003200330030003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0033003200330030003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0B70006F00720074006D006100630072006F002E00680000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000001C010000560000008007000061020000</MDITabsState>\r
+ <MDITabsState>010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000040000000300000001000000FFFEFF242400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C006500760065006E0074005F00670072006F007500700073002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF28013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003200320038003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0039003000300035003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0039003000320035003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0E6500760065006E0074005F00670072006F007500700073002E00630000000000FFFFFFFFFFFFFFFFFFFEFF282400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C0069006E0063006C007500640065005C004600720065006500520054004F0053002E006800010000000180FFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003700310030003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00320031003400320034003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00320031003400330033003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0A4600720065006500520054004F0053002E00680000000000FFFFFFFFFFFFFFFFFFFEFF3D2400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C0070006F0072007400610062006C0065005C004900410052005C00410052004D005F004300410035005F004E006F005F004700490043005C0070006F00720074006D006100630072006F002E006800010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00380031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0033003200330030003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0033003200330030003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0B70006F00720074006D006100630072006F002E00680000000000FFFFFFFFFFFFFFFFFFFEFF3B2400570053005F0044004900520024005C002E002E005C002E002E005C0053006F0075007200630065005C0070006F0072007400610062006C0065005C004900410052005C00410052004D005F004300410035005F004E006F005F004700490043005C0070006F0072007400410053004D002E007300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00320030003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0031003300370036003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0031003300370036003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0970006F0072007400410053004D002E00730000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000001C010000730000008007000061020000</MDITabsState>\r
</MDIClientArea-0>\r
</MDIWindows>\r
</WindowStorage>\r
-<?xml version="1.0" encoding="iso-8859-1"?>\r
-\r
+<?xml version="1.0" encoding="UTF-8"?>\r
<project>\r
- <fileVersion>2</fileVersion>\r
- <configuration>\r
- <name>sram</name>\r
- <toolchain>\r
- <name>ARM</name>\r
- </toolchain>\r
- <debug>1</debug>\r
- <settings>\r
- <name>C-SPY</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>26</version>\r
- <wantNonLocal>1</wantNonLocal>\r
+ <fileVersion>3</fileVersion>\r
+ <configuration>\r
+ <name>sram</name>\r
+ <toolchain>\r
+ <name>ARM</name>\r
+ </toolchain>\r
<debug>1</debug>\r
- <option>\r
- <name>FlashLoadersV3</name>\r
- <state>$TOOLKIT_DIR$\config\flashloader\</state>\r
- </option>\r
- <option>\r
- <name>CInput</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CEndian</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CProcessor</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCVariant</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>MacOverride</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>MacFile</name>\r
- <state>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\resources\ewarm\sama5d3x-ek-sram.mac</state>\r
- </option>\r
- <option>\r
- <name>MemOverride</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>MemFile</name>\r
- <state>$TOOLKIT_DIR$\CONFIG\debugger\Atmel\ATSAMA5D35.ddf</state>\r
- </option>\r
- <option>\r
- <name>RunToEnable</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RunToName</name>\r
- <state>main</state>\r
- </option>\r
- <option>\r
- <name>CExtraOptionsCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CExtraOptions</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CFpuProcessor</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCDDFArgumentProducer</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCDownloadSuppressDownload</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCDownloadVerifyAll</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCProductVersion</name>\r
- <state>5.50.0.51907</state>\r
- </option>\r
- <option>\r
- <name>OCDynDriverList</name>\r
- <state>JLINK_ID</state>\r
- </option>\r
- <option>\r
- <name>OCLastSavedByProductVersion</name>\r
- <state>7.20.2.7418</state>\r
- </option>\r
- <option>\r
- <name>OCDownloadAttachToProgram</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>UseFlashLoader</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CLowLevel</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCBE8Slave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>MacFile2</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CDevice</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCImagesSuppressCheck1</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCImagesPath1</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCImagesSuppressCheck2</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCImagesPath2</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCImagesSuppressCheck3</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCImagesPath3</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OverrideDefFlashBoard</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCImagesOffset1</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCImagesOffset2</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCImagesOffset3</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCImagesUse1</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCImagesUse2</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCImagesUse3</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCDeviceConfigMacroFile</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCDebuggerExtraOption</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCAllMTBOptions</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCMulticoreNrOfCores</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCMulticoreMaster</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCMulticorePort</name>\r
- <state>53461</state>\r
- </option>\r
- <option>\r
- <name>OCMulticoreWorkspace</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCMulticoreSlaveProject</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCMulticoreSlaveConfiguration</name>\r
- <state></state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>ARMSIM_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>1</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCSimDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCSimEnablePSP</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCSimPspOverrideConfig</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCSimPspConfigFile</name>\r
- <state></state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>ANGEL_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>0</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>CCAngelHeartbeat</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CAngelCommunication</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CAngelCommBaud</name>\r
- <version>0</version>\r
- <state>3</state>\r
- </option>\r
- <option>\r
- <name>CAngelCommPort</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>ANGELTCPIP</name>\r
- <state>aaa.bbb.ccc.ddd</state>\r
- </option>\r
- <option>\r
- <name>DoAngelLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AngelLogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>CMSISDAP_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>2</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPAttachSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCIarProbeScriptFile</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPResetList</name>\r
- <version>1</version>\r
- <state>10</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPHWResetDuration</name>\r
- <state>300</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPHWResetDelay</name>\r
- <state>200</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPDoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPLogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPMultiTargetEnable</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPMultiTarget</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPJtagSpeedList</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPBreakpointRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPRestoreBreakpointsCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPUpdateBreakpointsEdit</name>\r
- <state>_call_main</state>\r
- </option>\r
- <option>\r
- <name>RDICatchReset</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>RDICatchUndef</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RDICatchSWI</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>RDICatchData</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RDICatchPrefetch</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RDICatchIRQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>RDICatchFIQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CatchCORERESET</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CatchMMERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchNOCPERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchCHKERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchSTATERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchBUSERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchINTERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchHARDERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchDummy</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPMultiCPUEnable</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPMultiCPUNumber</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCProbeCfgOverride</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCProbeConfig</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPProbeConfigRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CMSISDAPSelectedCPUBehaviour</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>ICpuName</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCJetEmuParams</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>GDBSERVER_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>0</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>TCPIP</name>\r
- <state>aaa.bbb.ccc.ddd</state>\r
- </option>\r
- <option>\r
- <name>DoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>LogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CCJTagBreakpointRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJTagDoUpdateBreakpoints</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJTagUpdateBreakpoints</name>\r
- <state>main</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>IARROM_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>1</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>CRomLogFileCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CRomLogFileEditB</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CRomCommPort</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CRomCommBaud</name>\r
- <version>0</version>\r
- <state>7</state>\r
- </option>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>IJET_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>3</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IjetAttachSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCIarProbeScriptFile</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IjetResetList</name>\r
- <version>1</version>\r
- <state>10</state>\r
- </option>\r
- <option>\r
- <name>IjetHWResetDuration</name>\r
- <state>300</state>\r
- </option>\r
- <option>\r
- <name>IjetHWResetDelay</name>\r
- <state>200</state>\r
- </option>\r
- <option>\r
- <name>IjetPowerFromProbe</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IjetPowerRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetDoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetLogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>IjetInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetMultiTargetEnable</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetMultiTarget</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetScanChainNonARMDevices</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetIRLength</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetJtagSpeedList</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetProtocolRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetSwoPin</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetCpuClockEdit</name>\r
- <state>72.0</state>\r
- </option>\r
- <option>\r
- <name>IjetSwoPrescalerList</name>\r
- <version>1</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetBreakpointRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetRestoreBreakpointsCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetUpdateBreakpointsEdit</name>\r
- <state>_call_main</state>\r
- </option>\r
- <option>\r
- <name>RDICatchReset</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>RDICatchUndef</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RDICatchSWI</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>RDICatchData</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RDICatchPrefetch</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RDICatchIRQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>RDICatchFIQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CatchCORERESET</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CatchMMERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchNOCPERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchCHKERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchSTATERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchBUSERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchINTERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchHARDERR</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CatchDummy</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCProbeCfgOverride</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCProbeConfig</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IjetProbeConfigRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetMultiCPUEnable</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetMultiCPUNumber</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IjetSelectedCPUBehaviour</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>ICpuName</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OCJetEmuParams</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>JLINK_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>15</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>JLinkSpeed</name>\r
- <state>32</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkDoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkLogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkHWResetDelay</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>JLinkInitialSpeed</name>\r
- <state>32</state>\r
- </option>\r
- <option>\r
- <name>CCDoJlinkMultiTarget</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCScanChainNonARMDevices</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkMultiTarget</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkIRLength</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkCommRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkTCPIP</name>\r
- <state>aaa.bbb.ccc.ddd</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkSpeedRadioV2</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCUSBDevice</name>\r
- <version>1</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchReset</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchUndef</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchSWI</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchData</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchPrefetch</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchIRQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchFIQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkBreakpointRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkDoUpdateBreakpoints</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkUpdateBreakpoints</name>\r
- <state>main</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCJLinkAttachSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkResetList</name>\r
- <version>6</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchCORERESET</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchMMERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchNOCPERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchCHRERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchSTATERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchBUSERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchINTERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchHARDERR</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCatchDummy</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCJLinkScriptFile</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkUsbSerialNo</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCTcpIpAlt</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJLinkTcpIpSerialNo</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCCpuClockEdit</name>\r
- <state>72.0</state>\r
- </option>\r
- <option>\r
- <name>CCSwoClockAuto</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSwoClockEdit</name>\r
- <state>2000</state>\r
- </option>\r
- <option>\r
- <name>OCJLinkTraceSource</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCJLinkTraceSourceDummy</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCJLinkDeviceName</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>LMIFTDI_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>2</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>LmiftdiSpeed</name>\r
- <state>500</state>\r
- </option>\r
- <option>\r
- <name>CCLmiftdiDoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCLmiftdiLogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CCLmiFtdiInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCLmiFtdiInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>MACRAIGOR_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>3</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>jtag</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>EmuSpeed</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>TCPIP</name>\r
- <state>aaa.bbb.ccc.ddd</state>\r
- </option>\r
- <option>\r
- <name>DoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>LogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>DoEmuMultiTarget</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>EmuMultiTarget</name>\r
- <state>0@ARM7TDMI</state>\r
- </option>\r
- <option>\r
- <name>EmuHWReset</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CEmuCommBaud</name>\r
- <version>0</version>\r
- <state>4</state>\r
- </option>\r
- <option>\r
- <name>CEmuCommPort</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>jtago</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>UnusedAddr</name>\r
- <state>0x00800000</state>\r
- </option>\r
- <option>\r
- <name>CCMacraigorHWResetDelay</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCJTagBreakpointRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJTagDoUpdateBreakpoints</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJTagUpdateBreakpoints</name>\r
- <state>main</state>\r
- </option>\r
- <option>\r
- <name>CCMacraigorInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCMacraigorInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>PEMICRO_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>1</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCPEMicroAttachSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroInterfaceList</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroResetDelay</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroJtagSpeed</name>\r
- <state>#UNINITIALIZED#</state>\r
- </option>\r
- <option>\r
- <name>CCJPEMicroShowSettings</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>DoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>LogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroUSBDevice</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroSerialPort</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCJPEMicroTCPIPAutoScanNetwork</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroTCPIP</name>\r
- <state>10.0.0.1</state>\r
- </option>\r
- <option>\r
- <name>CCPEMicroCommCmdLineProducer</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSTLinkInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSTLinkInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>RDI_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>2</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>CRDIDriverDll</name>\r
- <state>###Uninitialized###</state>\r
- </option>\r
- <option>\r
- <name>CRDILogFileCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CRDILogFileEdit</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>CCRDIHWReset</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchReset</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchUndef</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchSWI</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchData</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchPrefetch</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchIRQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCRDICatchFIQ</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>STLINK_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>2</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCSTLinkInterfaceRadio</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSTLinkInterfaceCmdLine</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSTLinkResetList</name>\r
- <version>1</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCpuClockEdit</name>\r
- <state>72.0</state>\r
- </option>\r
- <option>\r
- <name>CCSwoClockAuto</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSwoClockEdit</name>\r
- <state>2000</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>THIRDPARTY_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>0</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>CThirdPartyDriverDll</name>\r
- <state>###Uninitialized###</state>\r
- </option>\r
- <option>\r
- <name>CThirdPartyLogFileCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CThirdPartyLogFileEditB</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>XDS100_ID</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>2</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OCDriverInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OCXDS100AttachSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>TIPackageOverride</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>TIPackage</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCXds100InterfaceList</name>\r
- <version>2</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>BoardFile</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>DoLogfile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>LogFile</name>\r
- <state>$PROJ_DIR$\cspycomm.log</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <debuggerPlugins>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>\r
- <loadFlag>1</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>\r
- <loadFlag>1</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>\r
- <loadFlag>1</loadFlag>\r
- </plugin>\r
- <plugin>\r
- <file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
- </plugin>\r
- </debuggerPlugins>\r
- </configuration>\r
+ <settings>\r
+ <name>C-SPY</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>29</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>FlashLoadersV3</name>\r
+ <state>$TOOLKIT_DIR$\config\flashloader\</state>\r
+ </option>\r
+ <option>\r
+ <name>CInput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CEndian</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCVariant</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacOverride</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacFile</name>\r
+ <state>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\resources\ewarm\sama5d3x-ek-sram.mac</state>\r
+ </option>\r
+ <option>\r
+ <name>MemOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MemFile</name>\r
+ <state>$TOOLKIT_DIR$\CONFIG\debugger\Microchip\ATSAMA5D35.ddf</state>\r
+ </option>\r
+ <option>\r
+ <name>RunToEnable</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RunToName</name>\r
+ <state>main</state>\r
+ </option>\r
+ <option>\r
+ <name>CExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDDFArgumentProducer</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadSuppressDownload</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadVerifyAll</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProductVersion</name>\r
+ <state>5.50.0.51907</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDynDriverList</name>\r
+ <state>JLINK_ID</state>\r
+ </option>\r
+ <option>\r
+ <name>OCLastSavedByProductVersion</name>\r
+ <state>8.22.1.15696</state>\r
+ </option>\r
+ <option>\r
+ <name>UseFlashLoader</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CLowLevel</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCBE8Slave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacFile2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CDevice</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesSuppressCheck1</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesPath1</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesSuppressCheck2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesPath2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesSuppressCheck3</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesPath3</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OverrideDefFlashBoard</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesOffset1</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesOffset2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesOffset3</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesUse1</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesUse2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCImagesUse3</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDeviceConfigMacroFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDebuggerExtraOption</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCAllMTBOptions</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCMulticoreNrOfCores</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCMulticoreMaster</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCMulticorePort</name>\r
+ <state>53461</state>\r
+ </option>\r
+ <option>\r
+ <name>OCMulticoreWorkspace</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCMulticoreSlaveProject</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCMulticoreSlaveConfiguration</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadExtraImage</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCAttachSlave</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MassEraseBeforeFlashing</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ARMSIM_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>1</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCSimDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCSimEnablePSP</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCSimPspOverrideConfig</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCSimPspConfigFile</name>\r
+ <state></state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>CADI_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCadiMemory</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>Fast Model</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCADILogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCADILogFileEditB</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>CMSISDAP_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>4</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CatchSFERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCIarProbeScriptFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPResetList</name>\r
+ <version>1</version>\r
+ <state>10</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPHWResetDuration</name>\r
+ <state>300</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPHWResetDelay</name>\r
+ <state>200</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPLogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPInterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPInterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPMultiTargetEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPJtagSpeedList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPBreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPRestoreBreakpointsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPUpdateBreakpointsEdit</name>\r
+ <state>_call_main</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchUndef</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchData</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchPrefetch</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchCORERESET</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchMMERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchNOCPERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchCHKERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchSTATERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchBUSERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchINTERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchHARDERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchDummy</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPMultiCPUEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPMultiCPUNumber</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProbeCfgOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProbeConfig</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPProbeConfigRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CMSISDAPSelectedCPUBehaviour</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ICpuName</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCJetEmuParams</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCMSISDAPUsbSerialNo</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCCMSISDAPUsbSerialNoSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>GDBSERVER_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>TCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagBreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagUpdateBreakpoints</name>\r
+ <state>main</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>IJET_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>8</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CatchSFERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCIarProbeScriptFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetResetList</name>\r
+ <version>1</version>\r
+ <state>10</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetHWResetDuration</name>\r
+ <state>300</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetHWResetDelay</name>\r
+ <state>200</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetPowerFromProbe</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetPowerRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetLogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetInterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetInterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetMultiTargetEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetScanChainNonARMDevices</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetIRLength</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetJtagSpeedList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetProtocolRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetSwoPin</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetCpuClockEdit</name>\r
+ <state>72.0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetSwoPrescalerList</name>\r
+ <version>1</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetBreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetRestoreBreakpointsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetUpdateBreakpointsEdit</name>\r
+ <state>_call_main</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchUndef</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchData</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchPrefetch</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchCORERESET</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchMMERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchNOCPERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchCHKERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchSTATERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchBUSERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchINTERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchHARDERR</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CatchDummy</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProbeCfgOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProbeConfig</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IjetProbeConfigRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetMultiCPUEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetMultiCPUNumber</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetSelectedCPUBehaviour</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ICpuName</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCJetEmuParams</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetPreferETB</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetTraceSettingsList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IjetTraceSizeList</name>\r
+ <version>0</version>\r
+ <state>4</state>\r
+ </option>\r
+ <option>\r
+ <name>FlashBoardPathSlave</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCIjetUsbSerialNo</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCIjetUsbSerialNoSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>JLINK_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>16</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCCatchSFERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>JLinkSpeed</name>\r
+ <state>32</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkLogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkHWResetDelay</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>JLinkInitialSpeed</name>\r
+ <state>32</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDoJlinkMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCScanChainNonARMDevices</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkIRLength</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkCommRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkTCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkSpeedRadioV2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCUSBDevice</name>\r
+ <version>1</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchUndef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchData</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchPrefetch</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkBreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkUpdateBreakpoints</name>\r
+ <state>main</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkInterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkResetList</name>\r
+ <version>6</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkInterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchCORERESET</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchMMERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchNOCPERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchCHRERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchSTATERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchBUSERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchINTERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchHARDERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCatchDummy</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCJLinkScriptFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkUsbSerialNo</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCTcpIpAlt</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkTcpIpSerialNo</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCCpuClockEdit</name>\r
+ <state>72.0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSwoClockAuto</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSwoClockEdit</name>\r
+ <state>2000</state>\r
+ </option>\r
+ <option>\r
+ <name>OCJLinkTraceSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCJLinkTraceSourceDummy</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCJLinkDeviceName</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>LMIFTDI_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>2</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>LmiftdiSpeed</name>\r
+ <state>500</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLmiftdiDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLmiftdiLogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLmiFtdiInterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLmiFtdiInterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>NULINK_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>PEMICRO_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>3</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJPEMicroShowSettings</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>STLINK_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>5</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkInterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkInterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkResetList</name>\r
+ <version>3</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCpuClockEdit</name>\r
+ <state>72.0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSwoClockAuto</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSwoClockEdit</name>\r
+ <state>2000</state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkUpdateBreakpoints</name>\r
+ <state>_call_main</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchCORERESET</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchMMERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchNOCPERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchCHRERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchSTATERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchBUSERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchINTERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchSFERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchHARDERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkCatchDummy</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkUsbSerialNo</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkUsbSerialNoSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkJtagSpeedList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkDAPNumber</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkDebugAccessPortRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSTLinkUseServerSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>THIRDPARTY_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CThirdPartyDriverDll</name>\r
+ <state>###Uninitialized###</state>\r
+ </option>\r
+ <option>\r
+ <name>CThirdPartyLogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CThirdPartyLogFileEditB</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>TIFET_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>1</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetResetList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetInterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetInterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetTargetVccTypeDefault</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetTargetVoltage</name>\r
+ <state>###Uninitialized###</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetVCCDefault</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetTargetSettlingtime</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetRadioJtagSpeedType</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetConnection</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetUsbComPort</name>\r
+ <state>Automatic</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetAllowAccessToBSL</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetLogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMSPFetRadioEraseFlash</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>XDS100_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>6</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>TIPackageOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>TIPackage</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>BoardFile</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$PROJ_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100BreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100DoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100UpdateBreakpoints</name>\r
+ <state>_call_main</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchUndef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchData</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchPrefetch</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchCORERESET</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchMMERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchNOCPERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchCHRERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchSTATERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchBUSERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchINTERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchSFERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchHARDERR</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CatchDummy</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100CpuClockEdit</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100SwoClockAuto</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100SwoClockEdit</name>\r
+ <state>1000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100HWResetDelay</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100ResetList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100UsbSerialNo</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100UsbSerialNoSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100JtagSpeedList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100InterfaceRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100InterfaceCmdLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100ProbeList</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100SWOPortRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCXds100SWOPort</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <debuggerPlugins>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>\r
+ <loadFlag>1</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>\r
+ <loadFlag>1</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ </debuggerPlugins>\r
+ </configuration>\r
</project>\r
-\r
-\r
-<?xml version="1.0" encoding="iso-8859-1"?>\r
-\r
+<?xml version="1.0" encoding="UTF-8"?>\r
<project>\r
- <fileVersion>2</fileVersion>\r
- <configuration>\r
- <name>sram</name>\r
- <toolchain>\r
- <name>ARM</name>\r
- </toolchain>\r
- <debug>1</debug>\r
- <settings>\r
- <name>General</name>\r
- <archiveVersion>3</archiveVersion>\r
- <data>\r
- <version>22</version>\r
- <wantNonLocal>1</wantNonLocal>\r
+ <fileVersion>3</fileVersion>\r
+ <configuration>\r
+ <name>sram</name>\r
+ <toolchain>\r
+ <name>ARM</name>\r
+ </toolchain>\r
<debug>1</debug>\r
- <option>\r
- <name>Variant</name>\r
- <version>20</version>\r
- <state>47</state>\r
- </option>\r
- <option>\r
- <name>ExePath</name>\r
- <state>sram\bin</state>\r
- </option>\r
- <option>\r
- <name>ObjPath</name>\r
- <state>sram\obj</state>\r
- </option>\r
- <option>\r
- <name>ListPath</name>\r
- <state>sram\obj</state>\r
- </option>\r
- <option>\r
- <name>GEndianMode</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>Input variant</name>\r
- <version>3</version>\r
- <state>7</state>\r
- </option>\r
- <option>\r
- <name>Input description</name>\r
- <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>\r
- </option>\r
- <option>\r
- <name>Output variant</name>\r
- <version>2</version>\r
- <state>7</state>\r
- </option>\r
- <option>\r
- <name>Output description</name>\r
- <state>No specifier a, A, no specifier n, no float nor long long, no flags.</state>\r
- </option>\r
- <option>\r
- <name>GOutputBinary</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>FPU</name>\r
- <version>2</version>\r
- <state>6</state>\r
- </option>\r
- <option>\r
- <name>OGCoreOrChip</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>GRuntimeLibSelect</name>\r
- <version>0</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>GRuntimeLibSelectSlave</name>\r
- <version>0</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>RTDescription</name>\r
- <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state>\r
- </option>\r
- <option>\r
- <name>OGProductVersion</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>OGLastSavedByProductVersion</name>\r
- <state>7.20.2.7418</state>\r
- </option>\r
- <option>\r
- <name>GeneralEnableMisra</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>GeneralMisraVerbose</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OGChipSelectEditMenu</name>\r
- <state>ATSAMA5D35 Atmel ATSAMA5D35</state>\r
- </option>\r
- <option>\r
- <name>GenLowLevelInterface</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>GEndianModeBE</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OGBufferedTerminalOutput</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>GenStdoutInterface</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>GeneralMisraRules98</name>\r
- <version>0</version>\r
- <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
- </option>\r
- <option>\r
- <name>GeneralMisraVer</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>GeneralMisraRules04</name>\r
- <version>0</version>\r
- <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>\r
- </option>\r
- <option>\r
- <name>RTConfigPath2</name>\r
- <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state>\r
- </option>\r
- <option>\r
- <name>GFPUCoreSlave</name>\r
- <version>20</version>\r
- <state>47</state>\r
- </option>\r
- <option>\r
- <name>GBECoreSlave</name>\r
- <version>20</version>\r
- <state>47</state>\r
- </option>\r
- <option>\r
- <name>OGUseCmsis</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OGUseCmsisDspLib</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>GRuntimeLibThreads</name>\r
- <state>0</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>ICCARM</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>31</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>CCOptimizationNoSizeConstraints</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCDefines</name>\r
- <state>sama5d3x</state>\r
- <state>sram</state>\r
- <state>TRACE_LEVEL=0</state>\r
- </option>\r
- <option>\r
- <name>CCPreprocFile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCPreprocComments</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCPreprocLine</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCListCFile</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCListCMnemonics</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCListCMessages</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCListAssFile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCListAssSource</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCEnableRemarks</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCDiagSuppress</name>\r
- <state>Pa131, Pa039</state>\r
- </option>\r
- <option>\r
- <name>CCDiagRemark</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCDiagWarning</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCDiagError</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCObjPrefix</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCAllowList</name>\r
- <version>1</version>\r
- <state>00000000</state>\r
- </option>\r
- <option>\r
- <name>CCDebugInfo</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IEndianMode</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IProcessor</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IExtraOptionsCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IExtraOptions</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CCLangConformance</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCSignedPlainChar</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCRequirePrototypes</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCMultibyteSupport</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCDiagWarnAreErr</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCompilerRuntimeInfo</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IFpuProcessor</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OutputFile</name>\r
- <state>$FILE_BNAME$.o</state>\r
- </option>\r
- <option>\r
- <name>CCLibConfigHeader</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>PreInclude</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CompilerMisraOverride</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCIncludePath2</name>\r
- <state>$PROJ_DIR$/AtmelFiles/libboard_sama5d3x-ek</state>\r
- <state>$PROJ_DIR$/AtmelFiles/libchip_sama5d3x</state>\r
- <state>$PROJ_DIR$/AtmelFiles/libchip_sama5d3x/include</state>\r
- <state>$PROJ_DIR$/.</state>\r
- <state>$PROJ_DIR$\..\..\Source\include</state>\r
- <state>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC</state>\r
- <state>$PROJ_DIR$\..\Common\include</state>\r
- <state>$PROJ_DIR$\Full_Demo</state>\r
- <state>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI</state>\r
- <state>$PROJ_DIR$\AtmelFiles\usb\device</state>\r
- <state>$PROJ_DIR$\AtmelFiles\usb\include</state>\r
- </option>\r
- <option>\r
- <name>CCStdIncCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCCodeSection</name>\r
- <state>SOFTPACK</state>\r
- </option>\r
- <option>\r
- <name>IInterwork2</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IProcessorMode2</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCOptLevel</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCOptStrategy</name>\r
- <version>0</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCOptLevelSlave</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CompilerMisraRules98</name>\r
- <version>0</version>\r
- <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
- </option>\r
- <option>\r
- <name>CompilerMisraRules04</name>\r
- <version>0</version>\r
- <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>\r
- </option>\r
- <option>\r
- <name>CCPosIndRopi</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCPosIndRwpi</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCPosIndNoDynInit</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IccLang</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IccCDialect</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccAllowVLA</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IccCppDialect</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccExceptions</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccRTTI</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccStaticDestr</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccCppInlineSemantics</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccCmsis</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IccFloatSemantics</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCNoLiteralPool</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CCOptStrategySlave</name>\r
- <version>0</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CCGuardCalls</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>AARM</name>\r
- <archiveVersion>2</archiveVersion>\r
- <data>\r
- <version>9</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>AObjPrefix</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>AEndian</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>ACaseSensitivity</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>MacroChars</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AWarnEnable</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AWarnWhat</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AWarnOne</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>AWarnRange1</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>AWarnRange2</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>ADebug</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>AltRegisterNames</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>ADefines</name>\r
- <state>sama5d3x</state>\r
- <state>sram</state>\r
- <state>__ASSEMBLY__</state>\r
- </option>\r
- <option>\r
- <name>AList</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>AListHeader</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>AListing</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>Includes</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>MacDefs</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>MacExps</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>MacExec</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>OnlyAssed</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>MultiLine</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>PageLengthCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>PageLength</name>\r
- <state>80</state>\r
- </option>\r
- <option>\r
- <name>TabSpacing</name>\r
- <state>8</state>\r
- </option>\r
- <option>\r
- <name>AXRef</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AXRefDefines</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AXRefInternal</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AXRefDual</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AProcessor</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>AFpuProcessor</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>AOutputFile</name>\r
- <state>$FILE_BNAME$.o</state>\r
- </option>\r
- <option>\r
- <name>AMultibyteSupport</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>ALimitErrorsCheck</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>ALimitErrorsEdit</name>\r
- <state>100</state>\r
- </option>\r
- <option>\r
- <name>AIgnoreStdInclude</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AUserIncludes</name>\r
- <state>$PROJ_DIR$/.</state>\r
- </option>\r
- <option>\r
- <name>AExtraOptionsCheckV2</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>AExtraOptionsV2</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>AsmNoLiteralPool</name>\r
- <state>0</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>OBJCOPY</name>\r
- <archiveVersion>0</archiveVersion>\r
- <data>\r
- <version>1</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>OOCOutputFormat</name>\r
- <version>2</version>\r
- <state>2</state>\r
- </option>\r
- <option>\r
- <name>OCOutputOverride</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OOCOutputFile</name>\r
- <state>sram.bin</state>\r
- </option>\r
- <option>\r
- <name>OOCCommandLineProducer</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>OOCObjCopyEnable</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>CUSTOM</name>\r
- <archiveVersion>3</archiveVersion>\r
- <data>\r
- <extensions></extensions>\r
- <cmdline></cmdline>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>BICOMP</name>\r
- <archiveVersion>0</archiveVersion>\r
- <data/>\r
- </settings>\r
- <settings>\r
- <name>BUILDACTION</name>\r
- <archiveVersion>1</archiveVersion>\r
- <data>\r
- <prebuild></prebuild>\r
- <postbuild></postbuild>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>ILINK</name>\r
- <archiveVersion>0</archiveVersion>\r
- <data>\r
- <version>16</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>IlinkLibIOConfig</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>XLinkMisraHandler</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkInputFileSlave</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkOutputFile</name>\r
- <state>sram.out</state>\r
- </option>\r
- <option>\r
- <name>IlinkDebugInfoEnable</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkKeepSymbols</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkRawBinaryFile</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkRawBinarySymbol</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkRawBinarySegment</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkRawBinaryAlign</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkDefines</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkConfigDefines</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkMapFile</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogFile</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogInitialization</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogModule</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogSection</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogVeneer</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkIcfOverride</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkIcfFile</name>\r
- <state>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\resources\ewarm\sama5d3x\sram.icf</state>\r
- </option>\r
- <option>\r
- <name>IlinkIcfFileSlave</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkEnableRemarks</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkSuppressDiags</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkTreatAsRem</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkTreatAsWarn</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkTreatAsErr</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkWarningsAreErrors</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkUseExtraOptions</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkExtraOptions</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkLowLevelInterfaceSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkAutoLibEnable</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkAdditionalLibs</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkOverrideProgramEntryLabel</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkProgramEntryLabelSelect</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkProgramEntryLabel</name>\r
- <state>resetHandler</state>\r
- </option>\r
- <option>\r
- <name>DoFill</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>FillerByte</name>\r
- <state>0xFF</state>\r
- </option>\r
- <option>\r
- <name>FillerStart</name>\r
- <state>0x0</state>\r
- </option>\r
- <option>\r
- <name>FillerEnd</name>\r
- <state>0x0</state>\r
- </option>\r
- <option>\r
- <name>CrcSize</name>\r
- <version>0</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CrcAlign</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CrcPoly</name>\r
- <state>0x11021</state>\r
- </option>\r
- <option>\r
- <name>CrcCompl</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CrcBitOrder</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>CrcInitialValue</name>\r
- <state>0x0</state>\r
- </option>\r
- <option>\r
- <name>DoCrc</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkBE8Slave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkBufferedTerminalOutput</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkStdoutInterfaceSlave</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CrcFullSize</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkIElfToolPostProcess</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogAutoLibSelect</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogRedirSymbols</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkLogUnusedFragments</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkCrcReverseByteOrder</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkCrcUseAsInput</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkOptInline</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkOptExceptionsAllow</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkOptExceptionsForce</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkCmsis</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkOptMergeDuplSections</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkOptUseVfe</name>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>IlinkOptForceVfe</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkStackAnalysisEnable</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkStackControlFile</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IlinkStackCallGraphFile</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>CrcAlgorithm</name>\r
- <version>0</version>\r
- <state>1</state>\r
- </option>\r
- <option>\r
- <name>CrcUnitSize</name>\r
- <version>0</version>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IlinkThreadsSlave</name>\r
- <state>1</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>IARCHIVE</name>\r
- <archiveVersion>0</archiveVersion>\r
- <data>\r
- <version>0</version>\r
- <wantNonLocal>1</wantNonLocal>\r
- <debug>1</debug>\r
- <option>\r
- <name>IarchiveInputs</name>\r
- <state></state>\r
- </option>\r
- <option>\r
- <name>IarchiveOverride</name>\r
- <state>0</state>\r
- </option>\r
- <option>\r
- <name>IarchiveOutput</name>\r
- <state>###Unitialized###</state>\r
- </option>\r
- </data>\r
- </settings>\r
- <settings>\r
- <name>BILINK</name>\r
- <archiveVersion>0</archiveVersion>\r
- <data/>\r
- </settings>\r
- </configuration>\r
- <group>\r
- <name>Atmel Files</name>\r
- <group>\r
- <name>libboard_sama5d3x-ek</name>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\board_lowlevel.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\board_memories.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\dbg_util.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\dbgu_console.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\led.c</name>\r
- </file>\r
- </group>\r
+ <settings>\r
+ <name>General</name>\r
+ <archiveVersion>3</archiveVersion>\r
+ <data>\r
+ <version>30</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>ExePath</name>\r
+ <state>sram\bin</state>\r
+ </option>\r
+ <option>\r
+ <name>ObjPath</name>\r
+ <state>sram\obj</state>\r
+ </option>\r
+ <option>\r
+ <name>ListPath</name>\r
+ <state>sram\obj</state>\r
+ </option>\r
+ <option>\r
+ <name>GEndianMode</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>Input description</name>\r
+ <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>\r
+ </option>\r
+ <option>\r
+ <name>Output description</name>\r
+ <state>No specifier a, A, no specifier n, no float nor long long, no flags, without multibyte support.</state>\r
+ </option>\r
+ <option>\r
+ <name>GOutputBinary</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGCoreOrChip</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibSelect</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibSelectSlave</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RTDescription</name>\r
+ <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state>\r
+ </option>\r
+ <option>\r
+ <name>OGProductVersion</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OGLastSavedByProductVersion</name>\r
+ <state>8.22.1.15696</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralEnableMisra</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraVerbose</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGChipSelectEditMenu</name>\r
+ <state>ATSAMA5D35 Atmel ATSAMA5D35</state>\r
+ </option>\r
+ <option>\r
+ <name>GenLowLevelInterface</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GEndianModeBE</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OGBufferedTerminalOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GenStdoutInterface</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraRules98</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraVer</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraRules04</name>\r
+ <version>0</version>\r
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>RTConfigPath2</name>\r
+ <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state>\r
+ </option>\r
+ <option>\r
+ <name>GBECoreSlave</name>\r
+ <version>26</version>\r
+ <state>50</state>\r
+ </option>\r
+ <option>\r
+ <name>OGUseCmsis</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGUseCmsisDspLib</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibThreads</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CoreVariant</name>\r
+ <version>26</version>\r
+ <state>50</state>\r
+ </option>\r
+ <option>\r
+ <name>GFPUDeviceSlave</name>\r
+ <state>ATSAMA5D35 Atmel ATSAMA5D35</state>\r
+ </option>\r
+ <option>\r
+ <name>FPU2</name>\r
+ <version>0</version>\r
+ <state>5</state>\r
+ </option>\r
+ <option>\r
+ <name>NrRegs</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>NEON</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GFPUCoreSlave2</name>\r
+ <version>26</version>\r
+ <state>50</state>\r
+ </option>\r
+ <option>\r
+ <name>OGCMSISPackSelectDevice</name>\r
+ </option>\r
+ <option>\r
+ <name>OgLibHeap</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGLibAdditionalLocale</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGPrintfVariant</name>\r
+ <version>0</version>\r
+ <state>4</state>\r
+ </option>\r
+ <option>\r
+ <name>OGPrintfMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGScanfVariant</name>\r
+ <version>0</version>\r
+ <state>3</state>\r
+ </option>\r
+ <option>\r
+ <name>OGScanfMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GenLocaleTags</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>GenLocaleDisplayOnly</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>DSPExtension</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>TrustZone</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ICCARM</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>34</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCOptimizationNoSizeConstraints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDefines</name>\r
+ <state>sama5d3x</state>\r
+ <state>sram</state>\r
+ <state>TRACE_LEVEL=0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocComments</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMnemonics</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMessages</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEnableRemarks</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagSuppress</name>\r
+ <state>Pa131, Pa039</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagRemark</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarning</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagError</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCAllowList</name>\r
+ <version>1</version>\r
+ <state>00000000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDebugInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IEndianMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangConformance</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSignedPlainChar</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRequirePrototypes</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarnAreErr</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCompilerRuntimeInfo</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>$FILE_BNAME$.o</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLibConfigHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>PreInclude</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCIncludePath2</name>\r
+ <state>$PROJ_DIR$/AtmelFiles/libboard_sama5d3x-ek</state>\r
+ <state>$PROJ_DIR$/AtmelFiles/libchip_sama5d3x</state>\r
+ <state>$PROJ_DIR$/AtmelFiles/libchip_sama5d3x/include</state>\r
+ <state>$PROJ_DIR$/.</state>\r
+ <state>$PROJ_DIR$\..\..\Source\include</state>\r
+ <state>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC</state>\r
+ <state>$PROJ_DIR$\..\Common\include</state>\r
+ <state>$PROJ_DIR$\Full_Demo</state>\r
+ <state>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI</state>\r
+ <state>$PROJ_DIR$\AtmelFiles\usb\device</state>\r
+ <state>$PROJ_DIR$\AtmelFiles\usb\include</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCodeSection</name>\r
+ <state>SOFTPACK</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessorMode2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptLevel</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptStrategy</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptLevelSlave</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraRules98</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraRules04</name>\r
+ <version>0</version>\r
+ <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPosIndRopi</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPosIndRwpi</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPosIndNoDynInit</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IccLang</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IccCDialect</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IccAllowVLA</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IccStaticDestr</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IccCppInlineSemantics</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IccCmsis</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IccFloatSemantics</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCNoLiteralPool</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptStrategySlave</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCGuardCalls</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEncSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEncOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEncOutputBom</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEncInput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IccExceptions2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IccRTTI2</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>AARM</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>10</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>AObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AEndian</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ACaseSensitivity</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacroChars</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnWhat</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnOne</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnRange1</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnRange2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>ADebug</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AltRegisterNames</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ADefines</name>\r
+ <state>sama5d3x</state>\r
+ <state>sram</state>\r
+ <state>__ASSEMBLY__</state>\r
+ </option>\r
+ <option>\r
+ <name>AList</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AListHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AListing</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>Includes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacDefs</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacExps</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacExec</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OnlyAssed</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MultiLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLengthCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLength</name>\r
+ <state>80</state>\r
+ </option>\r
+ <option>\r
+ <name>TabSpacing</name>\r
+ <state>8</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefDefines</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefInternal</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefDual</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AOutputFile</name>\r
+ <state>$FILE_BNAME$.o</state>\r
+ </option>\r
+ <option>\r
+ <name>ALimitErrorsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ALimitErrorsEdit</name>\r
+ <state>100</state>\r
+ </option>\r
+ <option>\r
+ <name>AIgnoreStdInclude</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AUserIncludes</name>\r
+ <state>$PROJ_DIR$/.</state>\r
+ <state>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC</state>\r
+ </option>\r
+ <option>\r
+ <name>AExtraOptionsCheckV2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AExtraOptionsV2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AsmNoLiteralPool</name>\r
+ <state>0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>OBJCOPY</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data>\r
+ <version>1</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OOCOutputFormat</name>\r
+ <version>3</version>\r
+ <state>3</state>\r
+ </option>\r
+ <option>\r
+ <name>OCOutputOverride</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OOCOutputFile</name>\r
+ <state>sram.bin</state>\r
+ </option>\r
+ <option>\r
+ <name>OOCCommandLineProducer</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OOCObjCopyEnable</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>CUSTOM</name>\r
+ <archiveVersion>3</archiveVersion>\r
+ <data>\r
+ <extensions></extensions>\r
+ <cmdline></cmdline>\r
+ <hasPrio>0</hasPrio>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>BICOMP</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data />\r
+ </settings>\r
+ <settings>\r
+ <name>BUILDACTION</name>\r
+ <archiveVersion>1</archiveVersion>\r
+ <data>\r
+ <prebuild></prebuild>\r
+ <postbuild></postbuild>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ILINK</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data>\r
+ <version>20</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>IlinkLibIOConfig</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XLinkMisraHandler</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkInputFileSlave</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOutputFile</name>\r
+ <state>sram.out</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkDebugInfoEnable</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkKeepSymbols</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkRawBinaryFile</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkRawBinarySymbol</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkRawBinarySegment</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkRawBinaryAlign</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkDefines</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkConfigDefines</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkMapFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogInitialization</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogModule</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogSection</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogVeneer</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkIcfOverride</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkIcfFile</name>\r
+ <state>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\resources\ewarm\sama5d3x\sram.icf</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkIcfFileSlave</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkEnableRemarks</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkSuppressDiags</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkTreatAsRem</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkTreatAsWarn</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkTreatAsErr</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkWarningsAreErrors</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkUseExtraOptions</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLowLevelInterfaceSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkAutoLibEnable</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkAdditionalLibs</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOverrideProgramEntryLabel</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkProgramEntryLabelSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkProgramEntryLabel</name>\r
+ <state>resetHandler</state>\r
+ </option>\r
+ <option>\r
+ <name>DoFill</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FillerByte</name>\r
+ <state>0xFF</state>\r
+ </option>\r
+ <option>\r
+ <name>FillerStart</name>\r
+ <state>0x0</state>\r
+ </option>\r
+ <option>\r
+ <name>FillerEnd</name>\r
+ <state>0x0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcSize</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcPoly</name>\r
+ <state>0x11021</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcCompl</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcBitOrder</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcInitialValue</name>\r
+ <state>0x0</state>\r
+ </option>\r
+ <option>\r
+ <name>DoCrc</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkBE8Slave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkBufferedTerminalOutput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkStdoutInterfaceSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcFullSize</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkIElfToolPostProcess</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogAutoLibSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogRedirSymbols</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogUnusedFragments</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkCrcReverseByteOrder</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkCrcUseAsInput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOptInline</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOptExceptionsAllow</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOptExceptionsForce</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkCmsis</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOptMergeDuplSections</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOptUseVfe</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkOptForceVfe</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkStackAnalysisEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkStackControlFile</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkStackCallGraphFile</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CrcAlgorithm</name>\r
+ <version>1</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcUnitSize</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkThreadsSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLogCallGraph</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkIcfFile_AltDefault</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkEncInput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkEncOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkEncOutputBom</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkHeapSelect</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IlinkLocaleSelect</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>IARCHIVE</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>IarchiveInputs</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IarchiveOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IarchiveOutput</name>\r
+ <state>###Unitialized###</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>BILINK</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data />\r
+ </settings>\r
+ </configuration>\r
<group>\r
- <name>libchip_sama5d3x</name>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\aic.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\cp15\cp15.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\cp15\cp15_asm_iar.s</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\mmu.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pio.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pio_it.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pit.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pmc.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\tc.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\USBD_HAL.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\wdt.c</name>\r
- </file>\r
- </group>\r
- <group>\r
- <name>usb</name>\r
- <group>\r
- <name>common</name>\r
+ <name>Atmel Files</name>\r
<group>\r
- <name>cdc</name>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\common\cdc\CDCLineCoding.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\common\cdc\CDCSetControlLineStateRequest.c</name>\r
- </file>\r
+ <name>libboard_sama5d3x-ek</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\board_lowlevel.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\board_memories.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\dbg_util.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\dbgu_console.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libboard_sama5d3x-ek\source\led.c</name>\r
+ </file>\r
</group>\r
<group>\r
- <name>core</name>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\common\core\USBDescriptors.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\common\core\USBRequests.c</name>\r
- </file>\r
+ <name>libchip_sama5d3x</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\aic.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\cp15\cp15.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\cp15\cp15_asm_iar.s</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\mmu.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pio.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pio_it.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pit.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\pmc.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\tc.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\USBD_HAL.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\libchip_sama5d3x\source\wdt.c</name>\r
+ </file>\r
</group>\r
- </group>\r
- <group>\r
- <name>device</name>\r
<group>\r
- <name>cdc-serial</name>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerial.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerial_Callbacks.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerialDriver.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerialPort.c</name>\r
- </file>\r
+ <name>usb</name>\r
+ <group>\r
+ <name>common</name>\r
+ <group>\r
+ <name>cdc</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\common\cdc\CDCLineCoding.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\common\cdc\CDCSetControlLineStateRequest.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>core</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\common\core\USBDescriptors.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\common\core\USBRequests.c</name>\r
+ </file>\r
+ </group>\r
+ </group>\r
+ <group>\r
+ <name>device</name>\r
+ <group>\r
+ <name>cdc-serial</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerial.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerial_Callbacks.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerialDriver.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\cdc-serial\CDCDSerialPort.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>core</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBD.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBDCallbacks.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBDDriver.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBDDriverCallbacks.c</name>\r
+ </file>\r
+ </group>\r
+ </group>\r
+ <file>\r
+ <name>$PROJ_DIR$\AtmelFiles\usb\USBDDriverDescriptors.c</name>\r
+ </file>\r
</group>\r
+ </group>\r
+ <group>\r
+ <name>Blinky Demo</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\blinky_demo\main_blinky.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>FreeRTOS Source</name>\r
<group>\r
- <name>core</name>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBD.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBDCallbacks.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBDDriver.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\device\core\USBDDriverCallbacks.c</name>\r
- </file>\r
+ <name>portable</name>\r
+ <group>\r
+ <name>MemMang</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_4.c</name>\r
+ </file>\r
+ </group>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\port.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.h</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.s</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portmacro.h</name>\r
+ </file>\r
</group>\r
- </group>\r
- <file>\r
- <name>$PROJ_DIR$\AtmelFiles\usb\USBDDriverDescriptors.c</name>\r
- </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\event_groups.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\list.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\queue.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\tasks.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\timers.c</name>\r
+ </file>\r
</group>\r
- </group>\r
- <group>\r
- <name>Blinky Demo</name>\r
- <file>\r
- <name>$PROJ_DIR$\blinky_demo\main_blinky.c</name>\r
- </file>\r
- </group>\r
- <group>\r
- <name>FreeRTOS Source</name>\r
<group>\r
- <name>portable</name>\r
- <group>\r
- <name>MemMang</name>\r
+ <name>FreeRTOS+CLI</name>\r
<file>\r
- <name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_4.c</name>\r
+ <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c</name>\r
</file>\r
- </group>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\port.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.h</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.s</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portmacro.h</name>\r
- </file>\r
</group>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\event_groups.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\list.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\queue.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\tasks.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\Source\timers.c</name>\r
- </file>\r
- </group>\r
- <group>\r
- <name>FreeRTOS+CLI</name>\r
- <file>\r
- <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c</name>\r
- </file>\r
- </group>\r
- <group>\r
- <name>Full Demo</name>\r
<group>\r
- <name>Common Demo Tasks</name>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\blocktim.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\countsem.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\death.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\EventGroupsDemo.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\flop.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\IntQueue.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\QueueOverwrite.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\..\Common\Minimal\TimerDemo.c</name>\r
- </file>\r
+ <name>Full Demo</name>\r
+ <group>\r
+ <name>Common Demo Tasks</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\blocktim.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\countsem.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\death.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\EventGroupsDemo.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flop.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\IntQueue.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\QueueOverwrite.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\TimerDemo.c</name>\r
+ </file>\r
+ </group>\r
+ <file>\r
+ <name>$PROJ_DIR$\CDCCommandConsole.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Full_Demo\IntQueueTimer.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Full_Demo\main_full.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Full_Demo\reg_test.S</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\Sample-CLI-commands.c</name>\r
+ </file>\r
</group>\r
<file>\r
- <name>$PROJ_DIR$\CDCCommandConsole.c</name>\r
+ <name>$PROJ_DIR$\cstartup_with_FreeRTOS_vectors.s</name>\r
</file>\r
<file>\r
- <name>$PROJ_DIR$\Full_Demo\IntQueueTimer.c</name>\r
+ <name>$PROJ_DIR$\FreeRTOS_tick_config.c</name>\r
</file>\r
<file>\r
- <name>$PROJ_DIR$\Full_Demo\main_full.c</name>\r
+ <name>$PROJ_DIR$\FreeRTOSConfig.h</name>\r
</file>\r
<file>\r
- <name>$PROJ_DIR$\Full_Demo\reg_test.S</name>\r
+ <name>$PROJ_DIR$\LEDs.c</name>\r
</file>\r
<file>\r
- <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\Sample-CLI-commands.c</name>\r
+ <name>$PROJ_DIR$\main.c</name>\r
</file>\r
- </group>\r
- <file>\r
- <name>$PROJ_DIR$\cstartup_with_FreeRTOS_vectors.s</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\FreeRTOS_tick_config.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\FreeRTOSConfig.h</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\LEDs.c</name>\r
- </file>\r
- <file>\r
- <name>$PROJ_DIR$\main.c</name>\r
- </file>\r
</project>\r
-\r
-\r
-<?xml version="1.0" encoding="iso-8859-1"?>\r
-\r
+<?xml version="1.0" encoding="UTF-8"?>\r
<crun>\r
- <version>1</version>\r
- <filter_entries>\r
- <filter index="0" type="default">\r
- <type>*</type>\r
- <start_file>*</start_file>\r
- <end_file>*</end_file>\r
- <action_debugger>0</action_debugger>\r
- <action_log>1</action_log>\r
- </filter>\r
- </filter_entries>\r
+ <version>1</version>\r
+ <filter_entries>\r
+ <filter index="0" type="default">\r
+ <type>*</type>\r
+ <start_file>*</start_file>\r
+ <end_file>*</end_file>\r
+ <action_debugger>0</action_debugger>\r
+ <action_log>1</action_log>\r
+ </filter>\r
+ </filter_entries>\r
</crun>\r
-\r
-\r
-<?xml version="1.0" encoding="iso-8859-1"?>\r
-\r
+<?xml version="1.0"?>\r
<Project>\r
- <Desktop>\r
- <Static>\r
- <Debug-Log>\r
- \r
- \r
- <PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window><Window><Factory>Find-in-Files</Factory></Window></Windows></PreferedWindows><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log>\r
- <Build>\r
- \r
- \r
- \r
- \r
- <ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Debug-Log</Factory></Window><Window><Factory>Find-in-Files</Factory></Window></Windows></PreferedWindows></Build>\r
- <Workspace>\r
- <ColumnWidths>\r
- \r
- \r
- \r
- \r
- <Column0>242</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
- </Workspace>\r
- <Disassembly>\r
- <col-names>\r
- \r
- \r
- <item>Disassembly</item><item>_I0</item></col-names>\r
- <col-widths>\r
- \r
- \r
- <item>500</item><item>20</item></col-widths>\r
- <DisasmHistory><item>0x305444</item><item>0x0030211C</item><item>0x00302750</item></DisasmHistory>\r
- \r
- \r
- <PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ShowCodeCoverage>1</ShowCodeCoverage><ShowInstrProfiling>1</ShowInstrProfiling></Disassembly>\r
- <Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><WATCH_1><expressions><item/></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>207</item><item>150</item><item>100</item><item>294</item></col-widths><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></WATCH_1><CallStack><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Frame</item><item>_I0</item></col-names><col-widths><item>400</item><item>20</item></col-widths></CallStack><Breakpoints><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Breakpoint</item><item>_I0</item></col-names><col-widths><item>500</item><item>35</item></col-widths></Breakpoints><Find-in-Files><ColumnWidth0>497</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>746</ColumnWidth2><ColumnWidth3>331</ColumnWidth3><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Debug-Log</Factory></Window><Window><Factory>Build</Factory></Window></Windows></PreferedWindows></Find-in-Files><QuickWatch><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>100</item><item>150</item><item>100</item><item>100</item></col-widths><QWatchHistory><item>TC0</item><item>TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_RC</item></QWatchHistory></QuickWatch><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><FindAsHex>0</FindAsHex></Memory><TASKVIEW><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>200</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>100</Column6><Column7>100</Column7><Column8>150</Column8></TASKVIEW><QUEUEVIEW><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>300</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>100</Column6></QUEUEVIEW></Static>\r
- <Windows>\r
- \r
- \r
- \r
- <Wnd0>\r
- <Tabs>\r
- <Tab>\r
- <Identity>TabID-24673-23877</Identity>\r
- <TabName>Workspace</TabName>\r
- <Factory>Workspace</Factory>\r
- <Session>\r
- \r
- <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Atmel Files</ExpandedNode><ExpandedNode>RTOSDemo/Atmel Files/libchip_sama5d3x</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source/portable</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source/portable/MemMang</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS+CLI</ExpandedNode><ExpandedNode>RTOSDemo/Full Demo</ExpandedNode><ExpandedNode>RTOSDemo/Full Demo/Common Demo Tasks</ExpandedNode></NodeDict></Session>\r
- </Tab>\r
- </Tabs>\r
- \r
- <SelectedTab>0</SelectedTab></Wnd0><Wnd3><Tabs><Tab><Identity>TabID-31713-7906</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
- <Editor>\r
- \r
- \r
- \r
- \r
- <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\CDCCommandConsole.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>441</YPos2><SelStart2>16342</SelStart2><SelEnd2>16359</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>111</YPos2><SelStart2>6131</SelStart2><SelEnd2>6131</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.s</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>117</YPos2><SelStart2>5123</SelStart2><SelEnd2>5123</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
- <Positions>\r
- \r
- \r
- \r
- \r
- \r
- <Top><Row0><Sizes><Toolbar-002781D8><key>iaridepm.enu1</key></Toolbar-002781D8></Sizes></Row0><Row1><Sizes><Toolbar-1A6225A0><key>debuggergui.enu1</key></Toolbar-1A6225A0></Sizes></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>718</Bottom><Right>332</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>198810</sizeVertCX><sizeVertCY>731707</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203252</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
- </Desktop>\r
+ <Desktop>\r
+ <Static>\r
+ <Debug-Log>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows>\r
+ <Window>\r
+ <Factory>Build</Factory>\r
+ </Window>\r
+ <Window>\r
+ <Factory>Find-in-Files</Factory>\r
+ </Window>\r
+ </Windows>\r
+ </PreferedWindows>\r
+ <ColumnWidth0>20</ColumnWidth0>\r
+ <ColumnWidth1>1622</ColumnWidth1>\r
+ </Debug-Log>\r
+ <Build>\r
+ <ColumnWidth0>20</ColumnWidth0>\r
+ <ColumnWidth1>1216</ColumnWidth1>\r
+ <ColumnWidth2>324</ColumnWidth2>\r
+ <ColumnWidth3>81</ColumnWidth3>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows>\r
+ <Window>\r
+ <Factory>Debug-Log</Factory>\r
+ </Window>\r
+ <Window>\r
+ <Factory>Find-in-Files</Factory>\r
+ </Window>\r
+ </Windows>\r
+ </PreferedWindows>\r
+ </Build>\r
+ <Workspace>\r
+ <ColumnWidths>\r
+ <Column0>242</Column0>\r
+ <Column1>27</Column1>\r
+ <Column2>27</Column2>\r
+ <Column3>27</Column3>\r
+ </ColumnWidths>\r
+ </Workspace>\r
+ <Disassembly>\r
+ <col-names>\r
+ <item>Disassembly</item>\r
+ <item>_I0</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>500</item>\r
+ <item>20</item>\r
+ </col-widths>\r
+ <DisasmHistory>\r
+ <item>0x305444</item>\r
+ <item>0x0030211C</item>\r
+ <item>0x00302750</item>\r
+ </DisasmHistory>\r
+ <PreferedWindows>\r
+ <Position>2</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <ShowCodeCoverage>1</ShowCodeCoverage>\r
+ <ShowInstrProfiling>1</ShowInstrProfiling>\r
+ </Disassembly>\r
+ <Register>\r
+ <PreferedWindows>\r
+ <Position>2</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ </Register>\r
+ <WATCH_1>\r
+ <expressions>\r
+ <item />\r
+ </expressions>\r
+ <col-names>\r
+ <item>Expression</item>\r
+ <item>Location</item>\r
+ <item>Type</item>\r
+ <item>Value</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>207</item>\r
+ <item>150</item>\r
+ <item>100</item>\r
+ <item>294</item>\r
+ </col-widths>\r
+ <PreferedWindows>\r
+ <Position>2</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ </WATCH_1>\r
+ <CallStack>\r
+ <PreferedWindows>\r
+ <Position>1</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <col-names>\r
+ <item>Frame</item>\r
+ <item>_I0</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>400</item>\r
+ <item>20</item>\r
+ </col-widths>\r
+ </CallStack>\r
+ <Breakpoints>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <col-names>\r
+ <item>Breakpoint</item>\r
+ <item>_I0</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>500</item>\r
+ <item>35</item>\r
+ </col-widths>\r
+ </Breakpoints>\r
+ <Find-in-Files>\r
+ <ColumnWidth0>497</ColumnWidth0>\r
+ <ColumnWidth1>82</ColumnWidth1>\r
+ <ColumnWidth2>746</ColumnWidth2>\r
+ <ColumnWidth3>331</ColumnWidth3>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows>\r
+ <Window>\r
+ <Factory>Debug-Log</Factory>\r
+ </Window>\r
+ <Window>\r
+ <Factory>Build</Factory>\r
+ </Window>\r
+ </Windows>\r
+ </PreferedWindows>\r
+ </Find-in-Files>\r
+ <QuickWatch>\r
+ <PreferedWindows>\r
+ <Position>2</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <col-names>\r
+ <item>Expression</item>\r
+ <item>Location</item>\r
+ <item>Type</item>\r
+ <item>Value</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>100</item>\r
+ <item>150</item>\r
+ <item>100</item>\r
+ <item>100</item>\r
+ </col-widths>\r
+ <QWatchHistory>\r
+ <item>TC0</item>\r
+ <item>TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_RC</item>\r
+ </QWatchHistory>\r
+ </QuickWatch>\r
+ <Memory>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <FindDirection>1</FindDirection>\r
+ <FindAsHex>0</FindAsHex>\r
+ </Memory>\r
+ <TASKVIEW>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <Column0>200</Column0>\r
+ <Column1>100</Column1>\r
+ <Column2>100</Column2>\r
+ <Column3>100</Column3>\r
+ <Column4>100</Column4>\r
+ <Column5>100</Column5>\r
+ <Column6>100</Column6>\r
+ <Column7>100</Column7>\r
+ <Column8>150</Column8>\r
+ </TASKVIEW>\r
+ <QUEUEVIEW>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ <Column0>300</Column0>\r
+ <Column1>100</Column1>\r
+ <Column2>100</Column2>\r
+ <Column3>100</Column3>\r
+ <Column4>100</Column4>\r
+ <Column5>100</Column5>\r
+ <Column6>100</Column6>\r
+ </QUEUEVIEW>\r
+ </Static>\r
+ <Windows>\r
+ <Wnd0>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-24673-23877</Identity>\r
+ <TabName>Workspace</TabName>\r
+ <Factory>Workspace</Factory>\r
+ <Session>\r
+ <NodeDict>\r
+ <ExpandedNode>RTOSDemo</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/Atmel Files</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/Atmel Files/libchip_sama5d3x</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/FreeRTOS Source</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/FreeRTOS Source/portable</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/FreeRTOS Source/portable/MemMang</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/FreeRTOS+CLI</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/Full Demo</ExpandedNode>\r
+ <ExpandedNode>RTOSDemo/Full Demo/Common Demo Tasks</ExpandedNode>\r
+ </NodeDict>\r
+ </Session>\r
+ </Tab>\r
+ </Tabs>\r
+ <SelectedTab>0</SelectedTab>\r
+ </Wnd0>\r
+ <Wnd3>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-31713-7906</Identity>\r
+ <TabName>Debug Log</TabName>\r
+ <Factory>Debug-Log</Factory>\r
+ <Session />\r
+ </Tab>\r
+ </Tabs>\r
+ <SelectedTab>0</SelectedTab>\r
+ </Wnd3>\r
+ </Windows>\r
+ <Editor>\r
+ <Pane>\r
+ <Tab>\r
+ <Factory>TextEditor</Factory>\r
+ <Filename>$WS_DIR$\CDCCommandConsole.c</Filename>\r
+ <XPos>0</XPos>\r
+ <YPos>0</YPos>\r
+ <SelStart>0</SelStart>\r
+ <SelEnd>0</SelEnd>\r
+ <XPos2>0</XPos2>\r
+ <YPos2>441</YPos2>\r
+ <SelStart2>16342</SelStart2>\r
+ <SelEnd2>16359</SelEnd2>\r
+ </Tab>\r
+ <ActiveTab>0</ActiveTab>\r
+ <Tab>\r
+ <Factory>TextEditor</Factory>\r
+ <Filename>$WS_DIR$\main.c</Filename>\r
+ <XPos>0</XPos>\r
+ <YPos>0</YPos>\r
+ <SelStart>0</SelStart>\r
+ <SelEnd>0</SelEnd>\r
+ <XPos2>0</XPos2>\r
+ <YPos2>111</YPos2>\r
+ <SelStart2>6131</SelStart2>\r
+ <SelEnd2>6131</SelEnd2>\r
+ </Tab>\r
+ <Tab>\r
+ <Factory>TextEditor</Factory>\r
+ <Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.s</Filename>\r
+ <XPos>0</XPos>\r
+ <YPos>0</YPos>\r
+ <SelStart>0</SelStart>\r
+ <SelEnd>0</SelEnd>\r
+ <XPos2>0</XPos2>\r
+ <YPos2>117</YPos2>\r
+ <SelStart2>5123</SelStart2>\r
+ <SelEnd2>5123</SelEnd2>\r
+ </Tab>\r
+ </Pane>\r
+ <ActivePane>0</ActivePane>\r
+ <Sizes>\r
+ <Pane>\r
+ <X>1000000</X>\r
+ <Y>1000000</Y>\r
+ </Pane>\r
+ </Sizes>\r
+ <SplitMode>1</SplitMode>\r
+ </Editor>\r
+ <Positions>\r
+ <Top>\r
+ <Row0>\r
+ <Sizes>\r
+ <Toolbar-002781D8>\r
+ <key>iaridepm.enu1</key>\r
+ </Toolbar-002781D8>\r
+ </Sizes>\r
+ </Row0>\r
+ <Row1>\r
+ <Sizes>\r
+ <Toolbar-1A6225A0>\r
+ <key>debuggergui.enu1</key>\r
+ </Toolbar-1A6225A0>\r
+ </Sizes>\r
+ </Row1>\r
+ </Top>\r
+ <Left>\r
+ <Row0>\r
+ <Sizes>\r
+ <Wnd0>\r
+ <Rect>\r
+ <Top>-2</Top>\r
+ <Left>-2</Left>\r
+ <Bottom>718</Bottom>\r
+ <Right>332</Right>\r
+ <x>-2</x>\r
+ <y>-2</y>\r
+ <xscreen>200</xscreen>\r
+ <yscreen>200</yscreen>\r
+ <sizeHorzCX>119048</sizeHorzCX>\r
+ <sizeHorzCY>203252</sizeHorzCY>\r
+ <sizeVertCX>198810</sizeVertCX>\r
+ <sizeVertCY>731707</sizeVertCY>\r
+ </Rect>\r
+ </Wnd0>\r
+ </Sizes>\r
+ </Row0>\r
+ </Left>\r
+ <Right>\r
+ <Row0>\r
+ <Sizes />\r
+ </Row0>\r
+ </Right>\r
+ <Bottom>\r
+ <Row0>\r
+ <Sizes>\r
+ <Wnd3>\r
+ <Rect>\r
+ <Top>-2</Top>\r
+ <Left>-2</Left>\r
+ <Bottom>198</Bottom>\r
+ <Right>1682</Right>\r
+ <x>-2</x>\r
+ <y>-2</y>\r
+ <xscreen>1684</xscreen>\r
+ <yscreen>200</yscreen>\r
+ <sizeHorzCX>1002381</sizeHorzCX>\r
+ <sizeHorzCY>203252</sizeHorzCY>\r
+ <sizeVertCX>119048</sizeVertCX>\r
+ <sizeVertCY>203252</sizeVertCY>\r
+ </Rect>\r
+ </Wnd3>\r
+ </Sizes>\r
+ </Row0>\r
+ </Bottom>\r
+ <Float>\r
+ <Sizes />\r
+ </Float>\r
+ </Positions>\r
+ </Desktop>\r
+ <WindowStorage />\r
</Project>\r
-\r
-\r
@REM \r
\r
\r
-"C:\DevTools\IAR Systems\Embedded Workbench 7.0\common\bin\cspybat" "C:\DevTools\IAR Systems\Embedded Workbench 7.0\arm\bin\armproc.dll" "C:\DevTools\IAR Systems\Embedded Workbench 7.0\arm\bin\armjlink.dll" %1 --plugin "C:\DevTools\IAR Systems\Embedded Workbench 7.0\arm\bin\armbat.dll" --macro "C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D3x_Xplained_IAR\AtmelFiles\libboard_sama5d3x-ek\resources\ewarm\sama5d3x-ek-sram.mac" --backend -B "--endian=little" "--cpu=Cortex-A5" "--fpu=VFPv4Neon" "-p" "C:\DevTools\IAR Systems\Embedded Workbench 7.0\arm\CONFIG\debugger\Atmel\ATSAMA5D35.ddf" "--drv_verify_download" "--semihosting=none" "--device=ATSAMA5D35" "--drv_communication=USB0" "--jlink_speed=auto" "--jlink_initial_speed=32" "--drv_catch_exceptions=0x000" "--jlink_reset_strategy=0,0" \r
+@echo off \r
\r
+if not "%~1" == "" goto debugFile \r
\r
+@echo on \r
+\r
+"C:\devtools\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D3x_Xplained_IAR\settings\RTOSDemo.sram.general.xcl" --backend -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D3x_Xplained_IAR\settings\RTOSDemo.sram.driver.xcl" \r
+\r
+@echo off \r
+goto end \r
+\r
+:debugFile \r
+\r
+@echo on \r
+\r
+"C:\devtools\IAR Systems\Embedded Workbench 8.0\common\bin\cspybat" -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D3x_Xplained_IAR\settings\RTOSDemo.sram.general.xcl" "--debug_file=%~1" --backend -f "C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D3x_Xplained_IAR\settings\RTOSDemo.sram.driver.xcl" \r
+\r
+@echo off \r
+:end
\ No newline at end of file
-<?xml version="1.0" encoding="iso-8859-1"?>\r
-\r
+<?xml version="1.0"?>\r
<Workspace>\r
- <ConfigDictionary>\r
- \r
- <CurrentConfigs><Project>RTOSDemo/sram</Project></CurrentConfigs></ConfigDictionary>\r
- <Desktop>\r
- <Static>\r
- <Workspace>\r
- <ColumnWidths>\r
- \r
- \r
- \r
- \r
- <Column0>278</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
- </Workspace>\r
- <CRunMessageRules>\r
- <col-names>\r
- <item>Action</item>\r
- <item>Check</item>\r
- <item>Source File</item>\r
- </col-names>\r
- <col-widths>\r
- <item>100</item>\r
- <item>400</item>\r
- <item>200</item>\r
- </col-widths>\r
- </CRunMessageRules>\r
- <Build>\r
- \r
- \r
- \r
- \r
- <ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build>\r
- <Debug-Log><ColumnWidth0>18</ColumnWidth0><ColumnWidth1>1624</ColumnWidth1></Debug-Log><TerminalIO/><Select-Ambiguous-Definitions><ColumnWidth0>552</ColumnWidth0><ColumnWidth1>78</ColumnWidth1><ColumnWidth2>946</ColumnWidth2></Select-Ambiguous-Definitions><Find-in-Files><ColumnWidth0>846</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>746</ColumnWidth2><ColumnWidth3>331</ColumnWidth3></Find-in-Files><Breakpoints><col-names><item>Breakpoint</item><item>_I0</item></col-names><col-widths><item>500</item><item>35</item></col-widths><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Breakpoints></Static>\r
- <Windows>\r
- \r
- \r
- <Wnd2>\r
- <Tabs>\r
- <Tab>\r
- <Identity>TabID-22351-19008</Identity>\r
- <TabName>Workspace</TabName>\r
- <Factory>Workspace</Factory>\r
- <Session>\r
- \r
- <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode></NodeDict></Session>\r
- </Tab>\r
- </Tabs>\r
- \r
- <SelectedTab>0</SelectedTab></Wnd2><Wnd3>\r
- <Tabs>\r
- <Tab>\r
- <Identity>TabID-21076-19237</Identity>\r
- <TabName>Build</TabName>\r
- <Factory>Build</Factory>\r
- <Session/>\r
- </Tab>\r
- <Tab><Identity>TabID-23502-23081</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab><Tab><Identity>TabID-24431-23894</Identity><TabName>Ambiguous Definitions</TabName><Factory>Select-Ambiguous-Definitions</Factory><Session/></Tab><Tab><Identity>TabID-9033-6116</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs>\r
- \r
- <SelectedTab>0</SelectedTab></Wnd3></Windows>\r
- <Editor>\r
- \r
- \r
- \r
- \r
- <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>5118</SelStart2><SelEnd2>5118</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\blinky_demo\main_blinky.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>0</SelStart2><SelEnd2>0</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\main_full.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>924</SelStart2><SelEnd2>924</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
- <Positions>\r
- \r
- \r
- \r
- \r
- \r
- <Top><Row0><Sizes><Toolbar-002781D8><key>iaridepm.enu1</key></Toolbar-002781D8></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>668</Bottom><Right>352</Right><x>-2</x><y>-2</y><xscreen>190</xscreen><yscreen>170</yscreen><sizeHorzCX>113095</sizeHorzCX><sizeHorzCY>172764</sizeHorzCY><sizeVertCX>210714</sizeVertCX><sizeVertCY>680894</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>272</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>274</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>278455</sizeHorzCY><sizeVertCX>113095</sizeVertCX><sizeVertCY>172764</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
- </Desktop>\r
+ <ConfigDictionary>\r
+ <CurrentConfigs>\r
+ <Project>RTOSDemo/sram</Project>\r
+ </CurrentConfigs>\r
+ </ConfigDictionary>\r
+ <Desktop>\r
+ <Static>\r
+ <Workspace>\r
+ <ColumnWidths>\r
+ <Column0>278</Column0>\r
+ <Column1>27</Column1>\r
+ <Column2>27</Column2>\r
+ <Column3>27</Column3>\r
+ </ColumnWidths>\r
+ </Workspace>\r
+ <CRunMessageRules>\r
+ <col-names>\r
+ <item>Action</item>\r
+ <item>Check</item>\r
+ <item>Source File</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>100</item>\r
+ <item>400</item>\r
+ <item>200</item>\r
+ </col-widths>\r
+ </CRunMessageRules>\r
+ <Build>\r
+ <ColumnWidth0>20</ColumnWidth0>\r
+ <ColumnWidth1>1216</ColumnWidth1>\r
+ <ColumnWidth2>324</ColumnWidth2>\r
+ <ColumnWidth3>81</ColumnWidth3>\r
+ </Build>\r
+ <Debug-Log>\r
+ <ColumnWidth0>18</ColumnWidth0>\r
+ <ColumnWidth1>1624</ColumnWidth1>\r
+ </Debug-Log>\r
+ <TerminalIO />\r
+ <Select-Ambiguous-Definitions>\r
+ <ColumnWidth0>552</ColumnWidth0>\r
+ <ColumnWidth1>78</ColumnWidth1>\r
+ <ColumnWidth2>946</ColumnWidth2>\r
+ </Select-Ambiguous-Definitions>\r
+ <Find-in-Files>\r
+ <ColumnWidth0>846</ColumnWidth0>\r
+ <ColumnWidth1>82</ColumnWidth1>\r
+ <ColumnWidth2>746</ColumnWidth2>\r
+ <ColumnWidth3>331</ColumnWidth3>\r
+ </Find-in-Files>\r
+ <Breakpoints>\r
+ <col-names>\r
+ <item>Breakpoint</item>\r
+ <item>_I0</item>\r
+ </col-names>\r
+ <col-widths>\r
+ <item>500</item>\r
+ <item>35</item>\r
+ </col-widths>\r
+ <PreferedWindows>\r
+ <Position>3</Position>\r
+ <ScreenPosX>0</ScreenPosX>\r
+ <ScreenPosY>0</ScreenPosY>\r
+ <Windows />\r
+ </PreferedWindows>\r
+ </Breakpoints>\r
+ </Static>\r
+ <Windows>\r
+ <Wnd2>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-22351-19008</Identity>\r
+ <TabName>Workspace</TabName>\r
+ <Factory>Workspace</Factory>\r
+ <Session>\r
+ <NodeDict>\r
+ <ExpandedNode>RTOSDemo</ExpandedNode>\r
+ </NodeDict>\r
+ </Session>\r
+ </Tab>\r
+ </Tabs>\r
+ <SelectedTab>0</SelectedTab>\r
+ </Wnd2>\r
+ <Wnd3>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-21076-19237</Identity>\r
+ <TabName>Build</TabName>\r
+ <Factory>Build</Factory>\r
+ <Session />\r
+ </Tab>\r
+ <Tab>\r
+ <Identity>TabID-23502-23081</Identity>\r
+ <TabName>Debug Log</TabName>\r
+ <Factory>Debug-Log</Factory>\r
+ <Session />\r
+ </Tab>\r
+ <Tab>\r
+ <Identity>TabID-24431-23894</Identity>\r
+ <TabName>Ambiguous Definitions</TabName>\r
+ <Factory>Select-Ambiguous-Definitions</Factory>\r
+ <Session />\r
+ </Tab>\r
+ <Tab>\r
+ <Identity>TabID-9033-6116</Identity>\r
+ <TabName>Find in Files</TabName>\r
+ <Factory>Find-in-Files</Factory>\r
+ <Session />\r
+ </Tab>\r
+ </Tabs>\r
+ <SelectedTab>0</SelectedTab>\r
+ </Wnd3>\r
+ </Windows>\r
+ <Editor>\r
+ <Pane>\r
+ <Tab>\r
+ <Factory>TextEditor</Factory>\r
+ <Filename>$WS_DIR$\main.c</Filename>\r
+ <XPos>0</XPos>\r
+ <YPos>0</YPos>\r
+ <SelStart>0</SelStart>\r
+ <SelEnd>0</SelEnd>\r
+ <XPos2>0</XPos2>\r
+ <YPos2>63</YPos2>\r
+ <SelStart2>5118</SelStart2>\r
+ <SelEnd2>5118</SelEnd2>\r
+ </Tab>\r
+ <ActiveTab>0</ActiveTab>\r
+ <Tab>\r
+ <Factory>TextEditor</Factory>\r
+ <Filename>$WS_DIR$\blinky_demo\main_blinky.c</Filename>\r
+ <XPos>0</XPos>\r
+ <YPos>0</YPos>\r
+ <SelStart>0</SelStart>\r
+ <SelEnd>0</SelEnd>\r
+ <XPos2>0</XPos2>\r
+ <YPos2>63</YPos2>\r
+ <SelStart2>0</SelStart2>\r
+ <SelEnd2>0</SelEnd2>\r
+ </Tab>\r
+ <Tab>\r
+ <Factory>TextEditor</Factory>\r
+ <Filename>$WS_DIR$\Full_Demo\main_full.c</Filename>\r
+ <XPos>0</XPos>\r
+ <YPos>0</YPos>\r
+ <SelStart>0</SelStart>\r
+ <SelEnd>0</SelEnd>\r
+ <XPos2>0</XPos2>\r
+ <YPos2>63</YPos2>\r
+ <SelStart2>924</SelStart2>\r
+ <SelEnd2>924</SelEnd2>\r
+ </Tab>\r
+ </Pane>\r
+ <ActivePane>0</ActivePane>\r
+ <Sizes>\r
+ <Pane>\r
+ <X>1000000</X>\r
+ <Y>1000000</Y>\r
+ </Pane>\r
+ </Sizes>\r
+ <SplitMode>1</SplitMode>\r
+ </Editor>\r
+ <Positions>\r
+ <Top>\r
+ <Row0>\r
+ <Sizes>\r
+ <Toolbar-002781D8>\r
+ <key>iaridepm.enu1</key>\r
+ </Toolbar-002781D8>\r
+ </Sizes>\r
+ </Row0>\r
+ <Row1>\r
+ <Sizes />\r
+ </Row1>\r
+ </Top>\r
+ <Left>\r
+ <Row0>\r
+ <Sizes>\r
+ <Wnd2>\r
+ <Rect>\r
+ <Top>-2</Top>\r
+ <Left>-2</Left>\r
+ <Bottom>668</Bottom>\r
+ <Right>352</Right>\r
+ <x>-2</x>\r
+ <y>-2</y>\r
+ <xscreen>190</xscreen>\r
+ <yscreen>170</yscreen>\r
+ <sizeHorzCX>113095</sizeHorzCX>\r
+ <sizeHorzCY>172764</sizeHorzCY>\r
+ <sizeVertCX>210714</sizeVertCX>\r
+ <sizeVertCY>680894</sizeVertCY>\r
+ </Rect>\r
+ </Wnd2>\r
+ </Sizes>\r
+ </Row0>\r
+ </Left>\r
+ <Right>\r
+ <Row0>\r
+ <Sizes />\r
+ </Row0>\r
+ </Right>\r
+ <Bottom>\r
+ <Row0>\r
+ <Sizes>\r
+ <Wnd3>\r
+ <Rect>\r
+ <Top>-2</Top>\r
+ <Left>-2</Left>\r
+ <Bottom>272</Bottom>\r
+ <Right>1682</Right>\r
+ <x>-2</x>\r
+ <y>-2</y>\r
+ <xscreen>1684</xscreen>\r
+ <yscreen>274</yscreen>\r
+ <sizeHorzCX>1002381</sizeHorzCX>\r
+ <sizeHorzCY>278455</sizeHorzCY>\r
+ <sizeVertCX>113095</sizeVertCX>\r
+ <sizeVertCY>172764</sizeVertCY>\r
+ </Rect>\r
+ </Wnd3>\r
+ </Sizes>\r
+ </Row0>\r
+ </Bottom>\r
+ <Float>\r
+ <Sizes />\r
+ </Float>\r
+ </Positions>\r
+ </Desktop>\r
+ <WindowStorage>\r
+ <ChildIdMap>\r
+ <TB_CMSISPACK>34048</TB_CMSISPACK>\r
+ <TB_MAIN>34049</TB_MAIN>\r
+ <WIN_BREAKPOINTS>34050</WIN_BREAKPOINTS>\r
+ <WIN_BUILD>34051</WIN_BUILD>\r
+ <WIN_CALL_GRAPH>34052</WIN_CALL_GRAPH>\r
+ <WIN_CMSISPACK_AGENT_LOG>34053</WIN_CMSISPACK_AGENT_LOG>\r
+ <WIN_CUSTOM_SFR>34054</WIN_CUSTOM_SFR>\r
+ <WIN_C_STAT>34055</WIN_C_STAT>\r
+ <WIN_DEBUG_LOG>34056</WIN_DEBUG_LOG>\r
+ <WIN_FIND_ALL_DECLARATIONS>34057</WIN_FIND_ALL_DECLARATIONS>\r
+ <WIN_FIND_ALL_REFERENCES>34058</WIN_FIND_ALL_REFERENCES>\r
+ <WIN_FIND_IN_FILES>34059</WIN_FIND_IN_FILES>\r
+ <WIN_SELECT_AMBIGUOUS_DEFINITIONS>34060</WIN_SELECT_AMBIGUOUS_DEFINITIONS>\r
+ <WIN_SOURCE_BROWSER>34061</WIN_SOURCE_BROWSER>\r
+ <WIN_TOOL_OUTPUT>34062</WIN_TOOL_OUTPUT>\r
+ <WIN_WORKSPACE>34063</WIN_WORKSPACE>\r
+ </ChildIdMap>\r
+ <Desktop>\r
+ <IarPane-34048>\r
+ <ToolBarCmdIds>\r
+ <item>34000</item>\r
+ <item>34001</item>\r
+ <item>0</item>\r
+ </ToolBarCmdIds>\r
+ </IarPane-34048>\r
+ <IarPane-34049>\r
+ <ToolBarCmdIds>\r
+ <item>57600</item>\r
+ <item>57601</item>\r
+ <item>57603</item>\r
+ <item>33024</item>\r
+ <item>0</item>\r
+ <item>57607</item>\r
+ <item>0</item>\r
+ <item>57635</item>\r
+ <item>57634</item>\r
+ <item>57637</item>\r
+ <item>0</item>\r
+ <item>57643</item>\r
+ <item>57644</item>\r
+ <item>0</item>\r
+ <item>33090</item>\r
+ <item>33057</item>\r
+ <item>57636</item>\r
+ <item>57640</item>\r
+ <item>57641</item>\r
+ <item>33026</item>\r
+ <item>33065</item>\r
+ <item>33063</item>\r
+ <item>33064</item>\r
+ <item>33053</item>\r
+ <item>33054</item>\r
+ <item>0</item>\r
+ <item>33035</item>\r
+ <item>33036</item>\r
+ <item>34399</item>\r
+ <item>0</item>\r
+ <item>33038</item>\r
+ <item>33039</item>\r
+ <item>0</item>\r
+ </ToolBarCmdIds>\r
+ </IarPane-34049>\r
+ <IarPane-34056>\r
+ <ColumnWidth0>21</ColumnWidth0>\r
+ <ColumnWidth1>1862</ColumnWidth1>\r
+ <FilterLevel>2</FilterLevel>\r
+ <LiveFile></LiveFile>\r
+ <LiveLogEnabled>0</LiveLogEnabled>\r
+ <LiveFilterLevel>-1</LiveFilterLevel>\r
+ </IarPane-34056>\r
+ <IarPane-34063>\r
+ <ColumnWidths>\r
+ <Column0>208</Column0>\r
+ <Column1>30</Column1>\r
+ <Column2>30</Column2>\r
+ <Column3>30</Column3>\r
+ </ColumnWidths>\r
+ <NodeDict>\r
+ <ExpandedNode>RTOSDemo</ExpandedNode>\r
+ </NodeDict>\r
+ </IarPane-34063>\r
+ <ControlBarVersion>\r
+ <Major>14</Major>\r
+ <Minor>11</Minor>\r
+ </ControlBarVersion>\r
+ <MFCToolBarParameters>\r
+ <Tooltips>1</Tooltips>\r
+ <ShortcutKeys>1</ShortcutKeys>\r
+ <LargeIcons>0</LargeIcons>\r
+ <MenuAnimation>0</MenuAnimation>\r
+ <RecentlyUsedMenus>1</RecentlyUsedMenus>\r
+ <MenuShadows>1</MenuShadows>\r
+ <ShowAllMenusAfterDelay>1</ShowAllMenusAfterDelay>\r
+ <CommandsUsage>0100000001000D81000001000000</CommandsUsage>\r
+ </MFCToolBarParameters>\r
+ <CommandManager>\r
+ <CommandsWithoutImages>09000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000D4840000</CommandsWithoutImages>\r
+ <MenuUserImages>04000E8400005100000030840000530000000B810000200000000D81000022000000</MenuUserImages>\r
+ </CommandManager>\r
+ <Pane-59393>\r
+ <ID>0</ID>\r
+ <RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
+ <RectRecentDocked>00000000DC03000080070000F5030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-59393>\r
+ <BasePane-59393>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane-59393>\r
+ <Pane-34050>\r
+ <ID>34050</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>000000000000000036010000DB000000</RectRecentDocked>\r
+ <RecentFrameAlignment>32768</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34050>\r
+ <BasePane-34050>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34050>\r
+ <IarPane-34050 />\r
+ <Pane--1>\r
+ <ID>4294967295</ID>\r
+ <RectRecentFloat>0000000056000000180100001A030000</RectRecentFloat>\r
+ <RectRecentDocked>000000003900000018010000FD020000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane--1>\r
+ <BasePane--1>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane--1>\r
+ <Pane-34051>\r
+ <ID>34051</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>32768</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34051>\r
+ <BasePane-34051>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane-34051>\r
+ <IarPane-34051>\r
+ <ColumnWidth0>21</ColumnWidth0>\r
+ <ColumnWidth1>1399</ColumnWidth1>\r
+ <ColumnWidth2>373</ColumnWidth2>\r
+ <ColumnWidth3>93</ColumnWidth3>\r
+ <FilterLevel>2</FilterLevel>\r
+ <LiveFile>C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_A5_SAMA5D3x_Xplained_IAR\BuildLog.log</LiveFile>\r
+ <LiveLogEnabled>0</LiveLogEnabled>\r
+ <LiveFilterLevel>-1</LiveFilterLevel>\r
+ </IarPane-34051>\r
+ <Pane-34053>\r
+ <ID>34053</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34053>\r
+ <BasePane-34053>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34053>\r
+ <IarPane-34053 />\r
+ <Pane-34056>\r
+ <ID>34056</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34056>\r
+ <BasePane-34056>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane-34056>\r
+ <Pane-34057>\r
+ <ID>34057</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34057>\r
+ <BasePane-34057>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34057>\r
+ <IarPane-34057 />\r
+ <Pane-34058>\r
+ <ID>34058</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34058>\r
+ <BasePane-34058>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34058>\r
+ <IarPane-34058 />\r
+ <Pane-34059>\r
+ <ID>34059</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34059>\r
+ <BasePane-34059>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34059>\r
+ <IarPane-34059 />\r
+ <Pane-34060>\r
+ <ID>34060</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34060>\r
+ <BasePane-34060>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34060>\r
+ <IarPane-34060 />\r
+ <Pane-34062>\r
+ <ID>34062</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34062>\r
+ <BasePane-34062>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34062>\r
+ <IarPane-34062 />\r
+ <Pane-34052>\r
+ <ID>34052</ID>\r
+ <RectRecentFloat>000000001D000000AD020000D0000000</RectRecentFloat>\r
+ <RectRecentDocked>0000000000000000AD020000B3000000</RectRecentDocked>\r
+ <RecentFrameAlignment>32768</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34052>\r
+ <BasePane-34052>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34052>\r
+ <IarPane-34052 />\r
+ <Pane-34054>\r
+ <ID>34054</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>000000000000000036010000DB000000</RectRecentDocked>\r
+ <RecentFrameAlignment>32768</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34054>\r
+ <BasePane-34054>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34054>\r
+ <IarPane-34054 />\r
+ <Pane-34055>\r
+ <ID>34055</ID>\r
+ <RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
+ <RectRecentDocked>000000000000000036010000DB000000</RectRecentDocked>\r
+ <RecentFrameAlignment>32768</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34055>\r
+ <BasePane-34055>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34055>\r
+ <IarPane-34055 />\r
+ <Pane-34061>\r
+ <ID>34061</ID>\r
+ <RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
+ <RectRecentDocked>040000005A00000014010000DD020000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34061>\r
+ <BasePane-34061>\r
+ <IsVisible>0</IsVisible>\r
+ </BasePane-34061>\r
+ <IarPane-34061>\r
+ <TypeFilter>2147483647</TypeFilter>\r
+ <FileFilter>1</FileFilter>\r
+ </IarPane-34061>\r
+ <Pane-34063>\r
+ <ID>34063</ID>\r
+ <RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
+ <RectRecentDocked>000000005600000018010000FD020000</RectRecentDocked>\r
+ <RecentFrameAlignment>4096</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>32767</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34063>\r
+ <BasePane-34063>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane-34063>\r
+ <DockingManager-256>\r
+ <DockingPaneAndPaneDividers>000000000C000000000000000010000001000000FFFFFFFFFFFFFFFF18010000390000001C010000FD020000010000000200001004000000010000000000000000000000FFFFFFFF020000000D8500000F850000FFFF02000B004354616262656450616E6500100000010000000000000056000000180100001A030000000000003900000018010000FD020000000000004010005602000000FFFEFF1C53006F0075007200630065002000420072006F00770073006500720020002D0020004E006F007400200065006E00610062006C0065006400000000000D85000001000000FFFFFFFFFFFFFFFFFFFEFF0957006F0072006B0073007000610063006500010000000F85000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0D85000001000000FFFFFFFF0D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF00000000FD0200008007000001030000010000000100001004000000010000000000000000000000FFFFFFFF08000000038500000585000008850000098500000A8500000B8500000C8500000E85000001800080000001000000000000001E03000080070000F9030000000000000103000080070000DC030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF0E43004D005300490053002D005000610063006B0020004C006F006700000000000585000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000</DockingPaneAndPaneDividers>\r
+ </DockingManager-256>\r
+ <MFCToolBar-34048>\r
+ <Name>CMSIS-Pack</Name>\r
+ <Buttons>00200000010000000200FFFF01001100434D4643546F6F6C426172427574746F6ED0840000000004000C000000FFFEFF0000000000000000000000000001000000010000000180D1840000000000000D000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B002F000000</Buttons>\r
+ </MFCToolBar-34048>\r
+ <Pane-34048>\r
+ <ID>34048</ID>\r
+ <RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
+ <RectRecentDocked>0003000000000000470300001C000000</RectRecentDocked>\r
+ <RecentFrameAlignment>8192</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>47</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34048>\r
+ <BasePane-34048>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane-34048>\r
+ <MFCToolBar-34049>\r
+ <Name>Main</Name>\r
+ <Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000032000000FFFEFF000000000000000000000000000100000001000000018001E100000000000033000000FFFEFF000000000000000000000000000100000001000000018003E100000000040035000000FFFEFF0000000000000000000000000001000000010000000180008100000000000016000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000040038000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003A000000FFFEFF000000000000000000000000000100000001000000018022E100000000040039000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE10000000004003F000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040040000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0001000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF00960000000000000000000180218100000000040029000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003B000000FFFEFF000000000000000000000000000100000001000000018028E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018029E10000000004003E000000FFFEFF0000000000000000000000000001000000010000000180028100000000040018000000FFFEFF000000000000000000000000000100000001000000018029810000000004002D000000FFFEFF000000000000000000000000000100000001000000018027810000000004002B000000FFFEFF000000000000000000000000000100000001000000018028810000000004002C000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040025000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040026000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001C000000FFFEFF00000000000000000000000000010000000100000001800C810000000000001D000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000031000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E810000000000001F000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000020000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>\r
+ </MFCToolBar-34049>\r
+ <Pane-34049>\r
+ <ID>34049</ID>\r
+ <RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
+ <RectRecentDocked>0000000000000000000300001D000000</RectRecentDocked>\r
+ <RecentFrameAlignment>8192</RecentFrameAlignment>\r
+ <RecentRowIndex>0</RecentRowIndex>\r
+ <IsFloating>0</IsFloating>\r
+ <MRUWidth>744</MRUWidth>\r
+ <PinState>0</PinState>\r
+ </Pane-34049>\r
+ <BasePane-34049>\r
+ <IsVisible>1</IsVisible>\r
+ </BasePane-34049>\r
+ </Desktop>\r
+ <MDIWindows>\r
+ <MDIClientArea-0>\r
+ <MDITabsState>01000000030000000100000000000000000000000100000001000000FFFFFFFF00000000010000000100000000000000280000002800000000000000</MDITabsState>\r
+ </MDIClientArea-0>\r
+ </MDIWindows>\r
+ </WindowStorage>\r
</Workspace>\r
-\r
-\r
<name>General</name>\r
<archiveVersion>3</archiveVersion>\r
<data>\r
- <version>29</version>\r
+ <version>30</version>\r
<wantNonLocal>1</wantNonLocal>\r
<debug>1</debug>\r
<option>\r
<name>DSPExtension</name>\r
<state>0</state>\r
</option>\r
+ <option>\r
+ <name>TrustZone</name>\r
+ <state>0</state>\r
+ </option>\r
</data>\r
</settings>\r
<settings>\r
<name>General</name>\r
<archiveVersion>3</archiveVersion>\r
<data>\r
- <version>29</version>\r
+ <version>30</version>\r
<wantNonLocal>1</wantNonLocal>\r
<debug>1</debug>\r
<option>\r
</option>\r
<option>\r
<name>Input description</name>\r
- <state>No specifier n, no float nor long long, no scan set, no assignment suppressing.</state>\r
+ <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>\r
</option>\r
<option>\r
<name>Output description</name>\r
- <state>No specifier a, A, no specifier n, no float nor long long.</state>\r
+ <state>No specifier a, A, no specifier n, no float nor long long, without multibyte support.</state>\r
</option>\r
<option>\r
<name>GOutputBinary</name>\r
</option>\r
<option>\r
<name>OGLastSavedByProductVersion</name>\r
- <state>8.20.1.14181</state>\r
+ <state>8.22.1.15696</state>\r
</option>\r
<option>\r
<name>GeneralEnableMisra</name>\r
<option>\r
<name>GBECoreSlave</name>\r
<version>26</version>\r
- <state>51</state>\r
+ <state>50</state>\r
</option>\r
<option>\r
<name>OGUseCmsis</name>\r
<name>DSPExtension</name>\r
<state>0</state>\r
</option>\r
+ <option>\r
+ <name>TrustZone</name>\r
+ <state>1</state>\r
+ </option>\r
</data>\r
</settings>\r
<settings>\r
<name>AUserIncludes</name>\r
<state>$PROJ_DIR$\..\..\..\libraries</state>\r
<state>$PROJ_DIR$/.</state>\r
+ <state>$PROJ_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC</state>\r
</option>\r
<option>\r
<name>AExtraOptionsCheckV2</name>\r
<ColumnWidth0>21</ColumnWidth0>\r
<ColumnWidth1>1862</ColumnWidth1>\r
<FilterLevel>2</FilterLevel>\r
- <LiveFile></LiveFile>\r
+ <LiveFile />\r
<LiveLogEnabled>0</LiveLogEnabled>\r
<LiveFilterLevel>-1</LiveFilterLevel>\r
</IarPane-34056>\r
</IarPane-34063>\r
<ControlBarVersion>\r
<Major>14</Major>\r
- <Minor>10</Minor>\r
+ <Minor>11</Minor>\r
</ControlBarVersion>\r
<MFCToolBarParameters>\r
<Tooltips>1</Tooltips>\r
<RecentlyUsedMenus>1</RecentlyUsedMenus>\r
<MenuShadows>1</MenuShadows>\r
<ShowAllMenusAfterDelay>1</ShowAllMenusAfterDelay>\r
- <CommandsUsage>000000000000</CommandsUsage>\r
+ <CommandsUsage>0100000001000D81000001000000</CommandsUsage>\r
</MFCToolBarParameters>\r
<CommandManager>\r
- <CommandsWithoutImages>060020F1000010F0000000F0000020F0000030F0000060F00000</CommandsWithoutImages>\r
- <MenuUserImages>0000</MenuUserImages>\r
+ <CommandsWithoutImages>110020F1000010F0000000F0000020F0000030F0000060F000000D8400000F84000008840000FFFFFFFF54840000328100001C81000009840000D48400000E84000030840000</CommandsWithoutImages>\r
+ <MenuUserImages>02000B8100001C0000000D8100001E000000</MenuUserImages>\r
</CommandManager>\r
<Pane-59393>\r
<ID>0</ID>\r
<IarPane-34050 />\r
<Pane--1>\r
<ID>4294967295</ID>\r
- <RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
- <RectRecentDocked>000000003900000018010000FD020000</RectRecentDocked>\r
+ <RectRecentFloat>0000000073000000180100001A030000</RectRecentFloat>\r
+ <RectRecentDocked>000000005600000018010000FD020000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34053>\r
<ID>34053</ID>\r
<RectRecentFloat>000000001D00000036010000F8000000</RectRecentFloat>\r
- <RectRecentDocked>000000001E03000080070000DC030000</RectRecentDocked>\r
+ <RectRecentDocked>04000000220300007C070000BC030000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<Pane-34061>\r
<ID>34061</ID>\r
<RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
- <RectRecentDocked>040000005A00000014010000D0010000</RectRecentDocked>\r
+ <RectRecentDocked>040000007700000014010000DD020000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<BasePane-34061>\r
<IsVisible>0</IsVisible>\r
</BasePane-34061>\r
- <IarPane-34061 />\r
+ <IarPane-34061>\r
+ <TypeFilter>2147483647</TypeFilter>\r
+ <FileFilter>1</FileFilter>\r
+ </IarPane-34061>\r
<Pane-34063>\r
<ID>34063</ID>\r
<RectRecentFloat>000000001D00000018010000D4010000</RectRecentFloat>\r
- <RectRecentDocked>000000005600000018010000FD020000</RectRecentDocked>\r
+ <RectRecentDocked>000000007300000018010000FD020000</RectRecentDocked>\r
<RecentFrameAlignment>4096</RecentFrameAlignment>\r
<RecentRowIndex>0</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
<IsVisible>1</IsVisible>\r
</BasePane-34063>\r
<DockingManager-256>\r
- <DockingPaneAndPaneDividers>000000000C000000000000000010000001000000FFFFFFFFFFFFFFFF18010000390000001C010000FD020000010000000200001004000000010000000000000000000000FFFFFFFF020000000D8500000F850000FFFF02000B004354616262656450616E650010000001000000000000001D00000018010000D4010000000000003900000018010000FD020000000000004010005602000000FFFEFF0E53006F0075007200630065002000420072006F007700730065007200000000000D85000001000000FFFFFFFFFFFFFFFFFFFEFF0957006F0072006B0073007000610063006500010000000F85000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0D85000001000000FFFFFFFF0D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF00000000FD0200008007000001030000010000000100001004000000010000000000000000000000FFFFFFFF08000000038500000585000008850000098500000A8500000B8500000C8500000E85000001800080000001000000000000001D00000036010000F8000000000000000103000080070000DC030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF0E43004D005300490053002D005000610063006B0020004C006F006700000000000585000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100001004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000</DockingPaneAndPaneDividers>\r
+ <DockingPaneAndPaneDividers>000000000C000000000000000010000001000000FFFFFFFFFFFFFFFF18010000560000001C010000FD020000010000000200001004000000010000000000000000000000FFFFFFFF020000000D8500000F850000FFFF02000B004354616262656450616E6500100000010000000000000073000000180100001A030000000000005600000018010000FD020000000000004010005602000000FFFEFF1C53006F0075007200630065002000420072006F00770073006500720020002D0020004E006F007400200065006E00610062006C0065006400000000000D85000001000000FFFFFFFFFFFFFFFFFFFEFF0957006F0072006B0073007000610063006500010000000F85000001000000FFFFFFFFFFFFFFFF01000000000000000000000000000000000000000000000001000000FFFFFFFF0D85000001000000FFFFFFFF0D850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000078500000000000000000000000000000000000001000000078500000100000007850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000068500000000000000000000000000000000000001000000068500000100000006850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000048500000000000000000000000000000000000001000000048500000100000004850000000000000080000001000000FFFFFFFFFFFFFFFF00000000FD0200008007000001030000010000000100001004000000010000000000000000000000FFFFFFFF08000000038500000585000008850000098500000A8500000B8500000C8500000E85000001800080000001000000000000001E03000080070000F9030000000000000103000080070000DC030000000000004080005608000000FFFEFF054200750069006C006400010000000385000001000000FFFFFFFFFFFFFFFFFFFEFF0E43004D005300490053002D005000610063006B0020004C006F006700000000000585000001000000FFFFFFFFFFFFFFFFFFFEFF094400650062007500670020004C006F006700010000000885000001000000FFFFFFFFFFFFFFFFFFFEFF0C4400650063006C00610072006100740069006F006E007300000000000985000001000000FFFFFFFFFFFFFFFFFFFEFF0A5200650066006500720065006E00630065007300000000000A85000001000000FFFFFFFFFFFFFFFFFFFEFF0D460069006E006400200069006E002000460069006C0065007300000000000B85000001000000FFFFFFFFFFFFFFFFFFFEFF1541006D0062006900670075006F0075007300200044006500660069006E006900740069006F006E007300000000000C85000001000000FFFFFFFFFFFFFFFFFFFEFF0B54006F006F006C0020004F0075007400700075007400000000000E85000001000000FFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000001000000FFFFFFFF0385000001000000FFFFFFFF03850000000000000080000000000000FFFFFFFFFFFFFFFF00000000000000000400000004000000000000000100000004000000010000000000000000000000028500000000000000000000000000000000000001000000028500000100000002850000000000000000000000000000</DockingPaneAndPaneDividers>\r
</DockingManager-256>\r
<MFCToolBar-34048>\r
<Name>CMSIS-Pack</Name>\r
- <Buttons>00200000010000000200FFFF01001100434D4643546F6F6C426172427574746F6ED0840000000004000C000000FFFEFF0000000000000000000000000001000000010000000180D1840000000000000D000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B00FF7F0000</Buttons>\r
+ <Buttons>00200000010000000200FFFF01001100434D4643546F6F6C426172427574746F6ED0840000000004000C000000FFFEFF0000000000000000000000000001000000010000000180D1840000000000000D000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF0A43004D005300490053002D005000610063006B002F000000</Buttons>\r
</MFCToolBar-34048>\r
<Pane-34048>\r
<ID>34048</ID>\r
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
- <RectRecentDocked>000300001C0000004703000038000000</RectRecentDocked>\r
+ <RectRecentDocked>000300001D0000004703000039000000</RectRecentDocked>\r
<RecentFrameAlignment>8192</RecentFrameAlignment>\r
<RecentRowIndex>1</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
- <MRUWidth>32767</MRUWidth>\r
+ <MRUWidth>47</MRUWidth>\r
<PinState>0</PinState>\r
</Pane-34048>\r
<BasePane-34048>\r
</BasePane-34048>\r
<MFCToolBar-34049>\r
<Name>Main</Name>\r
- <Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000036000000FFFEFF000000000000000000000000000100000001000000018001E100000000000037000000FFFEFF000000000000000000000000000100000001000000018003E100000000040039000000FFFEFF000000000000000000000000000100000001000000018000810000000000001A000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018025E100000000040040000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040043000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040044000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002D000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003F000000FFFEFF000000000000000000000000000100000001000000018028E100000000040041000000FFFEFF000000000000000000000000000100000001000000018029E100000000040042000000FFFEFF000000000000000000000000000100000001000000018002810000000004001C000000FFFEFF0000000000000000000000000001000000010000000180298100000000040031000000FFFEFF000000000000000000000000000100000001000000018027810000000004002F000000FFFEFF0000000000000000000000000001000000010000000180288100000000040030000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040029000000FFFEFF00000000000000000000000000010000000100000001801E810000000004002A000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B8100000000040020000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000021000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000035000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000023000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000024000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF7F0000</Buttons>\r
+ <Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000032000000FFFEFF000000000000000000000000000100000001000000018001E100000000000033000000FFFEFF000000000000000000000000000100000001000000018003E100000000040035000000FFFEFF0000000000000000000000000001000000010000000180008100000000000016000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000040038000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003A000000FFFEFF000000000000000000000000000100000001000000018022E100000000040039000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003C000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE10000000004003F000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040040000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF00960000000000000000000180218100000000040029000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003B000000FFFEFF000000000000000000000000000100000001000000018028E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018029E10000000004003E000000FFFEFF0000000000000000000000000001000000010000000180028100000000040018000000FFFEFF000000000000000000000000000100000001000000018029810000000004002D000000FFFEFF000000000000000000000000000100000001000000018027810000000004002B000000FFFEFF000000000000000000000000000100000001000000018028810000000004002C000000FFFEFF00000000000000000000000000010000000100000001801D8100000000000025000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040026000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001C000000FFFEFF00000000000000000000000000010000000100000001800C810000000000001D000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000031000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E810000000000001F000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000020000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>\r
</MFCToolBar-34049>\r
<Pane-34049>\r
<ID>34049</ID>\r
<RectRecentFloat>0A0000000A0000006E0000006E000000</RectRecentFloat>\r
- <RectRecentDocked>000000001C0000000003000039000000</RectRecentDocked>\r
+ <RectRecentDocked>000000001D000000000300003A000000</RectRecentDocked>\r
<RecentFrameAlignment>8192</RecentFrameAlignment>\r
<RecentRowIndex>1</RecentRowIndex>\r
<IsFloating>0</IsFloating>\r
- <MRUWidth>32767</MRUWidth>\r
+ <MRUWidth>744</MRUWidth>\r
<PinState>0</PinState>\r
</Pane-34049>\r
<BasePane-34049>\r
</Desktop>\r
<MDIWindows>\r
<MDIClientArea-0>\r
- <MDITabsState>01000000030000000100000000000000000000000100000001000000FFFFFFFF00000000010000000100000000000000280000002800000000000000</MDITabsState>\r
+ <MDITabsState>01000000030000000100000000000000000000000100000001000000FFFFFFFF00000000010000000100000000000000280000002800000001000000010000000000000001000000FFFEFF302400570053005F0044004900520024005C00410074006D0065006C00460069006C00650073005C006C006900620063006800690070005F00730061006D00610035006400340078005C0063007000310035005C0063007000310035002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF28013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003300300030003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0038003200380035003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0038003200380035003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0663007000310035002E00630000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000001C01000073000000800700001A030000</MDITabsState>\r
</MDIClientArea-0>\r
</MDIWindows>\r
</WindowStorage>\r
<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<?fileVersion 4.0.0?>\r
-\r
-<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">\r
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">\r
<storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">\r
<cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182">\r
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182" moduleId="org.eclipse.cdt.core.settings" name="RM48 without FPU">\r
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
</extensions>\r
</storageModule>\r
<storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex R.RM48L950"/>\r
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>\r
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>\r
- <listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.1.0.01"/>\r
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>\r
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=sys_link.cmd"/>\r
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=rtsv7R4_A_le_eabi.lib"/>\r
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>\r
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS.1096947129" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.2044031914" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease">\r
- <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.701787318" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" value=""${ProjName}.out"" valueType="string"/>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.701787318" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" useByScannerDiscovery="false" value="${ProjName}.out" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE.853894337" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE.1571165236" name="Input and output sections listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE.224741917" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY.2143651972" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY" valueType="libs">\r
<listOptionValue builtIn="false" value=""rtsv7R4_A_le_eabi.lib""/>\r
</option>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO.92463411" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO" useByScannerDiscovery="false" value="${ProjName}_linkInfo.xml" valueType="string"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS.1389326562" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS.663039353" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS.806247554" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS"/>\r
</tool>\r
</toolChain>\r
</folderInfo>\r
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
</extensions>\r
</storageModule>\r
<storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex R.RM48L950"/>\r
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>\r
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>\r
- <listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.1.0.01"/>\r
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>\r
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=sys_link.cmd"/>\r
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=rtsv7R4_T_le_v3D16_eabi.lib"/>\r
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>\r
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS.1217483725" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.501647685" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease">\r
- <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.1816223925" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" value=""${ProjName}.out"" valueType="string"/>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.1816223925" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" useByScannerDiscovery="false" value="${ProjName}.out" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE.467585369" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE.1733225483" name="Input and output sections listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE.240907091" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY.208988316" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY" valueType="libs">\r
<listOptionValue builtIn="false" value=""rtsv7R4_T_le_v3D16_eabi.lib""/>\r
</option>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO.1229765869" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO" useByScannerDiscovery="false" value="${ProjName}_linkInfo.xml" valueType="string"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS.112640407" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS.245615829" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS.1550865307" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS"/>\r
</tool>\r
</toolChain>\r
</folderInfo>\r
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
</extensions>\r
</storageModule>\r
<storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex R.TMS570LS3137"/>\r
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=be32"/>\r
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>\r
- <listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.1.0.01"/>\r
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>\r
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=sys_link.cmd"/>\r
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=rtsv7R4_A_be_v3D16_eabi.lib"/>\r
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.1950748541" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease">\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.ARM_BIG_ENDIAN_MODES.555757524" name="ARM big endian modes" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.ARM_BIG_ENDIAN_MODES" value="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.ARM_BIG_ENDIAN_MODES.BE32" valueType="enumerated"/>\r
- <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.1273595535" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" value=""${ProjName}.out"" valueType="string"/>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.1273595535" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" useByScannerDiscovery="false" value="${ProjName}.out" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE.923740600" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE.1947500930" name="Input and output sections listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE.1985952317" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY.842576254" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY" valueType="libs">\r
<listOptionValue builtIn="false" value=""rtsv7R4_A_be_v3D16_eabi.lib""/>\r
</option>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO.1144674016" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO" useByScannerDiscovery="false" value="${ProjName}_linkInfo.xml" valueType="string"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS.437118762" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS.193914583" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS.2107965915" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS"/>\r
</tool>\r
</toolChain>\r
</folderInfo>\r
- <fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182.2035527208.1562809246.sys_link.cmd" name="sys_link.cmd" rcbsApplicability="disable" resourcePath="sys_link.cmd" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.1950748541.894170726">\r
- <tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.1950748541.894170726" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.1950748541"/>\r
- </fileInfo>\r
<fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182.2035527208.1562809246.startup/sys_startup.c" name="sys_startup.c" rcbsApplicability="disable" resourcePath="startup/sys_startup.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1984463577.1507509410">\r
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1984463577.1507509410" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1984463577">\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compilerID.OPT_LEVEL.release.830908549" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compilerID.OPT_LEVEL.release" value="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compilerID.OPT_LEVEL.2" valueType="enumerated"/>\r
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>\r
</extensions>\r
</storageModule>\r
<storageModule moduleId="cdtBuildSystem" version="4.0.0">\r
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex R.TMS570LS3137"/>\r
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=be32"/>\r
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>\r
- <listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.1.0.01"/>\r
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>\r
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=sys_link.cmd"/>\r
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=rtsv7R4_A_be_eabi.lib"/>\r
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.84849131" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease">\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.ARM_BIG_ENDIAN_MODES.798175542" name="ARM big endian modes" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.ARM_BIG_ENDIAN_MODES" value="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.ARM_BIG_ENDIAN_MODES.BE32" valueType="enumerated"/>\r
- <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.543721384" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" value=""${ProjName}.out"" valueType="string"/>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE.543721384" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.OUTPUT_FILE" useByScannerDiscovery="false" value="${ProjName}.out" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE.1539464576" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.STACK_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE.1998840179" name="Input and output sections listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE.1003024716" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY.114880783" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.LIBRARY" valueType="libs">\r
<listOptionValue builtIn="false" value=""rtsv7R4_A_be_eabi.lib""/>\r
</option>\r
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO.96982868" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.linkerID.XML_LINK_INFO" useByScannerDiscovery="false" value="${ProjName}_linkInfo.xml" valueType="string"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS.1391090270" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS.749546672" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__CMD2_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS.1259946211" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exeLinker.inputType__GEN_CMDS"/>\r
</tool>\r
</toolChain>\r
</folderInfo>\r
- <fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182.2035527208.1562809246.662133471.845541724" name="comtest.c" rcbsApplicability="disable" resourcePath="Common-Demo-Source/comtest.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141.1142674897">\r
- <tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141.1142674897" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141">\r
- <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__C_SRCS.1465560373" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__C_SRCS"/>\r
- <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__CPP_SRCS.84439911" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__CPP_SRCS"/>\r
- <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM_SRCS.80582186" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM_SRCS"/>\r
- <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS.1077674308" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS"/>\r
- </tool>\r
- </fileInfo>\r
- <fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182.2035527208.1562809246.662133471.sys_link.cmd" name="sys_link.cmd" rcbsApplicability="disable" resourcePath="sys_link.cmd" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.84849131.2011026297">\r
- <tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.84849131.2011026297" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.linkerRelease.84849131"/>\r
- </fileInfo>\r
<fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182.2035527208.1562809246.662133471.startup/sys_startup.c" name="sys_startup.c" rcbsApplicability="disable" resourcePath="startup/sys_startup.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141.1888760656">\r
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141.1888760656" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141">\r
<option id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compilerID.OPT_LEVEL.release.1640008721" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compilerID.OPT_LEVEL.release" value="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compilerID.OPT_LEVEL.2" valueType="enumerated"/>\r
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS.807386460" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS"/>\r
</tool>\r
</fileInfo>\r
+ <fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.553048191.1928533182.2035527208.1562809246.662133471.845541724" name="comtest.c" rcbsApplicability="disable" resourcePath="Common-Demo-Source/comtest.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141.1142674897">\r
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141.1142674897" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.exe.compilerRelease.1979429141">\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__C_SRCS.1465560373" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__C_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__CPP_SRCS.84439911" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__CPP_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM_SRCS.80582186" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM_SRCS"/>\r
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS.1077674308" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_4.9.compiler.inputType__ASM2_SRCS"/>\r
+ </tool>\r
+ </fileInfo>\r
<sourceEntries>\r
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>\r
</sourceEntries>\r
</storageModule>\r
<storageModule moduleId="refreshScope"/>\r
<storageModule moduleId="scannerConfiguration"/>\r
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>\r
</cproject>\r