AnsweredAssumed Answered

FreeRTOS+TCP NetworkInterface Porting

Question asked by Michele G on Apr 10, 2018

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

I'm following the instructions provided for creating network drivers 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. */


   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;


/* 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. */

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.