]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/LPC17xx/NetworkInterface.c
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-UDP / portable / NetworkInterface / LPC17xx / NetworkInterface.c
index 384fb475466113f627d7bedc6ff357da041b3a00..290b9f58f77fcbb4787d5628add028d6154cc2a9 100644 (file)
@@ -1,38 +1,29 @@
 /*\r
- * FreeRTOS+UDP V1.0.0 (C) 2013 Real Time Engineers ltd.\r
+ * FreeRTOS+UDP V1.0.4\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
  *\r
- * FreeRTOS+UDP is an add-on component to FreeRTOS.  It is not, in itself, part\r
- * of the FreeRTOS kernel.  FreeRTOS+UDP is licensed separately from FreeRTOS,\r
- * and uses a different license to FreeRTOS.  FreeRTOS+UDP uses a dual license\r
- * model, information on which is provided below:\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
  *\r
- * - Open source licensing -\r
- * FreeRTOS+UDP is a free download and may be used, modified and distributed\r
- * without charge provided the user adheres to version two of the GNU General\r
- * Public license (GPL) and does not remove the copyright notice or this text.\r
- * The GPL V2 text is available on the gnu.org web site, and on the following\r
- * URL: http://www.FreeRTOS.org/gpl-2.0.txt\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software. If you wish to use our Amazon\r
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
  *\r
- * - Commercial licensing -\r
- * Businesses and individuals who wish to incorporate FreeRTOS+UDP into\r
- * proprietary software for redistribution in any form must first obtain a\r
- * (very) low cost commercial license - and in-so-doing support the maintenance,\r
- * support and further development of the FreeRTOS+UDP product.  Commercial\r
- * licenses can be obtained from http://shop.freertos.org and do not require any\r
- * source files to be changed.\r
- *\r
- * FreeRTOS+UDP is distributed in the hope that it will be useful.  You cannot\r
- * use FreeRTOS+UDP unless you agree that you use the software 'as is'.\r
- * FreeRTOS+UDP is provided WITHOUT ANY WARRANTY; without even the implied\r
- * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they\r
- * implied, expressed, or statutory.\r
- *\r
- * 1 tab == 4 spaces!\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
  *\r
  * http://www.FreeRTOS.org\r
- * http://www.FreeRTOS.org/udp\r
+ * http://aws.amazon.com/freertos\r
  *\r
+ * 1 tab == 4 spaces!\r
  */\r
 \r
 /* Standard includes. */\r
@@ -49,6 +40,7 @@
 \r
 /* FreeRTOS+UDP includes. */\r
 #include "FreeRTOS_UDP_IP.h"\r
+#include "FreeRTOS_IP_Private.h"\r
 #include "FreeRTOS_Sockets.h"\r
 #include "NetworkBufferManagement.h"\r
 \r
@@ -69,7 +61,7 @@
 task performing the transmit will block for niTX_BUFFER_FREE_WAIT\r
 milliseconds.  It will do this a maximum of niMAX_TX_ATTEMPTS before giving\r
 up. */\r
-#define niTX_BUFFER_FREE_WAIT  ( ( portTickType ) 2UL / portTICK_RATE_MS )\r
+#define niTX_BUFFER_FREE_WAIT  ( ( TickType_t ) 2UL / portTICK_RATE_MS )\r
 #define niMAX_TX_ATTEMPTS              ( 5 )\r
 \r
 /* The length of the queue used to send interrupt status words from the\r
@@ -93,11 +85,11 @@ interrupt is received. */
 static xSemaphoreHandle xEMACRxEventSemaphore = NULL;\r
 /*-----------------------------------------------------------*/\r
 \r
