I’m in the process of writing a freeRTOS-Plus-TCP Ethernet driver for the NXP LPC1769. It should be a zero copy driver and use BufferAllocation_1.c.
So here is my 1st problem:
xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, BaseType_t xReleaseAfterSend )
{
1.) release previous dma assigned buffer
But vReleaseNetworkBuffer() is not defined in BufferAllocation_1.c.
Only vNetworkBufferReleaseFromISR( NetworkBufferDescriptor_t * const pxNetworkBuffer )
but in my ISR i only have acces to the DMA Buffer and not to the FreeRTOS-Plus-TCP NetworkBufferDescriptor.
How should this be done?
2.) assign buffer and length from NetworkBufferDescriptor to the DMA-Discriptor
3.) set buffer pointer to NULL and release NetworkBufferDescriptor
}
But vReleaseNetworkBuffer() is not defined in BufferAllocation_1.c.
There is an equivalent for that - albeit the naming is a bit different. It is called vReleaseNetworkBufferAndDescriptor.
You can use this to return the descriptor to the free list.
So, your function will look like this:
xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer, BaseType_t xReleaseAfterSend )
{
/* 1.) assign buffer and length from NetworkBufferDescriptor to the DMA-Discriptor. */
/* 2.) Put a memory barrier to make sure the data and length fields are updated before
ownership is transferred to DMA using dsb(). */
dsb();
/* 3.) Transfer ownership of the buffer to the DMA driver. */
/* 4.) Make sure that DMA has finished reading the buffer. */
if( xReleaseAfterSend == pdTRUE )
{
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );
}
}