Make SAM4E network driver a little more robust.

This commit is contained in:
Richard Barry 2013-11-17 15:42:08 +00:00
parent c2bfac68b3
commit 8cd71348be

View file

@ -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 );
}
}
}
/*-----------------------------------------------------------*/