Skip to content
2 changes: 1 addition & 1 deletion source/include/NetworkInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/

/* The following function is defined only when BufferAllocation_1.c is linked in the project. */
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] );
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] );

BaseType_t xGetPhyLinkStatus( struct xNetworkInterface * pxInterface );

Expand Down
11 changes: 8 additions & 3 deletions source/portable/BufferManagement/BufferAllocation_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ static NetworkBufferDescriptor_t xNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DES
* packet. No resizing will be done. */
const BaseType_t xBufferAllocFixedSize = pdTRUE;

static size_t uxMaxNetworkInterfaceAllocatedSizeBytes;

/* The semaphore used to obtain network buffers. */
static SemaphoreHandle_t xNetworkBufferSemaphore = NULL;

Expand Down Expand Up @@ -201,7 +203,10 @@ BaseType_t xNetworkBuffersInitialise( void )
/* Initialise all the network buffers. The buffer storage comes
* from the network interface, and different hardware has different
* requirements. */
vNetworkInterfaceAllocateRAMToBuffers( xNetworkBuffers );
uxMaxNetworkInterfaceAllocatedSizeBytes = uxNetworkInterfaceAllocateRAMToBuffers( xNetworkBuffers );

/* The allocated buffer should hold atleast ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER bytes */
configASSERT( ( uxMaxNetworkInterfaceAllocatedSizeBytes >= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) ) );

for( x = 0U; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
{
Expand Down Expand Up @@ -238,7 +243,7 @@ NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedS
UBaseType_t uxCount;

if( ( xNetworkBufferSemaphore != NULL ) &&
( xRequestedSizeBytes <= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) ) )
( xRequestedSizeBytes <= uxMaxNetworkInterfaceAllocatedSizeBytes ) )
{
/* If there is a semaphore available, there is a network buffer
* available. */
Expand Down Expand Up @@ -429,7 +434,7 @@ UBaseType_t uxGetNumberOfFreeNetworkBuffers( void )
NetworkBufferDescriptor_t * pxResizeNetworkBufferWithDescriptor( NetworkBufferDescriptor_t * pxNetworkBuffer,
size_t xNewSizeBytes )
{
if( xNewSizeBytes <= ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER ) )
if( xNewSizeBytes <= uxMaxNetworkInterfaceAllocatedSizeBytes )
{
/* In BufferAllocation_1.c all network buffer are allocated with a
* maximum size of 'ipTOTAL_ETHERNET_FRAME_SIZE'.No need to resize the
Expand Down
9 changes: 6 additions & 3 deletions source/portable/NetworkInterface/ATSAME5x/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,10 @@ void xRxCallback( void )

#if ( ipUSE_STATIC_ALLOCATION == 1 )

/* Next provide the vNetworkInterfaceAllocateRAMToBuffers() function, which
* simply fills in the pucEthernetBuffer member of each descriptor. */
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
/* Next provide the uxNetworkInterfaceAllocateRAMToBuffers() function, which
* simply fills in the pucEthernetBuffer member of each descriptor and returns
* the allocated buffer size. */
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
BaseType_t x;

Expand All @@ -515,6 +516,8 @@ void xRxCallback( void )
* future versions. */
*( ( uint32_t * ) &ucBuffers[ x ][ 0 ] ) = ( uint32_t ) &( pxNetworkBuffers[ x ] );
}

return( NETWORK_BUFFER_SIZE - ipBUFFER_PADDING );
}
#endif /* if ( ipUSE_STATIC_ALLOCATION == 1 ) */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ static void vCheckBuffersAndQueue( void )
/*-----------------------------------------------------------*/

extern uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS * NETWORK_BUFFER_SIZE ];
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
uint8_t * ucRAMBuffer = ucNetworkPackets;
uint32_t ulIndex;
Expand All @@ -1422,6 +1422,8 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
}

cache_clean_invalidate();

return( NETWORK_BUFFER_SIZE - ipBUFFER_PADDING );
}
/*-----------------------------------------------------------*/

Expand Down
4 changes: 3 additions & 1 deletion source/portable/NetworkInterface/LPC18xx/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ BaseType_t xNetworkInterfaceInitialise( void )

static __attribute__( ( section( "._ramAHB32" ) ) ) uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS * niBUFFER_1_PACKET_SIZE ] __attribute__( ( aligned( 32 ) ) );

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
uint8_t * ucRAMBuffer = ucNetworkPackets;
uint32_t ul;
Expand All @@ -343,6 +343,8 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
*( ( unsigned * ) ucRAMBuffer ) = ( unsigned ) ( &( pxNetworkBuffers[ ul ] ) );
ucRAMBuffer += niBUFFER_1_PACKET_SIZE;
}

return( niBUFFER_1_PACKET_SIZE - ipBUFFER_PADDING );
}
/*-----------------------------------------------------------*/

Expand Down
4 changes: 3 additions & 1 deletion source/portable/NetworkInterface/LPC54018/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,13 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkB
/* statically allocate the buffers */
/* allocating them as uint32_t's to force them into word alignment, a requirement of the DMA. */
__ALIGN_BEGIN static uint32_t buffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ][ ( ipBUFFER_PADDING + ENET_RXBUFF_SIZE ) / sizeof( uint32_t ) + 1 ] __ALIGN_END;
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
for( int x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ )
{
pxNetworkBuffers[ x ].pucEthernetBuffer = ( uint8_t * ) &buffers[ x ][ 0 ] + ipBUFFER_PADDING;
buffers[ x ][ 0 ] = ( uint32_t ) &pxNetworkBuffers[ x ];
}

return ENET_RXBUFF_SIZE;
}
4 changes: 3 additions & 1 deletion source/portable/NetworkInterface/M487/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxDescript
}


void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
uint8_t * ucRAMBuffer = ucNetworkPackets;
uint32_t ul;
Expand All @@ -191,6 +191,8 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
*( ( unsigned * ) ucRAMBuffer ) = ( unsigned ) ( &( pxNetworkBuffers[ ul ] ) );
ucRAMBuffer += niBUFFER_1_PACKET_SIZE;
}

return( niBUFFER_1_PACKET_SIZE - ipBUFFER_PADDING );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ static BaseType_t xMPS2_NetworkInterfaceOutput( NetworkInterface_t * pxInterface
}
/*-----------------------------------------------------------*/

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
/* FIX ME if you want to use BufferAllocation_1.c, which uses statically
* allocated network buffers. */
Expand All @@ -377,6 +377,7 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
* without implementing this function. */
configASSERT( xRxTaskHandle == ( TaskHandle_t ) 1 );
( void ) pxNetworkBuffers;
return 0;
}
/*-----------------------------------------------------------*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static BaseType_t xLAN91C111_NetworkInterfaceOutput( NetworkInterface_t * pxInte
}
/*-----------------------------------------------------------*/

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
/* FIX ME if you want to use BufferAllocation_1.c, which uses statically
* allocated network buffers. */
Expand All @@ -494,6 +494,7 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
* without implementing this function. */
configASSERT( 0 );
( void ) pxNetworkBuffers;
return 0;
}
/*-----------------------------------------------------------*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static BaseType_t xLAN91C111_NetworkInterfaceOutput( NetworkInterface_t * pxInte
}
/*-----------------------------------------------------------*/

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
/* FIX ME if you want to use BufferAllocation_1.c, which uses statically
* allocated network buffers. */
Expand All @@ -494,6 +494,7 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
* without implementing this function. */
configASSERT( 0 );
( void ) pxNetworkBuffers;
return 0;
}
/*-----------------------------------------------------------*/

Expand Down
8 changes: 5 additions & 3 deletions source/portable/NetworkInterface/RX/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,13 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )


/***********************************************************************************************************************
* Function Name: vNetworkInterfaceAllocateRAMToBuffers ()
* Function Name: uxNetworkInterfaceAllocateRAMToBuffers ()
* Description : .
* Arguments : pxNetworkBuffers
* Return Value : none
**********************************************************************************************************************/

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
uint32_t ul;
uint8_t * buffer_address;
Expand All @@ -443,7 +443,9 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
*( ( unsigned * ) buffer_address ) = ( unsigned ) ( &( pxNetworkBuffers[ ul ] ) );
buffer_address += ETHER_CFG_BUFSIZE;
}
} /* End of function vNetworkInterfaceAllocateRAMToBuffers() */

