mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 21:41:59 -04:00
Tidy up SAM4E NetworkInterface.c.
This commit is contained in:
parent
c6020ae8b4
commit
ad67be1577
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
/* FreeRTOS includes. */
|
/* FreeRTOS includes. */
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
@ -126,7 +127,7 @@ portBASE_TYPE xReturn = pdFALSE;
|
||||||
created. */
|
created. */
|
||||||
if( xGMACRxEventSemaphore == NULL )
|
if( xGMACRxEventSemaphore == NULL )
|
||||||
{
|
{
|
||||||
vSemaphoreCreateBinary( xGMACRxEventSemaphore );
|
xGMACRxEventSemaphore = xSemaphoreCreateCounting( ULONG_MAX, 0 );
|
||||||
#if ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1
|
#if ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS == 1
|
||||||
{
|
{
|
||||||
/* If the trace recorder code is included name the semaphore for
|
/* If the trace recorder code is included name the semaphore for
|
||||||
|
@ -169,7 +170,7 @@ static void prvGMACRxCallback( uint32_t ulStatus )
|
||||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
/* Unblock the deferred interrupt handler task if the event was an Rx. */
|
/* Unblock the deferred interrupt handler task if the event was an Rx. */
|
||||||
if( ulStatus != 0 )
|
if( ulStatus == GMAC_RSR_REC )
|
||||||
{
|
{
|
||||||
xSemaphoreGiveFromISR( xGMACRxEventSemaphore, &xHigherPriorityTaskWoken );
|
xSemaphoreGiveFromISR( xGMACRxEventSemaphore, &xHigherPriorityTaskWoken );
|
||||||
}
|
}
|
||||||
|
@ -216,7 +217,8 @@ static void prvGMACDeferredInterruptHandlerTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
xNetworkBufferDescriptor_t *pxNetworkBuffer;
|
xNetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||||
xIPStackEvent_t xRxEvent = { eEthernetRxEvent, NULL };
|
xIPStackEvent_t xRxEvent = { eEthernetRxEvent, NULL };
|
||||||
static const portTickType xBufferWaitDelay = 500UL / portTICK_RATE_MS;
|
static const portTickType xBufferWaitDelay = 1500UL / portTICK_RATE_MS;
|
||||||
|
uint32_t ulReturned;
|
||||||
|
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
configASSERT( xGMACRxEventSemaphore );
|
configASSERT( xGMACRxEventSemaphore );
|
||||||
|
@ -231,14 +233,14 @@ static const portTickType xBufferWaitDelay = 500UL / portTICK_RATE_MS;
|
||||||
obtained. */
|
obtained. */
|
||||||
while( xSemaphoreTake( xGMACRxEventSemaphore, portMAX_DELAY ) == pdFALSE );
|
while( xSemaphoreTake( xGMACRxEventSemaphore, portMAX_DELAY ) == pdFALSE );
|
||||||
|
|
||||||
/* The buffer filled by the DMA is going to be passed into the IP
|
/* Allocate a buffer to hold the data. */
|
||||||
stack. Allocate another buffer for the DMA descriptor. */
|
|
||||||
pxNetworkBuffer = pxNetworkBufferGet( ipTOTAL_ETHERNET_FRAME_SIZE, xBufferWaitDelay );
|
pxNetworkBuffer = pxNetworkBufferGet( ipTOTAL_ETHERNET_FRAME_SIZE, xBufferWaitDelay );
|
||||||
|
|
||||||
if( pxNetworkBuffer != NULL )
|
if( pxNetworkBuffer != NULL )
|
||||||
{
|
{
|
||||||
/* At least one packet has been received. */
|
/* At least one packet has been received. */
|
||||||
if( gmac_dev_read( &xGMACStruct, pxNetworkBuffer->pucEthernetBuffer, ipTOTAL_ETHERNET_FRAME_SIZE, ( uint32_t * ) &( pxNetworkBuffer->xDataLength ) ) == GMAC_OK )
|
ulReturned = gmac_dev_read( &xGMACStruct, pxNetworkBuffer->pucEthernetBuffer, ipTOTAL_ETHERNET_FRAME_SIZE, ( uint32_t * ) &( pxNetworkBuffer->xDataLength ) );
|
||||||
|
if( ulReturned == GMAC_OK )
|
||||||
{
|
{
|
||||||
#if ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES == 1
|
#if ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES == 1
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue