\r
/* Standard includes. */\r
#include <stdint.h>\r
+#include <limits.h>\r
\r
/* FreeRTOS includes. */\r
#include "FreeRTOS.h"\r
created. */\r
if( xGMACRxEventSemaphore == NULL )\r
{\r
- vSemaphoreCreateBinary( xGMACRxEventSemaphore );\r
+ xGMACRxEventSemaphore = xSemaphoreCreateCounting( ULONG_MAX, 0 );\r
#if ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1\r
{\r
/* If the trace recorder code is included name the semaphore for\r
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
\r
/* Unblock the deferred interrupt handler task if the event was an Rx. */\r
- if( ulStatus != 0 )\r
+ if( ulStatus == GMAC_RSR_REC )\r
{\r
xSemaphoreGiveFromISR( xGMACRxEventSemaphore, &xHigherPriorityTaskWoken );\r
}\r
{\r
xNetworkBufferDescriptor_t *pxNetworkBuffer;\r
xIPStackEvent_t xRxEvent = { eEthernetRxEvent, NULL };\r
-static const portTickType xBufferWaitDelay = 500UL / portTICK_RATE_MS;\r
+static const portTickType xBufferWaitDelay = 1500UL / portTICK_RATE_MS;\r
+uint32_t ulReturned;\r
\r
( void ) pvParameters;\r
configASSERT( xGMACRxEventSemaphore );\r
obtained. */\r
while( xSemaphoreTake( xGMACRxEventSemaphore, portMAX_DELAY ) == pdFALSE );\r
\r
- /* The buffer filled by the DMA is going to be passed into the IP\r
- stack. Allocate another buffer for the DMA descriptor. */\r
+ /* Allocate a buffer to hold the data. */\r
pxNetworkBuffer = pxNetworkBufferGet( ipTOTAL_ETHERNET_FRAME_SIZE, xBufferWaitDelay );\r
\r
if( pxNetworkBuffer != NULL )\r
{\r
/* At least one packet has been received. */\r
- if( gmac_dev_read( &xGMACStruct, pxNetworkBuffer->pucEthernetBuffer, ipTOTAL_ETHERNET_FRAME_SIZE, ( uint32_t * ) &( pxNetworkBuffer->xDataLength ) ) == GMAC_OK )\r
+ ulReturned = gmac_dev_read( &xGMACStruct, pxNetworkBuffer->pucEthernetBuffer, ipTOTAL_ETHERNET_FRAME_SIZE, ( uint32_t * ) &( pxNetworkBuffer->xDataLength ) );\r
+ if( ulReturned == GMAC_OK )\r
{\r
#if ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES == 1\r
{\r