return( ETHER_CFG_BUFSIZE - ipBUFFER_PADDING );
} /* End of function uxNetworkInterfaceAllocateRAMToBuffers() */

/***********************************************************************************************************************
* Function Name: prvLinkStatusChange ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ static BaseType_t xSTM32F_GetPhyLinkStatus( NetworkInterface_t * pxInterface )

/* Uncomment this in case BufferAllocation_1.c is used. */

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
static
#if defined( STM32F7xx )
Expand All @@ -1393,6 +1393,7 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
*( ( unsigned * ) ucRAMBuffer ) = ( unsigned ) ( &( pxNetworkBuffers[ ul ] ) );
ucRAMBuffer += ETH_MAX_PACKET_SIZE;
}
return (ETH_MAX_PACKET_SIZE - ipBUFFER_PADDING);
}

/*-----------------------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS * ETH_RX_BUF_SI
#endif /* ( ipconfigZERO_COPY_RX_DRIVER != 0 || ipconfigZERO_COPY_TX_DRIVER != 0 ) */
__attribute__( ( aligned( 32 ) ) );

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
uint8_t * ucRAMBuffer = ucNetworkPackets;
uint32_t ul;
Expand All @@ -1045,6 +1045,8 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
*( ( unsigned * ) ucRAMBuffer ) = ( unsigned ) ( &( pxNetworkBuffers[ ul ] ) );
ucRAMBuffer += ETH_RX_BUF_SIZE;
}

return (ETH_RX_BUF_SIZE - ipBUFFER_PADDING);
}
/*-----------------------------------------------------------*/

Expand Down
4 changes: 3 additions & 1 deletion source/portable/NetworkInterface/STM32/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ void HAL_ETH_TxFreeCallback( uint32_t * pulBuff )
/*===========================================================================*/
/*---------------------------------------------------------------------------*/

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
static uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ][ niEMAC_TOTAL_BUFFER_SIZE ] __ALIGNED( niEMAC_BUF_ALIGNMENT ) __attribute__( ( section( niEMAC_BUFFERS_SECTION ) ) );

Expand All @@ -1985,6 +1985,8 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
pxNetworkBuffers[ uxIndex ].pucEthernetBuffer = &( ucNetworkPackets[ uxIndex ][ ipBUFFER_PADDING ] );
*( ( uint32_t * ) &( ucNetworkPackets[ uxIndex ][ 0 ] ) ) = ( uint32_t ) ( &( pxNetworkBuffers[ uxIndex ] ) );
}

return (niEMAC_TOTAL_BUFFER_SIZE - ipBUFFER_PADDING);
}

/*---------------------------------------------------------------------------*/
Expand Down
6 changes: 4 additions & 2 deletions source/portable/NetworkInterface/TM4C/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include "NetworkInterface.h"
#include "phyHandling.h"

#define BUFFER_SIZE_WO_PADDING ( ipconfigNETWORK_MTU + ipSIZE_OF_ETH_HEADER )
#define BUFFER_SIZE_WO_PADDING ( ipTOTAL_ETHERNET_FRAME_SIZE )
#define BUFFER_SIZE ( BUFFER_SIZE_WO_PADDING + ipBUFFER_PADDING )
#define BUFFER_SIZE_ROUNDED_UP ( ( BUFFER_SIZE + 7 ) & ~0x7UL )
#define PHY_PHYS_ADDR 0
Expand Down Expand Up @@ -403,7 +403,7 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkB
return success;
}

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
void uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
BaseType_t i;

Expand All @@ -415,6 +415,8 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
/* Set the 'hidden' reference to the descriptor for use in DMA interrupts */
*( ( uint32_t * ) &_network_buffers[ i ][ 0 ] ) = ( uint32_t ) &( ( pxNetworkBuffers[ i ] ) );
}

return( BUFFER_SIZE_ROUNDED_UP - ipBUFFER_PADDING );
}

