cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS+TCP NetworkInterface Porting

Michele G
Associate
Posted on April 10, 2018 at 16:05

I'm trying to to port the NetworkInterface.c to STM32H7 

I'm following the instructions

 provided for

https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Porting.html

for other chips.

As for first step I'm interesting in implementing the simplest solution that do not involves using DMA.

BufferAllocation_2 is the selected network buffer scheme

I'm not sure how to use HAL libraries to implement  

BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxDescriptor, BaseType_t xReleaseAfterSend );

/**

* The network interface port layer must provide a function called xNetworkInterfaceOutput()

* that sends data received from the embedded TCP/IP stack to the Ethernet MAC driver for transmission.

*/

BaseType_t xNetworkInterfaceOutput(NetworkBufferDescriptor_t * const pxDescriptor, BaseType_t xReleaseAfterSend)

{

/* Simple network interfaces just use Ethernet peripheral driver library functions to copy

data from the FreeRTOS+TCP buffer into the peripheral driver's own buffer. */

&sharpif( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM != 0 )

{

   ProtocolPacket_t *pxPacket;

   /* If the peripheral must calculate the checksum, it wants

   the protocol checksum to have a value of zero. */

   pxPacket = ( ProtocolPacket_t * ) ( pxDescriptor->pucEthernetBuffer );

   if( pxPacket->xICMPPacket.xIPHeader.ucProtocol == ipPROTOCOL_ICMP )

   {

      pxPacket->xICMPPacket.xICMPHeader.usChecksum = ( uint16_t )0u;

   }

}

&sharpendif

/* Copy 

data from the FreeRTOS+TCP buffer into the peripheral driver's own buffer 

The start of the data is located

by pxDescriptor->pucEthernetBuffer. The length of the data is located

by pxDescriptor->xDataLength.*/

/** --------------------------------------QUESTION---------------------------------------------

 * HAL ETH  Implementation 

 *

 *

 -----------------------------------------------------------------------------------------------------*/

/* Call the standard trace macro to log the send event. */

iptraceNETWORK_INTERFACE_TRANSMIT();

if( xReleaseAfterSend != pdFALSE )

{

/* It is assumed SendData() copies the data out of the FreeRTOS+TCP Ethernet

buffer. The Ethernet buffer is therefore no longer needed, and must be

freed for re-use. */

vReleaseNetworkBufferAndDescriptor( pxDescriptor );

}

return pdTRUE;

}

This is my first time with HAL and in this instance I'm finding difficulties understanding how I should proceed.

Thanks for any help or suggestion.

#freertos+tcp #hal-eth #freerots
0 REPLIES 0