]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c
Update FreeRTOS+ version number ready for version 9 release candidate 1.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator / DemoTasks / SimpleClientAndServer.c
index 4ecc4c6970899e6dbd191fcbda041aa57a37854e..53164e600e2f54206907a8f41134487ce2c76767 100644 (file)
@@ -1,60 +1,64 @@
 /*\r
-    FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    FreeRTOS V9.0.0rc1 - Copyright (C) 2016 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS provides completely free yet professionally developed,    *\r
-     *    robust, strictly quality controlled, supported, and cross          *\r
-     *    platform software that has become a de facto standard.             *\r
-     *                                                                       *\r
-     *    Help yourself get started quickly and support the FreeRTOS         *\r
-     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
-     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
-     *                                                                       *\r
-     *    Thank you!                                                         *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
     This file is part of the FreeRTOS distribution.\r
 \r
     FreeRTOS is free software; you can redistribute it and/or modify it under\r
     the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
 \r
-    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
-    >>! a combined work that includes FreeRTOS without being obliged to provide\r
-    >>! the source code for proprietary components outside of the FreeRTOS\r
-    >>! kernel.\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
 \r
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
-    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
     link: http://www.freertos.org/a00114.html\r
 \r
-    1 tab == 4 spaces!\r
-\r
     ***************************************************************************\r
      *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
      *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
-    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
-    licenses offer ticketed support, indemnification and middleware.\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
 \r
     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
     engineered and independently SIL3 certified version for use in safety and\r
@@ -63,7 +67,7 @@
     1 tab == 4 spaces!\r
 */\r
 \r
-/* \r
+/*\r
  * Creates two transmitting tasks and two receiving tasks.  The transmitting\r
  * tasks send values that are received by the receiving tasks.  One set of tasks\r
  * uses the standard API.  The other set of tasks uses the zero copy API.\r
@@ -81,7 +85,7 @@
 #include "FreeRTOS_UDP_IP.h"\r
 #include "FreeRTOS_Sockets.h"\r
 \r
-#define simpTINY_DELAY ( ( portTickType ) 2 )\r
+#define simpTINY_DELAY ( ( TickType_t ) 2 )\r
 \r
 /*\r
  * Uses a socket to send data without using the zero copy option.\r
@@ -109,7 +113,7 @@ static void prvSimpleZeroCopyServerTask( void *pvParameters );
 \r
 /*-----------------------------------------------------------*/\r
 \r