static BaseType_t _ethernet_mac_get( uint8_t * mac_address_bytes )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ BaseType_t xGetPhyLinkStatus( void )
#define BUFFER_SIZE_ALLOC1 ( ipTOTAL_ETHERNET_FRAME_SIZE + ipBUFFER_PADDING )
#define BUFFER_SIZE_ALLOC1_ROUNDED_UP ( ( BUFFER_SIZE_ALLOC1 + 7 ) & ~0x07UL )
static uint8_t ucBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ][ BUFFER_SIZE_ALLOC1_ROUNDED_UP ];
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
BaseType_t x;

Expand All @@ -1011,4 +1011,6 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
* future versions. */
*( ( uint32_t * ) &ucBuffers[ x ][ 0 ] ) = ( uint32_t ) &( pxNetworkBuffers[ x ] );
}

return( BUFFER_SIZE_ALLOC1_ROUNDED_UP - ipBUFFER_PADDING );
}
4 changes: 3 additions & 1 deletion source/portable/NetworkInterface/WinPCap/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ static const char * prvRemoveSpaces( char * pcBuffer,
#define BUFFER_SIZE ( ipTOTAL_ETHERNET_FRAME_SIZE + ipBUFFER_PADDING )
#define BUFFER_SIZE_ROUNDED_UP ( ( BUFFER_SIZE + 7 ) & ~0x07UL )

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
static uint8_t * pucNetworkPacketBuffers = NULL;
size_t uxIndex;
Expand Down Expand Up @@ -979,4 +979,6 @@ void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkB
pxNetworkBuffers[ uxIndex ].pucEthernetBuffer = &( pucNetworkPacketBuffers[ uxOffset + ipBUFFER_PADDING ] );
}
}

return( BUFFER_SIZE_ROUNDED_UP - ipBUFFER_PADDING );
}
8 changes: 6 additions & 2 deletions source/portable/NetworkInterface/Zynq/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ static BaseType_t prvGMACWaitLS( BaseType_t xEMACIndex,
/*-----------------------------------------------------------*/

#if ( nicUSE_UNCACHED_MEMORY == 0 )
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
static uint8_t ucNetworkPackets[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS * niBUFFER_1_PACKET_SIZE ] __attribute__( ( aligned( 32 ) ) );
uint8_t * ucRAMBuffer = ucNetworkPackets;
Expand All @@ -498,9 +498,11 @@ static BaseType_t prvGMACWaitLS( BaseType_t xEMACIndex,
*( ( unsigned * ) ucRAMBuffer ) = ( unsigned ) ( &( pxNetworkBuffers[ ul ] ) );
ucRAMBuffer += niBUFFER_1_PACKET_SIZE;
}

return( niBUFFER_1_PACKET_SIZE - ipBUFFER_PADDING );
}
#else /* if ( nicUSE_UNCACHED_MEMORY == 0 ) */
void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
static uint8_t * pucNetworkPackets = NULL;

Expand All @@ -521,6 +523,8 @@ static BaseType_t prvGMACWaitLS( BaseType_t xEMACIndex,
}
}
}

return( niBUFFER_1_PACKET_SIZE - ipBUFFER_PADDING );
}
#endif /* ( nicUSE_UNCACHED_MEMORY == 0 ) */
/*-----------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion source/portable/NetworkInterface/Zynq/x_emacpsif_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
#endif
#define TX_OFFSET ipconfigPACKET_FILLER_SIZE

#define dmaRX_TX_BUFFER_SIZE 1536
#define dmaRX_TX_BUFFER_SIZE ( 1536 - ipBUFFER_PADDING )

/* Defined in NetworkInterface.c */
extern TaskHandle_t xEMACTaskHandles[ XPAR_XEMACPS_NUM_INSTANCES ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkB
return pdFALSE;
}

void vNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
size_t uxNetworkInterfaceAllocateRAMToBuffers( NetworkBufferDescriptor_t pxNetworkBuffers[ ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ] )
{
/* FIX ME. */
return 0;
}

BaseType_t xGetPhyLinkStatus( void )
Expand Down
Loading