freeRTOS-Plus-TCP Ethernet Driver

Hi,

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
}

many thanks

Hello @dings,

Welcome to FreeRTOS forums.

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 );
    }
}

Let us know if you have any more questions.

Thanks,
Aniruddha

Would really appreciate it if you can contribute your drive back once its ready. Thanks.

i think i can do this. but keep in mind that i am an absolute beginner when it comes to the freeRTOS-Plus-TCP and also freeRTOS in general.

No worries. We’ll help you along the way if you face any problems. Just post a question on FreeRTOS forums.

Thanks.