pucGetNetworkBuffer() and BufferAllocation_1.c

tc-cadscan wrote on Thursday, December 21, 2017:

I’m attempting to write a zero-copy network driver for FreeRTOS+TCP. The DMA alignment requirements for the chip I’m using mean that I need to use statically allocated buffers (i.e. BufferAllocation_1.c). The page on porting says that the receive buffers should be allocated to the DMA at start-up using pucGetNetworkBuffer(), but this isn’t defined in BufferAllocation_1.c, only in BufferAllocation_2.c

I think I can get around this by getting a full descriptor (using pxGetNetworkBufferWithDescriptor()), and using the buffer from that. Then set the descriptor’s buffer pointer to NULL and give it back to the TCP/IP stack, like in the receiving data example on the porting page. However there doesn’t seem to be anything in BufferAllocation_1.c to prevent a descriptor with a NULL pointer from being reused, so I’m not sure if this will actually work?

It seems as though the examples on the porting page for writing zero-copy drivers couldn’t actually work with the code as is. Looking on this forum though, it seems several people have had success writing zero-copy drivers before, so it must be possible. Am I missing something here?

rtel wrote on Thursday, December 21, 2017:

Have a look at the Zynq example in the labs download. I think that uses
BufferAllocation_1.c and might be a good reference.