summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralfred gedeon <alfred2g@hotmail.com>2020-08-27 00:41:42 -0700
committerGitHub <noreply@github.com>2020-08-27 00:41:42 -0700
commit638262fab193f1ba4d67eaf76db36783db43aedc (patch)
treee2c29f2b73f3af0a56595ba7525858614dcda029
parenta9680a54cfd07cd35070301f284ab0c9c54cbf7e (diff)
downloadfreertos-git-638262fab193f1ba4d67eaf76db36783db43aedc.tar.gz
Fix Posix demo build and remove src directory (#213)
* Fix: build errors, remove src directory and bring all files up * Fix: Remove not needed header * Doc: fix main comments * Doc: fix comment Co-authored-by: Alfred Gedeon <gedeonag@amazon.com>
-rw-r--r--FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c1
-rw-r--r--FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h (renamed from FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/FreeRTOSIPConfig.h (renamed from FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h)614
-rw-r--r--FreeRTOS/Demo/Posix_GCC/SConscript (renamed from FreeRTOS/Demo/Posix_GCC/src/SConscript)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/SConstruct10
-rw-r--r--FreeRTOS/Demo/Posix_GCC/SimpleTCPEchoServer.c (renamed from FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c)576
-rw-r--r--FreeRTOS/Demo/Posix_GCC/TCPEchoClient_SingleTasks.c (renamed from FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c)744
-rw-r--r--FreeRTOS/Demo/Posix_GCC/TCPEchoClient_SingleTasks.h (renamed from FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h)80
-rw-r--r--FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c (renamed from FreeRTOS/Demo/Posix_GCC/src/code_coverage_additions.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/console.c (renamed from FreeRTOS/Demo/Posix_GCC/src/console.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/console.h (renamed from FreeRTOS/Demo/Posix_GCC/src/console.h)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/main.c (renamed from FreeRTOS/Demo/Posix_GCC/src/main.c)38
-rw-r--r--FreeRTOS/Demo/Posix_GCC/main_blinky.c (renamed from FreeRTOS/Demo/Posix_GCC/src/main_blinky.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/main_full.c (renamed from FreeRTOS/Demo/Posix_GCC/src/main_full.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/main_networking.c (renamed from FreeRTOS/Demo/Posix_GCC/src/main_networking.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c (renamed from FreeRTOS/Demo/Posix_GCC/src/run-time-stats-utils.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/trcConfig.h (renamed from FreeRTOS/Demo/Posix_GCC/src/trcConfig.h)2
-rw-r--r--FreeRTOS/Demo/Posix_GCC/trcSnapshotConfig.h (renamed from FreeRTOS/Demo/Posix_GCC/src/trcSnapshotConfig.h)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/utils/wait_for_event.c (renamed from FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.c)0
-rw-r--r--FreeRTOS/Demo/Posix_GCC/utils/wait_for_event.h (renamed from FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h)0
20 files changed, 1035 insertions, 1030 deletions
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c
index 41f28a0d2..04d956989 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c
@@ -44,7 +44,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <pthread.h>
#include <stdlib.h>
#include <ctype.h>
-#include <sys/sysinfo.h>
#include <signal.h>
#include <pcap.h>
diff --git a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h
index c85297250..c85297250 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h
diff --git a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h b/FreeRTOS/Demo/Posix_GCC/FreeRTOSIPConfig.h
index 261774fad..5926ff0ad 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h
+++ b/FreeRTOS/Demo/Posix_GCC/FreeRTOSIPConfig.h
@@ -1,307 +1,307 @@
-/*
- * FreeRTOS Kernel V10.3.0
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * http://www.FreeRTOS.org
- * http://aws.amazon.com/freertos
- *
- * 1 tab == 4 spaces!
- */
-
-
-/*****************************************************************************
- *
- * See the following URL for configuration information.
- * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
- *
- *****************************************************************************/
-
-#ifndef FREERTOS_IP_CONFIG_H
-#define FREERTOS_IP_CONFIG_H
-
-/* Prototype for the function used to print out. In this case it prints to the
-console before the network is connected then a UDP port after the network has
-connected. */
-extern void vLoggingPrintf( const char *pcFormatString, ... );
-
-/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
-1 then FreeRTOS_debug_printf should be defined to the function used to print
-out the debugging messages. */
-#define ipconfigHAS_DEBUG_PRINTF 1
-#if( ipconfigHAS_DEBUG_PRINTF == 1 )
- #define FreeRTOS_debug_printf(X) vLoggingPrintf X
-#endif
-
-/* Set to 1 to print out non debugging messages, for example the output of the
-FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
-then FreeRTOS_printf should be set to the function used to print out the
-messages. */
-#define ipconfigHAS_PRINTF 1
-#if( ipconfigHAS_PRINTF == 1 )
- #define FreeRTOS_printf(X) vLoggingPrintf X
-#endif
-
-/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
-on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
-#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
-
-/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums)
-then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
-stack repeating the checksum calculations. */
-#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
-
-/* Several API's will block until the result is known, or the action has been
-performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
-set per socket, using setsockopt(). If not set, the times below will be
-used as defaults. */
-#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
-#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
-
-/* Include support for LLMNR: Link-local Multicast Name Resolution
-(non-Microsoft) */
-#define ipconfigUSE_LLMNR ( 1 )
-
-/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
-#define ipconfigUSE_NBNS ( 1 )
-
-/* Include support for DNS caching. For TCP, having a small DNS cache is very
-useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
-and also DNS may use small timeouts. If a DNS reply comes in after the DNS
-socket has been destroyed, the result will be stored into the cache. The next
-call to FreeRTOS_gethostbyname() will return immediately, without even creating
-a socket. */
-#define ipconfigUSE_DNS_CACHE ( 1 )
-#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 )
-#define ipconfigDNS_CACHE_ENTRIES ( 4 )
-#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
-
-/* The IP stack executes it its own task (although any application task can make
-use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
-sets the priority of the task that executes the IP stack. The priority is a
-standard FreeRTOS task priority so can take any value from 0 (the lowest
-priority) to (configMAX_PRIORITIES - 1) (the highest priority).
-configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
-FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
-the priority assigned to the task executing the IP stack relative to the
-priority assigned to tasks that use the IP stack. */
-#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
-
-/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
-task. This setting is less important when the FreeRTOS Win32 simulator is used
-as the Win32 simulator only stores a fixed amount of information on the task
-stack. FreeRTOS includes optional stack overflow detection, see:
-http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
-#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
-
-/* ipconfigRAND32() is called by the IP stack to generate random numbers for
-things such as a DHCP transaction number or initial sequence number. Random
-number generation is performed via this macro to allow applications to use their
-own random number generation method. For example, it might be possible to
-generate a random number by sampling noise on an analogue input. */
-extern UBaseType_t uxRand();
-#define ipconfigRAND32() uxRand()
-
-/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
-network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
-is not set to 1 then the network event hook will never be called. See
-http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
-*/
-#define ipconfigUSE_NETWORK_EVENT_HOOK 1
-
-/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
-a network buffer cannot be obtained then the calling task is held in the Blocked
-state (so other tasks can continue to executed) until either a network buffer
-becomes available or the send block time expires. If the send block time expires
-then the send operation is aborted. The maximum allowable send block time is
-capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
-maximum allowable send block time prevents prevents a deadlock occurring when
-all the network buffers are in use and the tasks that process (and subsequently
-free) the network buffers are themselves blocked waiting for a network buffer.
-ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
-milliseconds can be converted to a time in ticks by dividing the time in
-milliseconds by portTICK_PERIOD_MS. */
-#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
-
-/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
-address, netmask, DNS server address and gateway address from a DHCP server. If
-ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
-stack will revert to using the static IP address even when ipconfigUSE_DHCP is
-set to 1 if a valid configuration cannot be obtained from a DHCP server for any
-reason. The static configuration used is that passed into the stack by the
-FreeRTOS_IPInit() function call. */
-#define ipconfigUSE_DHCP 0
-
-/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
-increasing time intervals until either a reply is received from a DHCP server
-and accepted, or the interval between transmissions reaches
-ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
-static IP address passed as a parameter to FreeRTOS_IPInit() if the
-re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
-a DHCP reply being received. */
-#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
-
-/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
-stack can only send a UDP message to a remove IP address if it knowns the MAC
-address associated with the IP address, or the MAC address of the router used to
-contact the remote IP address. When a UDP message is received from a remote IP
-address the MAC address and IP address are added to the ARP cache. When a UDP
-message is sent to a remote IP address that does not already appear in the ARP
-cache then the UDP message is replaced by a ARP message that solicits the
-required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
-number of entries that can exist in the ARP table at any one time. */
-#define ipconfigARP_CACHE_ENTRIES 6
-
-/* ARP requests that do not result in an ARP response will be re-transmitted a
-maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
-aborted. */
-#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
-
-/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
-table being created or refreshed and the entry being removed because it is stale.
-New ARP requests are sent for ARP cache entries that are nearing their maximum
-age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
-equal to 1500 seconds (or 25 minutes). */
-#define ipconfigMAX_ARP_AGE 150
-
-/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
-routines, which are relatively large. To save code space the full
-FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
-alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
-takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
-FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
-(for example, 192, 168, 0, 1) as its parameters. If
-ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
-FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
-not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
-#define ipconfigINCLUDE_FULL_INET_ADDR 1
-
-/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
-are available to the IP stack. The total number of network buffers is limited
-to ensure the total amount of RAM that can be consumed by the IP stack is capped
-to a pre-determinable value. */
-#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
-
-/* A FreeRTOS queue is used to send events from application tasks to the IP
-stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
-be queued for processing at any one time. The event queue must be a minimum of
-5 greater than the total number of network buffers. */
-#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
-
-/* The address of a socket is the combination of its IP address and its port
-number. FreeRTOS_bind() is used to manually allocate a port number to a socket
-(to 'bind' the socket to a port), but manual binding is not normally necessary
-for client sockets (those sockets that initiate outgoing connections rather than
-wait for incoming connections on a known port number). If
-ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
-FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
-stack automatically binding the socket to a port number from the range
-socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
-ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
-on a socket that has not yet been bound will result in the send operation being
-aborted. */
-#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
-
-/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
-#define ipconfigUDP_TIME_TO_LIVE 128
-#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
-
-/* USE_TCP: Use TCP and all its features */
-#define ipconfigUSE_TCP ( 1 )
-
-/* USE_WIN: Let TCP use windowing mechanism. */
-#define ipconfigUSE_TCP_WIN ( 1 )
-
-/* The MTU is the maximum number of bytes the payload of a network frame can
-contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
-lower value can save RAM, depending on the buffer management scheme used. If
-ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
-be divisible by 8. */
-#define ipconfigNETWORK_MTU 1200U
-
-/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
-through the FreeRTOS_gethostbyname() API function. */
-#define ipconfigUSE_DNS 1
-
-/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
-generate replies to incoming ICMP echo (ping) requests. */
-#define ipconfigREPLY_TO_INCOMING_PINGS 1
-
-/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
-FreeRTOS_SendPingRequest() API function is available. */
-#define ipconfigSUPPORT_OUTGOING_PINGS 0
-
-/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
-(and associated) API function is available. */
-#define ipconfigSUPPORT_SELECT_FUNCTION 1
-
-/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
-that are not in Ethernet II format will be dropped. This option is included for
-potential future IP stack developments. */
-#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
-
-/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
-responsibility of the Ethernet interface to filter out packets that are of no
-interest. If the Ethernet interface does not implement this functionality, then
-set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
-perform the filtering instead (it is much less efficient for the stack to do it
-because the packet will already have been passed into the stack). If the
-Ethernet driver does all the necessary filtering in hardware then software
-filtering can be removed by using a value other than 1 or 0. */
-#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
-
-/* The windows simulator cannot really simulate MAC interrupts, and needs to
-block occasionally to allow other tasks to run. */
-#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
-
-/* Advanced only: in order to access 32-bit fields in the IP packets with
-32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
-This has to do with the contents of the IP-packets: all 32-bit fields are
-32-bit-aligned, plus 16-bit(!) */
-#define ipconfigPACKET_FILLER_SIZE 2U
-
-/* Define the size of the pool of TCP window descriptors. On the average, each
-TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
-outstanding packets (for Rx and Tx). When using up to 10 TP sockets
-simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
-#define ipconfigTCP_WIN_SEG_COUNT 240
-
-/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
-maximum size. Define the size of Rx buffer for TCP sockets. */
-#define ipconfigTCP_RX_BUFFER_LENGTH ( 1000 )
-
-/* Define the size of Tx buffer for TCP sockets. */
-#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 )
-
-/* When using call-back handlers, the driver may check if the handler points to
-real program memory (RAM or flash) or just has a random non-zero value. */
-#define ipconfigIS_VALID_PROG_ADDRESS(x) ( (x) != NULL )
-
-/* Include support for TCP hang protection. All sockets in a connecting or
-disconnecting stage will timeout after a period of non-activity. */
-#define ipconfigTCP_HANG_PROTECTION ( 1 )
-#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
-
-/* Include support for TCP keep-alive messages. */
-#define ipconfigTCP_KEEP_ALIVE ( 1 )
-#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */
-
-#define portINLINE __inline
-
-#endif /* FREERTOS_IP_CONFIG_H */
+/*
+ * FreeRTOS Kernel V10.3.0
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+
+/*****************************************************************************
+ *
+ * See the following URL for configuration information.
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
+ *
+ *****************************************************************************/
+
+#ifndef FREERTOS_IP_CONFIG_H
+#define FREERTOS_IP_CONFIG_H
+
+/* Prototype for the function used to print out. In this case it prints to the
+console before the network is connected then a UDP port after the network has
+connected. */
+extern void vLoggingPrintf( const char *pcFormatString, ... );
+
+/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
+1 then FreeRTOS_debug_printf should be defined to the function used to print
+out the debugging messages. */
+#define ipconfigHAS_DEBUG_PRINTF 1
+#if( ipconfigHAS_DEBUG_PRINTF == 1 )
+ #define FreeRTOS_debug_printf(X) vLoggingPrintf X
+#endif
+
+/* Set to 1 to print out non debugging messages, for example the output of the
+FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
+then FreeRTOS_printf should be set to the function used to print out the
+messages. */
+#define ipconfigHAS_PRINTF 0
+#if( ipconfigHAS_PRINTF == 1 )
+ #define FreeRTOS_printf(X) vLoggingPrintf X
+#endif
+
+/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
+on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
+#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
+
+/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums)
+then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
+stack repeating the checksum calculations. */
+#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
+
+/* Several API's will block until the result is known, or the action has been
+performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
+set per socket, using setsockopt(). If not set, the times below will be
+used as defaults. */
+#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
+#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
+
+/* Include support for LLMNR: Link-local Multicast Name Resolution
+(non-Microsoft) */
+#define ipconfigUSE_LLMNR ( 1 )
+
+/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
+#define ipconfigUSE_NBNS ( 1 )
+
+/* Include support for DNS caching. For TCP, having a small DNS cache is very
+useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
+and also DNS may use small timeouts. If a DNS reply comes in after the DNS
+socket has been destroyed, the result will be stored into the cache. The next
+call to FreeRTOS_gethostbyname() will return immediately, without even creating
+a socket. */
+#define ipconfigUSE_DNS_CACHE ( 1 )
+#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 )
+#define ipconfigDNS_CACHE_ENTRIES ( 4 )
+#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
+
+/* The IP stack executes it its own task (although any application task can make
+use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
+sets the priority of the task that executes the IP stack. The priority is a
+standard FreeRTOS task priority so can take any value from 0 (the lowest
+priority) to (configMAX_PRIORITIES - 1) (the highest priority).
+configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
+FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
+the priority assigned to the task executing the IP stack relative to the
+priority assigned to tasks that use the IP stack. */
+#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
+
+/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
+task. This setting is less important when the FreeRTOS Win32 simulator is used
+as the Win32 simulator only stores a fixed amount of information on the task
+stack. FreeRTOS includes optional stack overflow detection, see:
+http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
+#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
+
+/* ipconfigRAND32() is called by the IP stack to generate random numbers for
+things such as a DHCP transaction number or initial sequence number. Random
+number generation is performed via this macro to allow applications to use their
+own random number generation method. For example, it might be possible to
+generate a random number by sampling noise on an analogue input. */
+extern UBaseType_t uxRand();
+#define ipconfigRAND32() uxRand()
+
+/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
+network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
+is not set to 1 then the network event hook will never be called. See
+http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
+*/
+#define ipconfigUSE_NETWORK_EVENT_HOOK 1
+
+/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
+a network buffer cannot be obtained then the calling task is held in the Blocked
+state (so other tasks can continue to executed) until either a network buffer
+becomes available or the send block time expires. If the send block time expires
+then the send operation is aborted. The maximum allowable send block time is
+capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
+maximum allowable send block time prevents prevents a deadlock occurring when
+all the network buffers are in use and the tasks that process (and subsequently
+free) the network buffers are themselves blocked waiting for a network buffer.
+ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
+milliseconds can be converted to a time in ticks by dividing the time in
+milliseconds by portTICK_PERIOD_MS. */
+#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
+
+/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
+address, netmask, DNS server address and gateway address from a DHCP server. If
+ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
+stack will revert to using the static IP address even when ipconfigUSE_DHCP is
+set to 1 if a valid configuration cannot be obtained from a DHCP server for any
+reason. The static configuration used is that passed into the stack by the
+FreeRTOS_IPInit() function call. */
+#define ipconfigUSE_DHCP 0
+
+/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
+increasing time intervals until either a reply is received from a DHCP server
+and accepted, or the interval between transmissions reaches
+ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
+static IP address passed as a parameter to FreeRTOS_IPInit() if the
+re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
+a DHCP reply being received. */
+#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
+
+/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
+stack can only send a UDP message to a remove IP address if it knowns the MAC
+address associated with the IP address, or the MAC address of the router used to
+contact the remote IP address. When a UDP message is received from a remote IP
+address the MAC address and IP address are added to the ARP cache. When a UDP
+message is sent to a remote IP address that does not already appear in the ARP
+cache then the UDP message is replaced by a ARP message that solicits the
+required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
+number of entries that can exist in the ARP table at any one time. */
+#define ipconfigARP_CACHE_ENTRIES 6
+
+/* ARP requests that do not result in an ARP response will be re-transmitted a
+maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
+aborted. */
+#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
+
+/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
+table being created or refreshed and the entry being removed because it is stale.
+New ARP requests are sent for ARP cache entries that are nearing their maximum
+age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
+equal to 1500 seconds (or 25 minutes). */
+#define ipconfigMAX_ARP_AGE 150
+
+/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
+routines, which are relatively large. To save code space the full
+FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
+alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
+takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
+FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
+(for example, 192, 168, 0, 1) as its parameters. If
+ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
+FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
+not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
+#define ipconfigINCLUDE_FULL_INET_ADDR 1
+
+/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
+are available to the IP stack. The total number of network buffers is limited
+to ensure the total amount of RAM that can be consumed by the IP stack is capped
+to a pre-determinable value. */
+#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
+
+/* A FreeRTOS queue is used to send events from application tasks to the IP
+stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
+be queued for processing at any one time. The event queue must be a minimum of
+5 greater than the total number of network buffers. */
+#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
+
+/* The address of a socket is the combination of its IP address and its port
+number. FreeRTOS_bind() is used to manually allocate a port number to a socket
+(to 'bind' the socket to a port), but manual binding is not normally necessary
+for client sockets (those sockets that initiate outgoing connections rather than
+wait for incoming connections on a known port number). If
+ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
+FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
+stack automatically binding the socket to a port number from the range
+socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
+ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
+on a socket that has not yet been bound will result in the send operation being
+aborted. */
+#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
+
+/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
+#define ipconfigUDP_TIME_TO_LIVE 128
+#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
+
+/* USE_TCP: Use TCP and all its features */
+#define ipconfigUSE_TCP ( 1 )
+
+/* USE_WIN: Let TCP use windowing mechanism. */
+#define ipconfigUSE_TCP_WIN ( 1 )
+
+/* The MTU is the maximum number of bytes the payload of a network frame can
+contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
+lower value can save RAM, depending on the buffer management scheme used. If
+ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
+be divisible by 8. */
+#define ipconfigNETWORK_MTU 1200U
+
+/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
+through the FreeRTOS_gethostbyname() API function. */
+#define ipconfigUSE_DNS 1
+
+/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
+generate replies to incoming ICMP echo (ping) requests. */
+#define ipconfigREPLY_TO_INCOMING_PINGS 1
+
+/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
+FreeRTOS_SendPingRequest() API function is available. */
+#define ipconfigSUPPORT_OUTGOING_PINGS 0
+
+/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
+(and associated) API function is available. */
+#define ipconfigSUPPORT_SELECT_FUNCTION 1
+
+/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
+that are not in Ethernet II format will be dropped. This option is included for
+potential future IP stack developments. */
+#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
+
+/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
+responsibility of the Ethernet interface to filter out packets that are of no
+interest. If the Ethernet interface does not implement this functionality, then
+set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
+perform the filtering instead (it is much less efficient for the stack to do it
+because the packet will already have been passed into the stack). If the
+Ethernet driver does all the necessary filtering in hardware then software
+filtering can be removed by using a value other than 1 or 0. */
+#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
+
+/* The windows simulator cannot really simulate MAC interrupts, and needs to
+block occasionally to allow other tasks to run. */
+#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
+
+/* Advanced only: in order to access 32-bit fields in the IP packets with
+32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
+This has to do with the contents of the IP-packets: all 32-bit fields are
+32-bit-aligned, plus 16-bit(!) */
+#define ipconfigPACKET_FILLER_SIZE 2U
+
+/* Define the size of the pool of TCP window descriptors. On the average, each
+TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
+outstanding packets (for Rx and Tx). When using up to 10 TP sockets
+simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
+#define ipconfigTCP_WIN_SEG_COUNT 240
+
+/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
+maximum size. Define the size of Rx buffer for TCP sockets. */
+#define ipconfigTCP_RX_BUFFER_LENGTH ( 1000 )
+
+/* Define the size of Tx buffer for TCP sockets. */
+#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 )
+
+/* When using call-back handlers, the driver may check if the handler points to
+real program memory (RAM or flash) or just has a random non-zero value. */
+#define ipconfigIS_VALID_PROG_ADDRESS(x) ( (x) != NULL )
+
+/* Include support for TCP hang protection. All sockets in a connecting or
+disconnecting stage will timeout after a period of non-activity. */
+#define ipconfigTCP_HANG_PROTECTION ( 1 )
+#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
+
+/* Include support for TCP keep-alive messages. */
+#define ipconfigTCP_KEEP_ALIVE ( 1 )
+#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */
+
+#define portINLINE __inline
+
+#endif /* FREERTOS_IP_CONFIG_H */
diff --git a/FreeRTOS/Demo/Posix_GCC/src/SConscript b/FreeRTOS/Demo/Posix_GCC/SConscript
index 5768f64d0..5768f64d0 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/SConscript
+++ b/FreeRTOS/Demo/Posix_GCC/SConscript
diff --git a/FreeRTOS/Demo/Posix_GCC/SConstruct b/FreeRTOS/Demo/Posix_GCC/SConstruct
index e055a3c25..fd6ef6298 100644
--- a/FreeRTOS/Demo/Posix_GCC/SConstruct
+++ b/FreeRTOS/Demo/Posix_GCC/SConstruct
@@ -27,10 +27,10 @@
import os
# Create a symlink to the FreeRTOS sources.
-if not os.path.exists("src/FreeRTOS"):
- os.symlink("../../..", "src/FreeRTOS")
-if not os.path.exists("src/FreeRTOS-Plus"):
- os.symlink("../../../../FreeRTOS-Plus", "src/FreeRTOS-Plus")
+if not os.path.exists("FreeRTOS"):
+ os.symlink("../..", "FreeRTOS")
+if not os.path.exists("FreeRTOS-Plus"):
+ os.symlink("../../../FreeRTOS-Plus", "FreeRTOS-Plus")
AddOption("--simple",
action='store_true',
@@ -49,4 +49,4 @@ env.Append(CFLAGS = [
"-O2",
])
-SConscript("src/SConscript", variant_dir="build", duplicate=0)
+SConscript("./SConscript", variant_dir="build", duplicate=0)
diff --git a/FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c b/FreeRTOS/Demo/Posix_GCC/SimpleTCPEchoServer.c
index 2a2c704d7..ef690b894 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c
+++ b/FreeRTOS/Demo/Posix_GCC/SimpleTCPEchoServer.c
@@ -1,288 +1,288 @@
-/*
- FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
- All rights reserved
-
- VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
-
- This file is part of the FreeRTOS distribution.
-
- FreeRTOS is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License (version 2) as published by the
- Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
-
- ***************************************************************************
- >>! NOTE: The modification to the GPL is included to allow you to !<<
- >>! distribute a combined work that includes FreeRTOS without being !<<
- >>! obliged to provide the source code for proprietary components !<<
- >>! outside of the FreeRTOS kernel. !<<
- ***************************************************************************
-
- FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. Full license text is available on the following
- link: http://www.freertos.org/a00114.html
-
- ***************************************************************************
- * *
- * FreeRTOS provides completely free yet professionally developed, *
- * robust, strictly quality controlled, supported, and cross *
- * platform software that is more than just the market leader, it *
- * is the industry's de facto standard. *
- * *
- * Help yourself get started quickly while simultaneously helping *
- * to support the FreeRTOS project by purchasing a FreeRTOS *
- * tutorial book, reference manual, or both: *
- * http://www.FreeRTOS.org/Documentation *
- * *
- ***************************************************************************
-
- http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
- the FAQ page "My application does not run, what could be wrong?". Have you
- defined configASSERT()?
-
- http://www.FreeRTOS.org/support - In return for receiving this top quality
- embedded software for free we request you assist our global community by
- participating in the support forum.
-
- http://www.FreeRTOS.org/training - Investing in training allows your team to
- be as productive as possible as early as possible. Now you can receive
- FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
- Ltd, and the world's leading authority on the world's leading RTOS.
-
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
- including FreeRTOS+Trace - an indispensable productivity tool, a DOS
- compatible FAT file system, and our tiny thread aware UDP/IP stack.
-
- http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
- Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
-
- http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
- Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
- licenses offer ticketed support, indemnification and commercial middleware.
-
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety
- engineered and independently SIL3 certified version for use in safety and
- mission critical applications that require provable dependability.
-
- 1 tab == 4 spaces!
-*/
-
-/*
- * FreeRTOS tasks are used with FreeRTOS+TCP to create a TCP echo server on the
- * standard echo port number (7).
- *
- * See the following web page for essential demo usage and configuration
- * details:
- * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Server.html
- */
-
-/* Standard includes. */
-#include <stdint.h>
-#include <stdio.h>
-
-/* FreeRTOS includes. */
-#include "FreeRTOS.h"
-#include "task.h"
-#include "semphr.h"
-
-/* FreeRTOS+TCP includes. */
-#include "FreeRTOS_IP.h"
-#include "FreeRTOS_Sockets.h"
-
-/* Remove the whole file if FreeRTOSIPConfig.h is set to exclude TCP. */
-#if( ipconfigUSE_TCP == 1 )
-
-/* The maximum time to wait for a closing socket to close. */
-#define tcpechoSHUTDOWN_DELAY ( pdMS_TO_TICKS( 5000 ) )
-
-/* The standard echo port number. */
-#define tcpechoPORT_NUMBER 7
-
-/* If ipconfigUSE_TCP_WIN is 1 then the Tx sockets will use a buffer size set by
-ipconfigTCP_TX_BUFFER_LENGTH, and the Tx window size will be
-configECHO_SERVER_TX_WINDOW_SIZE times the buffer size. Note
-ipconfigTCP_TX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
-stack constant, whereas configECHO_SERVER_TX_WINDOW_SIZE is set in
-FreeRTOSConfig.h as it is a demo application constant. */
-#ifndef configECHO_SERVER_TX_WINDOW_SIZE
- #define configECHO_SERVER_TX_WINDOW_SIZE 2
-#endif
-
-/* If ipconfigUSE_TCP_WIN is 1 then the Rx sockets will use a buffer size set by
-ipconfigTCP_RX_BUFFER_LENGTH, and the Rx window size will be
-configECHO_SERVER_RX_WINDOW_SIZE times the buffer size. Note
-ipconfigTCP_RX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
-stack constant, whereas configECHO_SERVER_RX_WINDOW_SIZE is set in
-FreeRTOSConfig.h as it is a demo application constant. */
-#ifndef configECHO_SERVER_RX_WINDOW_SIZE
- #define configECHO_SERVER_RX_WINDOW_SIZE 2
-#endif
-
-/*-----------------------------------------------------------*/
-
-/*
- * Uses FreeRTOS+TCP to listen for incoming echo connections, creating a task
- * to handle each connection.
- */
-static void prvConnectionListeningTask( void *pvParameters );
-
-/*
- * Created by the connection listening task to handle a single connection.
- */
-static void prvServerConnectionInstance( void *pvParameters );
-
-/*-----------------------------------------------------------*/
-
-/* Stores the stack size passed into vStartSimpleTCPServerTasks() so it can be
-reused when the server listening task creates tasks to handle connections. */
-static uint16_t usUsedStackSize = 0;
-
-/*-----------------------------------------------------------*/
-
-void vStartSimpleTCPServerTasks( uint16_t usStackSize, UBaseType_t uxPriority )
-{
- /* Create the TCP echo server. */
- xTaskCreate( prvConnectionListeningTask, "ServerListener", usStackSize, NULL, uxPriority + 1, NULL );
-
- /* Remember the requested stack size so it can be re-used by the server
- listening task when it creates tasks to handle connections. */
- usUsedStackSize = usStackSize;
-}
-/*-----------------------------------------------------------*/
-
-static void prvConnectionListeningTask( void *pvParameters )
-{
-struct freertos_sockaddr xClient, xBindAddress;
-Socket_t xListeningSocket, xConnectedSocket;
-socklen_t xSize = sizeof( xClient );
-static const TickType_t xReceiveTimeOut = portMAX_DELAY;
-const BaseType_t xBacklog = 20;
-
-#if( ipconfigUSE_TCP_WIN == 1 )
- WinProperties_t xWinProps;
-
- /* Fill in the buffer and window sizes that will be used by the socket. */
- xWinProps.lTxBufSize = ipconfigTCP_TX_BUFFER_LENGTH;
- xWinProps.lTxWinSize = configECHO_SERVER_TX_WINDOW_SIZE;
- xWinProps.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;
- xWinProps.lRxWinSize = configECHO_SERVER_RX_WINDOW_SIZE;
-#endif /* ipconfigUSE_TCP_WIN */
-
- /* Just to prevent compiler warnings. */
- ( void ) pvParameters;
-
- /* Attempt to open the socket. */
- xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
- configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );
-
- /* Set a time out so accept() will just wait for a connection. */
- FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
-
- /* Set the window and buffer sizes. */
- #if( ipconfigUSE_TCP_WIN == 1 )
- {
- FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
- }
- #endif /* ipconfigUSE_TCP_WIN */
-
- /* Bind the socket to the port that the client task will send to, then
- listen for incoming connections. */
- xBindAddress.sin_port = tcpechoPORT_NUMBER;
- xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
- FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
- FreeRTOS_listen( xListeningSocket, xBacklog );
-
- for( ;; )
- {
- /* Wait for a client to connect. */
- xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );
- configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
-
- /* Spawn a task to handle the connection. */
- xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY, NULL );
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvServerConnectionInstance( void *pvParameters )
-{
-int32_t lBytes, lSent, lTotalSent;
-Socket_t xConnectedSocket;
-static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );
-static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );
-TickType_t xTimeOnShutdown;
-uint8_t *pucRxBuffer;
-
- xConnectedSocket = ( Socket_t ) pvParameters;
-
- /* Attempt to create the buffer used to receive the string to be echoed
- back. This could be avoided using a zero copy interface that just returned
- the same buffer. */
- pucRxBuffer = ( uint8_t * ) pvPortMalloc( ipconfigTCP_MSS );
-
- if( pucRxBuffer != NULL )
- {
- FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
- FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xReceiveTimeOut ) );
-
- for( ;; )
- {
- /* Zero out the receive array so there is NULL at the end of the string
- when it is printed out. */
- memset( pucRxBuffer, 0x00, ipconfigTCP_MSS );
-
- /* Receive data on the socket. */
- lBytes = FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 );
-
- /* If data was received, echo it back. */
- if( lBytes >= 0 )
- {
- lSent = 0;
- lTotalSent = 0;
-
- /* Call send() until all the data has been sent. */
- while( ( lSent >= 0 ) && ( lTotalSent < lBytes ) )
- {
- lSent = FreeRTOS_send( xConnectedSocket, pucRxBuffer, lBytes - lTotalSent, 0 );
- lTotalSent += lSent;
- }
-
- if( lSent < 0 )
- {
- /* Socket closed? */
- break;
- }
- }
- else
- {
- /* Socket closed? */
- break;
- }
- }
- }
-
- /* Initiate a shutdown in case it has not already been initiated. */
- FreeRTOS_shutdown( xConnectedSocket, FREERTOS_SHUT_RDWR );
-
- /* Wait for the shutdown to take effect, indicated by FreeRTOS_recv()
- returning an error. */
- xTimeOnShutdown = xTaskGetTickCount();
- do
- {
- if( FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 ) < 0 )
- {
- break;
- }
- } while( ( xTaskGetTickCount() - xTimeOnShutdown ) < tcpechoSHUTDOWN_DELAY );
-
- /* Finished with the socket, buffer, the task. */
- vPortFree( pucRxBuffer );
- FreeRTOS_closesocket( xConnectedSocket );
-
- vTaskDelete( NULL );
-}
-/*-----------------------------------------------------------*/
-
-/* The whole file is excluded if TCP is not compiled in. */
-#endif /* ipconfigUSE_TCP */
-
+/*
+ FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
+ All rights reserved
+
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License (version 2) as published by the
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
+
+ ***************************************************************************
+ >>! NOTE: The modification to the GPL is included to allow you to !<<
+ >>! distribute a combined work that includes FreeRTOS without being !<<
+ >>! obliged to provide the source code for proprietary components !<<
+ >>! outside of the FreeRTOS kernel. !<<
+ ***************************************************************************
+
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following
+ link: http://www.freertos.org/a00114.html
+
+ ***************************************************************************
+ * *
+ * FreeRTOS provides completely free yet professionally developed, *
+ * robust, strictly quality controlled, supported, and cross *
+ * platform software that is more than just the market leader, it *
+ * is the industry's de facto standard. *
+ * *
+ * Help yourself get started quickly while simultaneously helping *
+ * to support the FreeRTOS project by purchasing a FreeRTOS *
+ * tutorial book, reference manual, or both: *
+ * http://www.FreeRTOS.org/Documentation *
+ * *
+ ***************************************************************************
+
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
+ the FAQ page "My application does not run, what could be wrong?". Have you
+ defined configASSERT()?
+
+ http://www.FreeRTOS.org/support - In return for receiving this top quality
+ embedded software for free we request you assist our global community by
+ participating in the support forum.
+
+ http://www.FreeRTOS.org/training - Investing in training allows your team to
+ be as productive as possible as early as possible. Now you can receive
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
+ Ltd, and the world's leading authority on the world's leading RTOS.
+
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.
+
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
+
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
+ licenses offer ticketed support, indemnification and commercial middleware.
+
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety
+ engineered and independently SIL3 certified version for use in safety and
+ mission critical applications that require provable dependability.
+
+ 1 tab == 4 spaces!
+*/
+
+/*
+ * FreeRTOS tasks are used with FreeRTOS+TCP to create a TCP echo server on the
+ * standard echo port number (7).
+ *
+ * See the following web page for essential demo usage and configuration
+ * details:
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Server.html
+ */
+
+/* Standard includes. */
+#include <stdint.h>
+#include <stdio.h>
+
+/* FreeRTOS includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "semphr.h"
+
+/* FreeRTOS+TCP includes. */
+#include "FreeRTOS_IP.h"
+#include "FreeRTOS_Sockets.h"
+
+/* Remove the whole file if FreeRTOSIPConfig.h is set to exclude TCP. */
+#if( ipconfigUSE_TCP == 1 )
+
+/* The maximum time to wait for a closing socket to close. */
+#define tcpechoSHUTDOWN_DELAY ( pdMS_TO_TICKS( 5000 ) )
+
+/* The standard echo port number. */
+#define tcpechoPORT_NUMBER 7
+
+/* If ipconfigUSE_TCP_WIN is 1 then the Tx sockets will use a buffer size set by
+ipconfigTCP_TX_BUFFER_LENGTH, and the Tx window size will be
+configECHO_SERVER_TX_WINDOW_SIZE times the buffer size. Note
+ipconfigTCP_TX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
+stack constant, whereas configECHO_SERVER_TX_WINDOW_SIZE is set in
+FreeRTOSConfig.h as it is a demo application constant. */
+#ifndef configECHO_SERVER_TX_WINDOW_SIZE
+ #define configECHO_SERVER_TX_WINDOW_SIZE 2
+#endif
+
+/* If ipconfigUSE_TCP_WIN is 1 then the Rx sockets will use a buffer size set by
+ipconfigTCP_RX_BUFFER_LENGTH, and the Rx window size will be
+configECHO_SERVER_RX_WINDOW_SIZE times the buffer size. Note
+ipconfigTCP_RX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
+stack constant, whereas configECHO_SERVER_RX_WINDOW_SIZE is set in
+FreeRTOSConfig.h as it is a demo application constant. */
+#ifndef configECHO_SERVER_RX_WINDOW_SIZE
+ #define configECHO_SERVER_RX_WINDOW_SIZE 2
+#endif
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Uses FreeRTOS+TCP to listen for incoming echo connections, creating a task
+ * to handle each connection.
+ */
+static void prvConnectionListeningTask( void *pvParameters );
+
+/*
+ * Created by the connection listening task to handle a single connection.
+ */
+static void prvServerConnectionInstance( void *pvParameters );
+
+/*-----------------------------------------------------------*/
+
+/* Stores the stack size passed into vStartSimpleTCPServerTasks() so it can be
+reused when the server listening task creates tasks to handle connections. */
+static uint16_t usUsedStackSize = 0;
+
+/*-----------------------------------------------------------*/
+
+void vStartSimpleTCPServerTasks( uint16_t usStackSize, UBaseType_t uxPriority )
+{
+ /* Create the TCP echo server. */
+ xTaskCreate( prvConnectionListeningTask, "ServerListener", usStackSize, NULL, uxPriority + 1, NULL );
+
+ /* Remember the requested stack size so it can be re-used by the server
+ listening task when it creates tasks to handle connections. */
+ usUsedStackSize = usStackSize;
+}
+/*-----------------------------------------------------------*/
+
+static void prvConnectionListeningTask( void *pvParameters )
+{
+struct freertos_sockaddr xClient, xBindAddress;
+Socket_t xListeningSocket, xConnectedSocket;
+socklen_t xSize = sizeof( xClient );
+static const TickType_t xReceiveTimeOut = portMAX_DELAY;
+const BaseType_t xBacklog = 20;
+
+#if( ipconfigUSE_TCP_WIN == 1 )
+ WinProperties_t xWinProps;
+
+ /* Fill in the buffer and window sizes that will be used by the socket. */
+ xWinProps.lTxBufSize = ipconfigTCP_TX_BUFFER_LENGTH;
+ xWinProps.lTxWinSize = configECHO_SERVER_TX_WINDOW_SIZE;
+ xWinProps.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;
+ xWinProps.lRxWinSize = configECHO_SERVER_RX_WINDOW_SIZE;
+#endif /* ipconfigUSE_TCP_WIN */
+
+ /* Just to prevent compiler warnings. */
+ ( void ) pvParameters;
+
+ /* Attempt to open the socket. */
+ xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
+ configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );
+
+ /* Set a time out so accept() will just wait for a connection. */
+ FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
+
+ /* Set the window and buffer sizes. */
+ #if( ipconfigUSE_TCP_WIN == 1 )
+ {
+ FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
+ }
+ #endif /* ipconfigUSE_TCP_WIN */
+
+ /* Bind the socket to the port that the client task will send to, then
+ listen for incoming connections. */
+ xBindAddress.sin_port = tcpechoPORT_NUMBER;
+ xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
+ FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
+ FreeRTOS_listen( xListeningSocket, xBacklog );
+
+ for( ;; )
+ {
+ /* Wait for a client to connect. */
+ xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );
+ configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
+
+ /* Spawn a task to handle the connection. */
+ xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY, NULL );
+ }
+}
+/*-----------------------------------------------------------*/
+
+static void prvServerConnectionInstance( void *pvParameters )
+{
+int32_t lBytes, lSent, lTotalSent;
+Socket_t xConnectedSocket;
+static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );
+static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );
+TickType_t xTimeOnShutdown;
+uint8_t *pucRxBuffer;
+
+ xConnectedSocket = ( Socket_t ) pvParameters;
+
+ /* Attempt to create the buffer used to receive the string to be echoed
+ back. This could be avoided using a zero copy interface that just returned
+ the same buffer. */
+ pucRxBuffer = ( uint8_t * ) pvPortMalloc( ipconfigTCP_MSS );
+
+ if( pucRxBuffer != NULL )
+ {
+ FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
+ FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xReceiveTimeOut ) );
+
+ for( ;; )
+ {
+ /* Zero out the receive array so there is NULL at the end of the string
+ when it is printed out. */
+ memset( pucRxBuffer, 0x00, ipconfigTCP_MSS );
+
+ /* Receive data on the socket. */
+ lBytes = FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 );
+
+ /* If data was received, echo it back. */
+ if( lBytes >= 0 )
+ {
+ lSent = 0;
+ lTotalSent = 0;
+
+ /* Call send() until all the data has been sent. */
+ while( ( lSent >= 0 ) && ( lTotalSent < lBytes ) )
+ {
+ lSent = FreeRTOS_send( xConnectedSocket, pucRxBuffer, lBytes - lTotalSent, 0 );
+ lTotalSent += lSent;
+ }
+
+ if( lSent < 0 )
+ {
+ /* Socket closed? */
+ break;
+ }
+ }
+ else
+ {
+ /* Socket closed? */
+ break;
+ }
+ }
+ }
+
+ /* Initiate a shutdown in case it has not already been initiated. */
+ FreeRTOS_shutdown( xConnectedSocket, FREERTOS_SHUT_RDWR );
+
+ /* Wait for the shutdown to take effect, indicated by FreeRTOS_recv()
+ returning an error. */
+ xTimeOnShutdown = xTaskGetTickCount();
+ do
+ {
+ if( FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 ) < 0 )
+ {
+ break;
+ }
+ } while( ( xTaskGetTickCount() - xTimeOnShutdown ) < tcpechoSHUTDOWN_DELAY );
+
+ /* Finished with the socket, buffer, the task. */
+ vPortFree( pucRxBuffer );
+ FreeRTOS_closesocket( xConnectedSocket );
+
+ vTaskDelete( NULL );
+}
+/*-----------------------------------------------------------*/
+
+/* The whole file is excluded if TCP is not compiled in. */
+#endif /* ipconfigUSE_TCP */
+
diff --git a/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c b/FreeRTOS/Demo/Posix_GCC/TCPEchoClient_SingleTasks.c
index 4fc2fc08a..5497d1403 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c
+++ b/FreeRTOS/Demo/Posix_GCC/TCPEchoClient_SingleTasks.c
@@ -1,372 +1,372 @@
-/*
- * FreeRTOS Kernel V10.3.0
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * http://www.FreeRTOS.org
- * http://aws.amazon.com/freertos
- *
- * 1 tab == 4 spaces!
- */
-
-/*
- * A set of tasks are created that send TCP echo requests to the standard echo
- * port (port 7) on the IP address set by the configECHO_SERVER_ADDR0 to
- * configECHO_SERVER_ADDR3 constants, then wait for and verify the reply
- * (another demo is avilable that demonstrates the reception being performed in
- * a task other than that from with the request was made).
- *
- * See the following web page for essential demo usage and configuration
- * details:
- * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
- */
-
-/* Standard includes. */
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/* FreeRTOS includes. */
-#include "FreeRTOS.h"
-#include "task.h"
-#include "queue.h"
-
-/* FreeRTOS+TCP includes. */
-#include "FreeRTOS_IP.h"
-#include "FreeRTOS_Sockets.h"
-
-/* Exclude the whole file if FreeRTOSIPConfig.h is configured to use UDP only. */
-#if ( ipconfigUSE_TCP == 1 )
-
-/* The echo tasks create a socket, send out a number of echo requests, listen
-for the echo reply, then close the socket again before starting over. This
-delay is used between each iteration to ensure the network does not get too
-congested. */
- #define echoLOOP_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS )
-
-/* The echo server is assumed to be on port 7, which is the standard echo
-protocol port. */
- #define echoECHO_PORT ( 7 )
-
-/* The size of the buffers is a multiple of the MSS - the length of the data
-sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
- #define echoBUFFER_SIZE_MULTIPLIER ( 3 )
- #define echoBUFFER_SIZES ( ipconfigTCP_MSS * echoBUFFER_SIZE_MULTIPLIER )
-
-/* The number of instances of the echo client task to create. */
- #define echoNUM_ECHO_CLIENTS ( 1 )
-
-/*-----------------------------------------------------------*/
-
-/*
- * Uses a socket to send data to, then receive data from, the standard echo
- * port number 7.
- */
- static void prvEchoClientTask( void *pvParameters );
-
-/*
- * Creates a pseudo random sized buffer of data to send to the echo server.
- */
- static BaseType_t prvCreateTxData( char *ucBuffer,
- uint32_t ulBufferLength );
-
-/*-----------------------------------------------------------*/
-
-/* Rx and Tx time outs are used to ensure the sockets do not wait too long for
-missing data. */
- static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 4000 );
- static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 2000 );
-
-/* Counters for each created task - for inspection only. */
- static uint32_t ulTxRxCycles[ echoNUM_ECHO_CLIENTS ] = { 0 },
- ulTxRxFailures[ echoNUM_ECHO_CLIENTS ] = { 0 },
- ulConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
-
-/* Rx and Tx buffers for each created task. */
- static char cTxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ],
- cRxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ];
-
-/*-----------------------------------------------------------*/
-
- void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize,
- UBaseType_t uxTaskPriority )
- {
- BaseType_t x;
-
- /* Create the echo client tasks. */
- for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
- {
- xTaskCreate( prvEchoClientTask, /* The function that implements the task. */
- "Echo0", /* Just a text name for the task to aid debugging. */
- usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */
- ( void * ) x, /* The task parameter, not used in this case. */
- uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */
- NULL ); /* The task handle is not used. */
- }
- }
-/*-----------------------------------------------------------*/
-
- static void prvEchoClientTask( void *pvParameters )
- {
- Socket_t xSocket;
- struct freertos_sockaddr xEchoServerAddress;
- int32_t lLoopCount = 0UL;
- const int32_t lMaxLoopCount = 1;
- volatile uint32_t ulTxCount = 0UL;
- BaseType_t xReceivedBytes, xReturned, xInstance;
- BaseType_t lTransmitted, lStringLength;
- char *pcTransmittedString, *pcReceivedString;
- WinProperties_t xWinProps;
- TickType_t xTimeOnEntering;
- BaseType_t ret;
-
- /* Fill in the buffer and window sizes that will be used by the socket. */
- xWinProps.lTxBufSize = 6 * ipconfigTCP_MSS;
- xWinProps.lTxWinSize = 3;
- xWinProps.lRxBufSize = 6 * ipconfigTCP_MSS;
- xWinProps.lRxWinSize = 3;
-
- /* This task can be created a number of times. Each instance is numbered
- to enable each instance to use a different Rx and Tx buffer. The number is
- passed in as the task's parameter. */
- xInstance = ( BaseType_t ) pvParameters;
-
- /* Point to the buffers to be used by this instance of this task. */
- pcTransmittedString = &( cTxBuffers[ xInstance ][ 0 ] );
- pcReceivedString = &( cRxBuffers[ xInstance ][ 0 ] );
-
- /* Echo requests are sent to the echo server. The address of the echo
- server is configured by the constants configECHO_SERVER_ADDR0 to
- configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
- xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
- xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
- configECHO_SERVER_ADDR1,
- configECHO_SERVER_ADDR2,
- configECHO_SERVER_ADDR3 );
-
- for( ; ; )
- {
- /* Create a TCP socket. */
- xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
- configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
-
- /* Set a time out so a missing reply does not cause the task to block
- indefinitely. */
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xSendTimeOut ) );
-
- /* Set the window and buffer sizes. */
- FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
-
- /* Connect to the echo server. */
- printf( "connecting to echo server....\n" );
-
- ret = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) );
-
- if( ret == 0 )
- {
- printf( "Connected to server.. \n" );
- ulConnections[ xInstance ]++;
-
- /* Send a number of echo requests. */
- for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ )
- {
- /* Create the string that is sent to the echo server. */
- lStringLength = prvCreateTxData( pcTransmittedString, echoBUFFER_SIZES );
-
- /* Add in some unique text at the front of the string. */
- sprintf( pcTransmittedString, "TxRx message number %u", ulTxCount );
- ulTxCount++;
-
- printf( "sending data to the echo server \n" );
- /* Send the string to the socket. */
- lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */
- ( void * ) pcTransmittedString, /* The data being sent. */
- lStringLength, /* The length of the data being sent. */
- 0 ); /* No flags. */
-
- if( lTransmitted < 0 )
- {
- /* Error? */
- break;
- }
-
- /* Clear the buffer into which the echoed string will be
- placed. */
- memset( ( void * ) pcReceivedString, 0x00, echoBUFFER_SIZES );
- xReceivedBytes = 0;
-
- /* Receive data echoed back to the socket. */
- while( xReceivedBytes < lTransmitted )
- {
- xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
- &( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
- lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */
- 0 ); /* No flags. */
-
- if( xReturned < 0 )
- {
- /* Error occurred. Latch it so it can be detected
- below. */
- xReceivedBytes = xReturned;
- break;
- }
- else if( xReturned == 0 )
- {
- /* Timed out. */
- break;
- }
- else
- {
- /* Keep a count of the bytes received so far. */
- xReceivedBytes += xReturned;
- }
- }
-
- /* If an error occurred it will be latched in xReceivedBytes,
- otherwise xReceived bytes will be just that - the number of
- bytes received from the echo server. */
- if( xReceivedBytes > 0 )
- {
- /* Compare the transmitted string to the received string. */
- configASSERT( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 );
-
- if( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 )
- {
- /* The echo reply was received without error. */
- ulTxRxCycles[ xInstance ]++;
- }
- else
- {
- /* The received string did not match the transmitted
- string. */
- ulTxRxFailures[ xInstance ]++;
- break;
- }
- }
- else if( xReceivedBytes < 0 )
- {
- /* FreeRTOS_recv() returned an error. */
- break;
- }
- else
- {
- /* Timed out without receiving anything? */
- break;
- }
- }
-
- /* Finished using the connected socket, initiate a graceful close:
- FIN, FIN+ACK, ACK. */
- FreeRTOS_shutdown( xSocket, FREERTOS_SHUT_RDWR );
-
- /* Expect FreeRTOS_recv() to return an error once the shutdown is
- complete. */
- xTimeOnEntering = xTaskGetTickCount();
-
- do
- {
- xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
- &( pcReceivedString[ 0 ] ), /* The buffer into which the received data will be written. */
- echoBUFFER_SIZES, /* The size of the buffer provided to receive the data. */
- 0 );
-
- if( xReturned < 0 )
- {
- break;
- }
- } while( ( xTaskGetTickCount() - xTimeOnEntering ) < xReceiveTimeOut );
- }
- else
- {
- printf( "Could not connect to server %ld\n", ret );
- }
-
- /* Close this socket before looping back to create another. */
- FreeRTOS_closesocket( xSocket );
-
- /* Pause for a short while to ensure the network is not too
- congested. */
- vTaskDelay( echoLOOP_DELAY );
- }
- }
-/*-----------------------------------------------------------*/
-
- static BaseType_t prvCreateTxData( char *cBuffer,
- uint32_t ulBufferLength )
- {
- BaseType_t lCharactersToAdd, lCharacter;
- char cChar = '0';
- const BaseType_t lMinimumLength = 60;
-
- /* Randomise the number of characters that will be sent in the echo
- request. */
- do
- {
- lCharactersToAdd = ipconfigRAND32() % ( ulBufferLength - 20UL );
- } while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
-
- /* Fill the buffer. */
- for( lCharacter = 0; lCharacter < lCharactersToAdd; lCharacter++ )
- {
- cBuffer[ lCharacter ] = cChar;
- cChar++;
-
- if( cChar > '~' )
- {
- cChar = '0';
- }
- }
-
- return lCharactersToAdd;
- }
-/*-----------------------------------------------------------*/
-
- BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void )
- {
- static uint32_t ulLastEchoSocketCount[ echoNUM_ECHO_CLIENTS ] = { 0 }, ulLastConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
- BaseType_t xReturn = pdPASS, x;
-
- /* Return fail is the number of cycles does not increment between
- consecutive calls. */
- for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
- {
- if( ulTxRxCycles[ x ] == ulLastEchoSocketCount[ x ] )
- {
- xReturn = pdFAIL;
- }
- else
- {
- ulLastEchoSocketCount[ x ] = ulTxRxCycles[ x ];
- }
-
- if( ulConnections[ x ] == ulLastConnections[ x ] )
- {
- xReturn = pdFAIL;
- }
- else
- {
- ulConnections[ x ] = ulLastConnections[ x ];
- }
- }
-
- return xReturn;
- }
-
-#endif /* ipconfigUSE_TCP */
+/*
+ * FreeRTOS Kernel V10.3.0
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+/*
+ * A set of tasks are created that send TCP echo requests to the standard echo
+ * port (port 7) on the IP address set by the configECHO_SERVER_ADDR0 to
+ * configECHO_SERVER_ADDR3 constants, then wait for and verify the reply
+ * (another demo is avilable that demonstrates the reception being performed in
+ * a task other than that from with the request was made).
+ *
+ * See the following web page for essential demo usage and configuration
+ * details:
+ * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
+ */
+
+/* Standard includes. */
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* FreeRTOS includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* FreeRTOS+TCP includes. */
+#include "FreeRTOS_IP.h"
+#include "FreeRTOS_Sockets.h"
+
+/* Exclude the whole file if FreeRTOSIPConfig.h is configured to use UDP only. */
+#if ( ipconfigUSE_TCP == 1 )
+
+/* The echo tasks create a socket, send out a number of echo requests, listen
+for the echo reply, then close the socket again before starting over. This
+delay is used between each iteration to ensure the network does not get too
+congested. */
+ #define echoLOOP_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS )
+
+/* The echo server is assumed to be on port 7, which is the standard echo
+protocol port. */
+ #define echoECHO_PORT ( 7 )
+
+/* The size of the buffers is a multiple of the MSS - the length of the data
+sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
+ #define echoBUFFER_SIZE_MULTIPLIER ( 3 )
+ #define echoBUFFER_SIZES ( ipconfigTCP_MSS * echoBUFFER_SIZE_MULTIPLIER )
+
+/* The number of instances of the echo client task to create. */
+ #define echoNUM_ECHO_CLIENTS ( 1 )
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Uses a socket to send data to, then receive data from, the standard echo
+ * port number 7.
+ */
+ static void prvEchoClientTask( void *pvParameters );
+
+/*
+ * Creates a pseudo random sized buffer of data to send to the echo server.
+ */
+ static BaseType_t prvCreateTxData( char *ucBuffer,
+ uint32_t ulBufferLength );
+
+/*-----------------------------------------------------------*/
+
+/* Rx and Tx time outs are used to ensure the sockets do not wait too long for
+missing data. */
+ static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 4000 );
+ static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 2000 );
+
+/* Counters for each created task - for inspection only. */
+ static uint32_t ulTxRxCycles[ echoNUM_ECHO_CLIENTS ] = { 0 },
+ ulTxRxFailures[ echoNUM_ECHO_CLIENTS ] = { 0 },
+ ulConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
+
+/* Rx and Tx buffers for each created task. */
+ static char cTxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ],
+ cRxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ];
+
+/*-----------------------------------------------------------*/
+
+ void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize,
+ UBaseType_t uxTaskPriority )
+ {
+ BaseType_t x;
+
+ /* Create the echo client tasks. */
+ for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
+ {
+ xTaskCreate( prvEchoClientTask, /* The function that implements the task. */
+ "Echo0", /* Just a text name for the task to aid debugging. */
+ usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */
+ ( void * ) x, /* The task parameter, not used in this case. */
+ uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */
+ NULL ); /* The task handle is not used. */
+ }
+ }
+/*-----------------------------------------------------------*/
+
+ static void prvEchoClientTask( void *pvParameters )
+ {
+ Socket_t xSocket;
+ struct freertos_sockaddr xEchoServerAddress;
+ int32_t lLoopCount = 0UL;
+ const int32_t lMaxLoopCount = 1;
+ volatile uint32_t ulTxCount = 0UL;
+ BaseType_t xReceivedBytes, xReturned, xInstance;
+ BaseType_t lTransmitted, lStringLength;
+ char *pcTransmittedString, *pcReceivedString;
+ WinProperties_t xWinProps;
+ TickType_t xTimeOnEntering;
+ BaseType_t ret;
+
+ /* Fill in the buffer and window sizes that will be used by the socket. */
+ xWinProps.lTxBufSize = 6 * ipconfigTCP_MSS;
+ xWinProps.lTxWinSize = 3;
+ xWinProps.lRxBufSize = 6 * ipconfigTCP_MSS;
+ xWinProps.lRxWinSize = 3;
+
+ /* This task can be created a number of times. Each instance is numbered
+ to enable each instance to use a different Rx and Tx buffer. The number is
+ passed in as the task's parameter. */
+ xInstance = ( BaseType_t ) pvParameters;
+
+ /* Point to the buffers to be used by this instance of this task. */
+ pcTransmittedString = &( cTxBuffers[ xInstance ][ 0 ] );
+ pcReceivedString = &( cRxBuffers[ xInstance ][ 0 ] );
+
+ /* Echo requests are sent to the echo server. The address of the echo
+ server is configured by the constants configECHO_SERVER_ADDR0 to
+ configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
+ xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
+ xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
+ configECHO_SERVER_ADDR1,
+ configECHO_SERVER_ADDR2,
+ configECHO_SERVER_ADDR3 );
+
+ for( ; ; )
+ {
+ /* Create a TCP socket. */
+ xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
+ configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
+
+ /* Set a time out so a missing reply does not cause the task to block
+ indefinitely. */
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xSendTimeOut ) );
+
+ /* Set the window and buffer sizes. */
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
+
+ /* Connect to the echo server. */
+ printf( "connecting to echo server....\n" );
+
+ ret = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) );
+
+ if( ret == 0 )
+ {
+ printf( "Connected to server.. \n" );
+ ulConnections[ xInstance ]++;
+
+ /* Send a number of echo requests. */
+ for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ )
+ {
+ /* Create the string that is sent to the echo server. */
+ lStringLength = prvCreateTxData( pcTransmittedString, echoBUFFER_SIZES );
+
+ /* Add in some unique text at the front of the string. */
+ sprintf( pcTransmittedString, "TxRx message number %u", ulTxCount );
+ ulTxCount++;
+
+ printf( "sending data to the echo server \n" );
+ /* Send the string to the socket. */
+ lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */
+ ( void * ) pcTransmittedString, /* The data being sent. */
+ lStringLength, /* The length of the data being sent. */
+ 0 ); /* No flags. */
+
+ if( lTransmitted < 0 )
+ {
+ /* Error? */
+ break;
+ }
+
+ /* Clear the buffer into which the echoed string will be
+ placed. */
+ memset( ( void * ) pcReceivedString, 0x00, echoBUFFER_SIZES );
+ xReceivedBytes = 0;
+
+ /* Receive data echoed back to the socket. */
+ while( xReceivedBytes < lTransmitted )
+ {
+ xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
+ &( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
+ lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */
+ 0 ); /* No flags. */
+
+ if( xReturned < 0 )
+ {
+ /* Error occurred. Latch it so it can be detected
+ below. */
+ xReceivedBytes = xReturned;
+ break;
+ }
+ else if( xReturned == 0 )
+ {
+ /* Timed out. */
+ break;
+ }
+ else
+ {
+ /* Keep a count of the bytes received so far. */
+ xReceivedBytes += xReturned;
+ }
+ }
+
+ /* If an error occurred it will be latched in xReceivedBytes,
+ otherwise xReceived bytes will be just that - the number of
+ bytes received from the echo server. */
+ if( xReceivedBytes > 0 )
+ {
+ /* Compare the transmitted string to the received string. */
+ configASSERT( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 );
+
+ if( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 )
+ {
+ /* The echo reply was received without error. */
+ ulTxRxCycles[ xInstance ]++;
+ }
+ else
+ {
+ /* The received string did not match the transmitted
+ string. */
+ ulTxRxFailures[ xInstance ]++;
+ break;
+ }
+ }
+ else if( xReceivedBytes < 0 )
+ {
+ /* FreeRTOS_recv() returned an error. */
+ break;
+ }
+ else
+ {
+ /* Timed out without receiving anything? */
+ break;
+ }
+ }
+
+ /* Finished using the connected socket, initiate a graceful close:
+ FIN, FIN+ACK, ACK. */
+ FreeRTOS_shutdown( xSocket, FREERTOS_SHUT_RDWR );
+
+ /* Expect FreeRTOS_recv() to return an error once the shutdown is
+ complete. */
+ xTimeOnEntering = xTaskGetTickCount();
+
+ do
+ {
+ xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
+ &( pcReceivedString[ 0 ] ), /* The buffer into which the received data will be written. */
+ echoBUFFER_SIZES, /* The size of the buffer provided to receive the data. */
+ 0 );
+
+ if( xReturned < 0 )
+ {
+ break;
+ }
+ } while( ( xTaskGetTickCount() - xTimeOnEntering ) < xReceiveTimeOut );
+ }
+ else
+ {
+ printf( "Could not connect to server %ld\n", ret );
+ }
+
+ /* Close this socket before looping back to create another. */
+ FreeRTOS_closesocket( xSocket );
+
+ /* Pause for a short while to ensure the network is not too
+ congested. */
+ vTaskDelay( echoLOOP_DELAY );
+ }
+ }
+/*-----------------------------------------------------------*/
+
+ static BaseType_t prvCreateTxData( char *cBuffer,
+ uint32_t ulBufferLength )
+ {
+ BaseType_t lCharactersToAdd, lCharacter;
+ char cChar = '0';
+ const BaseType_t lMinimumLength = 60;
+
+ /* Randomise the number of characters that will be sent in the echo
+ request. */
+ do
+ {
+ lCharactersToAdd = ipconfigRAND32() % ( ulBufferLength - 20UL );
+ } while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
+
+ /* Fill the buffer. */
+ for( lCharacter = 0; lCharacter < lCharactersToAdd; lCharacter++ )
+ {
+ cBuffer[ lCharacter ] = cChar;
+ cChar++;
+
+ if( cChar > '~' )
+ {
+ cChar = '0';
+ }
+ }
+
+ return lCharactersToAdd;
+ }
+/*-----------------------------------------------------------*/
+
+ BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void )
+ {
+ static uint32_t ulLastEchoSocketCount[ echoNUM_ECHO_CLIENTS ] = { 0 }, ulLastConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
+ BaseType_t xReturn = pdPASS, x;
+
+ /* Return fail is the number of cycles does not increment between
+ consecutive calls. */
+ for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
+ {
+ if( ulTxRxCycles[ x ] == ulLastEchoSocketCount[ x ] )
+ {
+ xReturn = pdFAIL;
+ }
+ else
+ {
+ ulLastEchoSocketCount[ x ] = ulTxRxCycles[ x ];
+ }
+
+ if( ulConnections[ x ] == ulLastConnections[ x ] )
+ {
+ xReturn = pdFAIL;
+ }
+ else
+ {
+ ulConnections[ x ] = ulLastConnections[ x ];
+ }
+ }
+
+ return xReturn;
+ }
+
+#endif /* ipconfigUSE_TCP */
diff --git a/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h b/FreeRTOS/Demo/Posix_GCC/TCPEchoClient_SingleTasks.h
index 864a3a10f..0c692e02e 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h
+++ b/FreeRTOS/Demo/Posix_GCC/TCPEchoClient_SingleTasks.h
@@ -1,40 +1,40 @@
-/*
- * FreeRTOS Kernel V10.3.0
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * http://www.FreeRTOS.org
- * http://aws.amazon.com/freertos
- *
- * 1 tab == 4 spaces!
- */
-
-#ifndef SINGLE_TASK_TCP_ECHO_CLIENTS_H
-#define SINGLE_TASK_TCP_ECHO_CLIENTS_H
-
-/*
- * Create the TCP echo client tasks. This is the version where an echo request
- * is made from the same task that listens for the echo reply.
- */
-void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );
-BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void );
-
-#endif /* SINGLE_TASK_TCP_ECHO_CLIENTS_H */
-
-
+/*
+ * FreeRTOS Kernel V10.3.0
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+#ifndef SINGLE_TASK_TCP_ECHO_CLIENTS_H
+#define SINGLE_TASK_TCP_ECHO_CLIENTS_H
+
+/*
+ * Create the TCP echo client tasks. This is the version where an echo request
+ * is made from the same task that listens for the echo reply.
+ */
+void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );
+BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void );
+
+#endif /* SINGLE_TASK_TCP_ECHO_CLIENTS_H */
+
+
diff --git a/FreeRTOS/Demo/Posix_GCC/src/code_coverage_additions.c b/FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c
index 1f43a3406..1f43a3406 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/code_coverage_additions.c
+++ b/FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/console.c b/FreeRTOS/Demo/Posix_GCC/console.c
index 32f7db397..32f7db397 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/console.c
+++ b/FreeRTOS/Demo/Posix_GCC/console.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/console.h b/FreeRTOS/Demo/Posix_GCC/console.h
index 8543baa2a..8543baa2a 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/console.h
+++ b/FreeRTOS/Demo/Posix_GCC/console.h
diff --git a/FreeRTOS/Demo/Posix_GCC/src/main.c b/FreeRTOS/Demo/Posix_GCC/main.c
index dd2406ac4..93772b2c4 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/main.c
+++ b/FreeRTOS/Demo/Posix_GCC/main.c
@@ -26,25 +26,26 @@
*/
/******************************************************************************
- * This project provides two demo applications. A simple blinky style project,
- * and a more comprehensive test and demo application. The
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.
+ * This project provides three demo applications. A simple blinky style project,
+ * a more comprehensive test and demo application, and a TCP echo application.
+ * The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between
+ * the two if mainCREATE_TCP_ECHO_TASKS_SINGLE is 0.
* The simply blinky demo is implemented and described in main_blinky.c. The
* more comprehensive test and demo application is implemented and described in
* main_full.c.
+ * The mainCREATE_TCP_ECHO_TASKS_SINGLE setting is used to select the tcp echo
+ * application regardless of the value of mainCREATE_SIMPLE_BLINKY_DEMO_ONLY.
*
* This file implements the code that is not demo specific, including the
* hardware setup and FreeRTOS hook functions.
*
*******************************************************************************
- * NOTE: Windows will not be running the FreeRTOS demo threads continuously, so
- * do not expect to get real time behaviour from the FreeRTOS Windows port, or
+ * NOTE: Linux will not be running the FreeRTOS demo threads continuously, so
+ * do not expect to get real time behaviour from the FreeRTOS Linux port, or
* this demo application. Also, the timing information in the FreeRTOS+Trace
- * logs have no meaningful units. See the documentation page for the Windows
+ * logs have no meaningful units. See the documentation page for the Linux
* port for further information:
- * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
- *
-
+ * https://freertos.org/FreeRTOS-simulator-for-Linux.html
*
*******************************************************************************
*/
@@ -62,16 +63,21 @@
/* Local includes. */
#include "console.h"
-/* This project provides two demo applications. A simple blinky style demo
-application, and a more comprehensive test and demo application. The
-mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.
+/* This project provides three demo applications. A simple blinky style demo
+application, a more comprehensive test and demo application, and a TCP
+echo application. The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY and
+mainCREATE_TCP_ECHO_TASKS_SINGLE settings are used to select between the three.
-If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 then the blinky demo will be built.
+If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 & mainCREATE_TCP_ECHO_TASKS_SINGLE
+is not 1 then the blinky demo will be built.
The blinky demo is implemented and described in main_blinky.c.
-If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and
+If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 &
+mainCREATE_TCP_ECHO_TASKS_SINGLE is not 1 then the comprehensive test and
demo application will be built. The comprehensive test and demo application is
-implemented and described in main_full.c. */
+implemented and described in main_full.c the tcp echo demo application
+is implemented in main_networking.c. */
+
#ifndef mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
#endif
@@ -223,7 +229,7 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask,
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. This function is
provided as an example only as stack overflow checking does not function
- when running the FreeRTOS Windows port. */
+ when running the FreeRTOS POSIX port. */
vAssertCalled( __FILE__, __LINE__ );
}
/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/Posix_GCC/src/main_blinky.c b/FreeRTOS/Demo/Posix_GCC/main_blinky.c
index 69c7e7e23..69c7e7e23 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/main_blinky.c
+++ b/FreeRTOS/Demo/Posix_GCC/main_blinky.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/main_full.c b/FreeRTOS/Demo/Posix_GCC/main_full.c
index 3bdfe9824..3bdfe9824 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/main_full.c
+++ b/FreeRTOS/Demo/Posix_GCC/main_full.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/main_networking.c b/FreeRTOS/Demo/Posix_GCC/main_networking.c
index edb589720..edb589720 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/main_networking.c
+++ b/FreeRTOS/Demo/Posix_GCC/main_networking.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/run-time-stats-utils.c b/FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c
index 7cd8170e0..7cd8170e0 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/run-time-stats-utils.c
+++ b/FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/trcConfig.h b/FreeRTOS/Demo/Posix_GCC/trcConfig.h
index 5e1ed6a29..133971c0b 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/trcConfig.h
+++ b/FreeRTOS/Demo/Posix_GCC/trcConfig.h
@@ -113,7 +113,7 @@ extern "C" {
* TRC_FREERTOS_VERSION_9_0_2 If using FreeRTOS v9.0.2
* TRC_FREERTOS_VERSION_10_0_0 If using FreeRTOS v10.0.0 or later
*****************************************************************************/
-#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_0_0
+#define TRC_CFG_FREERTOS_VERSION TRC_FREERTOS_VERSION_10_4_0
/*******************************************************************************
* TRC_CFG_SCHEDULING_ONLY
diff --git a/FreeRTOS/Demo/Posix_GCC/src/trcSnapshotConfig.h b/FreeRTOS/Demo/Posix_GCC/trcSnapshotConfig.h
index 9c43cd051..9c43cd051 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/trcSnapshotConfig.h
+++ b/FreeRTOS/Demo/Posix_GCC/trcSnapshotConfig.h
diff --git a/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.c b/FreeRTOS/Demo/Posix_GCC/utils/wait_for_event.c
index 6d0bfffda..6d0bfffda 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.c
+++ b/FreeRTOS/Demo/Posix_GCC/utils/wait_for_event.c
diff --git a/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h b/FreeRTOS/Demo/Posix_GCC/utils/wait_for_event.h
index 2693a0d8c..2693a0d8c 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h
+++ b/FreeRTOS/Demo/Posix_GCC/utils/wait_for_event.h