-portBASE_TYPE xNetworkInterfaceInitialise( void )\r
+BaseType_t xNetworkInterfaceInitialise( void )\r
 {\r
 EMAC_CFG_Type Emac_Config;\r
 PINSEL_CFG_Type xPinConfig;\r
-portBASE_TYPE xStatus, xReturn;\r
+BaseType_t xStatus, xReturn;\r
 extern uint8_t ucMACAddress[ 6 ];\r
 \r
        /* Enable Ethernet Pins */\r
@@ -116,7 +108,7 @@ extern uint8_t ucMACAddress[ 6 ];
 \r
                /* The handler task is created at the highest possible priority to\r
                ensure the interrupt handler can return directly to it. */\r
-               xTaskCreate( prvEMACHandlerTask, ( const signed char * const ) "EMAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );\r
+               xTaskCreate( prvEMACHandlerTask, "EMAC", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );\r
 \r
                /* Enable the interrupt and set its priority to the minimum\r
                interrupt priority.  */\r
@@ -136,9 +128,9 @@ extern uint8_t ucMACAddress[ 6 ];
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-portBASE_TYPE xNetworkInterfaceOutput( xNetworkBufferDescriptor_t * const pxNetworkBuffer )\r
+BaseType_t xNetworkInterfaceOutput( xNetworkBufferDescriptor_t * const pxNetworkBuffer )\r
 {\r
-portBASE_TYPE xReturn = pdFAIL;\r
+BaseType_t xReturn = pdFAIL;\r
 int32_t x;\r
 extern void EMAC_StartTransmitNextBuffer( uint32_t ulLength );\r
 extern void EMAC_SetNextPacketToSend( uint8_t * pucBuffer );\r
@@ -154,10 +146,10 @@ extern void EMAC_SetNextPacketToSend( uint8_t * pucBuffer );
                        {\r
                                /* Assign the buffer to the Tx descriptor that is now known to\r
                                be free. */\r
-                               EMAC_SetNextPacketToSend( pxNetworkBuffer->pucBuffer );\r
+                               EMAC_SetNextPacketToSend( pxNetworkBuffer->pucEthernetBuffer );\r
 \r
                                /* The EMAC now owns the buffer. */\r
-                               pxNetworkBuffer->pucBuffer = NULL;\r
+                               pxNetworkBuffer->pucEthernetBuffer = NULL;\r
 \r
                                /* Initiate the Tx. */\r
                                EMAC_StartTransmitNextBuffer( pxNetworkBuffer->xDataLength );\r
@@ -206,8 +198,10 @@ uint32_t ulInterruptCause;
                }\r
        }\r
 \r
-       /* Shortcut calling portEND_SWITCHING_ISR(). */\r
-       vPortYieldFromISR();\r
+       /* ulInterruptCause is used for convenience here.  A context switch is\r
+       wanted, but coding portEND_SWITCHING_ISR( 1 ) would likely result in a\r
+       compiler warning. */\r
+       portEND_SWITCHING_ISR( ulInterruptCause );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -244,17 +238,17 @@ extern uint8_t *EMAC_NextPacketToRead( void );
                                stack.  No storage is required as the network buffer\r
                                will point directly to the buffer that already holds\r
                                the     received data. */\r
-                               pxNetworkBuffer = pxNetworkBufferGet( 0, ( portTickType ) 0 );\r
+                               pxNetworkBuffer = pxNetworkBufferGet( 0, ( TickType_t ) 0 );\r
 \r
                                if( pxNetworkBuffer != NULL )\r
                                {\r
-                                       pxNetworkBuffer->pucBuffer = EMAC_NextPacketToRead();\r
+                                       pxNetworkBuffer->pucEthernetBuffer = EMAC_NextPacketToRead();\r
                                        pxNetworkBuffer->xDataLength = xDataLength;\r
                                        xRxEvent.pvData = ( void * ) pxNetworkBuffer;\r
 \r
                                        /* Data was received and stored.  Send a message to the IP\r
                                        task to let it know. */\r
-                                       if( xQueueSendToBack( xNetworkEventQueue, &xRxEvent, ( portTickType ) 0 ) == pdFALSE )\r
+                                       if( xQueueSendToBack( xNetworkEventQueue, &xRxEvent, ( TickType_t ) 0 ) == pdFALSE )\r
                                        {\r
                                                vNetworkBufferRelease( pxNetworkBuffer );\r
                                                iptraceETHERNET_RX_EVENT_LOST();\r