From: richardbarry Date: Sun, 17 Nov 2013 15:42:08 +0000 (+0000) Subject: Make SAM4E network driver a little more robust. X-Git-Tag: V7.6.0~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=73240230e107d30095d86ea9dd05d9f517aa565a;p=freertos Make SAM4E network driver a little more robust. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2104 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/SAM4E/NetworkInterface.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/SAM4E/NetworkInterface.c index 3da074ab2..9d732320e 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/SAM4E/NetworkInterface.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/portable/NetworkInterface/SAM4E/NetworkInterface.c @@ -216,6 +216,7 @@ static void prvGMACDeferredInterruptHandlerTask( void *pvParameters ) { xNetworkBufferDescriptor_t *pxNetworkBuffer; xIPStackEvent_t xRxEvent = { eEthernetRxEvent, NULL }; +static const portTickType xBufferWaitDelay = 500UL / portTICK_RATE_MS; ( void ) pvParameters; configASSERT( xGMACRxEventSemaphore ); @@ -232,7 +233,7 @@ xIPStackEvent_t xRxEvent = { eEthernetRxEvent, NULL }; /* The buffer filled by the DMA is going to be passed into the IP stack. Allocate another buffer for the DMA descriptor. */ - pxNetworkBuffer = pxNetworkBufferGet( ipTOTAL_ETHERNET_FRAME_SIZE, portMAX_DELAY ); + pxNetworkBuffer = pxNetworkBufferGet( ipTOTAL_ETHERNET_FRAME_SIZE, xBufferWaitDelay ); if( pxNetworkBuffer != NULL ) { @@ -287,9 +288,15 @@ xIPStackEvent_t xRxEvent = { eEthernetRxEvent, NULL }; } else { + vNetworkBufferRelease( pxNetworkBuffer ); iptraceETHERNET_RX_EVENT_LOST(); } } + else + { + /* Left a frame in the driver as a buffer was not available. */ + gmac_dev_reset( &xGMACStruct ); + } } } /*-----------------------------------------------------------*/