-void vStartSimpleUDPClientServerTasks( uint16_t usStackSize, uint32_t ulPort, unsigned portBASE_TYPE uxPriority )\r
+void vStartSimpleUDPClientServerTasks( uint16_t usStackSize, uint32_t ulPort, UBaseType_t uxPriority )\r
 {\r
        /* Create the client and server tasks that do not use the zero copy\r
        interface. */\r
@@ -126,11 +130,11 @@ static void prvSimpleClientTask( void *pvParameters )
 {\r
 xSocket_t xClientSocket;\r
 struct freertos_sockaddr xDestinationAddress;\r
-uint8_t cString[ 50 ];\r
-portBASE_TYPE lReturned;\r
+char cString[ 50 ];\r
+BaseType_t lReturned;\r
 uint32_t ulCount = 0UL, ulIPAddress;\r
 const uint32_t ulLoopsPerSocket = 10UL;\r
-const portTickType x150ms = 150UL / portTICK_RATE_MS;\r
+const TickType_t x150ms = 150UL / portTICK_RATE_MS;\r
 \r
        /* Remove compiler warning about unused parameters. */\r
        ( void ) pvParameters;\r
@@ -162,13 +166,13 @@ const portTickType x150ms = 150UL / portTICK_RATE_MS;
                do\r
                {\r
                        /* Create the string that is sent to the server. */\r
-                       sprintf( ( char * ) cString, "Server received (not zero copy): Message number %lu\r\n", ulCount );\r
+                       sprintf( cString, "Server received (not zero copy): Message number %lu\r\n", ulCount );\r
 \r
                        /* Send the string to the socket.  ulFlags is set to 0, so the zero\r
                        copy option is not selected.  That means the data from cString[] is\r
                        copied into a network buffer inside FreeRTOS_sendto(), and cString[]\r
                        can be reused as soon as FreeRTOS_sendto() has returned. */\r
-                       lReturned = FreeRTOS_sendto( xClientSocket, ( void * ) cString, strlen( ( const char * ) cString ), 0, &xDestinationAddress, sizeof( xDestinationAddress ) );\r
+                       lReturned = FreeRTOS_sendto( xClientSocket, ( void * ) cString, strlen( cString ), 0, &xDestinationAddress, sizeof( xDestinationAddress ) );\r
 \r
                        ulCount++;\r
 \r
@@ -187,7 +191,7 @@ const portTickType x150ms = 150UL / portTICK_RATE_MS;
 static void prvSimpleServerTask( void *pvParameters )\r
 {\r
 long lBytes;\r
-uint8_t cReceivedString[ 60 ];\r
+char cReceivedString[ 60 ];\r
 struct freertos_sockaddr xClient, xBindAddress;\r
 uint32_t xClientLength = sizeof( xClient );\r
 xSocket_t xListeningSocket;\r
@@ -226,11 +230,11 @@ xSocket_t xListeningSocket;
                /* Print the received characters. */\r
                if( lBytes > 0 )\r
                {\r
-                       vOutputString( ( char * ) cReceivedString );\r
+                       vOutputString( cReceivedString );\r
                }\r
 \r
                /* Error check. */\r
-               configASSERT( lBytes == ( portBASE_TYPE ) strlen( ( const char * ) cReceivedString ) );\r
+               configASSERT( lBytes == ( BaseType_t ) strlen( cReceivedString ) );\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -240,13 +244,13 @@ static void prvSimpleZeroCopyUDPClientTask( void *pvParameters )
 xSocket_t xClientSocket;\r
 uint8_t *pucUDPPayloadBuffer;\r
 struct freertos_sockaddr xDestinationAddress;\r
-portBASE_TYPE lReturned;\r
+BaseType_t lReturned;\r
 uint32_t ulCount = 0UL, ulIPAddress;\r
 const uint32_t ulLoopsPerSocket = 10UL;\r
-const uint8_t *pucStringToSend = ( const uint8_t * ) "Server received (using zero copy): Message number ";\r
-const portTickType x150ms = 150UL / portTICK_RATE_MS;\r
+const char *pcStringToSend = "Server received (using zero copy): Message number ";\r
+const TickType_t x150ms = 150UL / portTICK_RATE_MS;\r
 /* 15 is added to ensure the number, \r\n and terminating zero fit. */\r
-const size_t xStringLength = strlen( ( char * ) pucStringToSend ) + 15;\r
+const size_t xStringLength = strlen( pcStringToSend ) + 15;\r
 \r
        /* Remove compiler warning about unused parameters. */\r
        ( void ) pvParameters;\r
@@ -296,7 +300,7 @@ const size_t xStringLength = strlen( ( char * ) pucStringToSend ) + 15;
                        end.  Note that the string is being written directly into the buffer\r
                        obtained from the IP stack above. */\r
                        memset( ( void * ) pucUDPPayloadBuffer, 0x00, xStringLength );\r
-                       sprintf( ( char * ) pucUDPPayloadBuffer, "%s%lu\r\n", ( char * ) pucStringToSend, ulCount );\r
+                       sprintf( ( char * ) pucUDPPayloadBuffer, "%s%lu\r\n", pcStringToSend, ulCount );\r
 \r
                        /* Pass the buffer into the send function.  ulFlags has the\r
                        FREERTOS_ZERO_COPY bit set so the IP stack will take control of the\r
@@ -379,7 +383,7 @@ xSocket_t xListeningSocket;
 \r
                /* It is expected to receive one more byte than the string length as\r
                the NULL terminator is also transmitted. */\r
-               configASSERT( lBytes == ( ( portBASE_TYPE ) strlen( ( const char * ) pucUDPPayloadBuffer ) + 1 ) );\r
+               configASSERT( lBytes == ( ( BaseType_t ) strlen( ( const char * ) pucUDPPayloadBuffer ) + 1 ) );\r
 \r
                /* Print the received characters. */\r
                if( lBytes > 0 )\r