Hello. I’m writing application on Zynq involving AXI Ethernet with DMA. I’m using Zynq port as an example of working with DMA. If Ethernet buffers are in cached memory we need to flush and invalidate cache (x_emacpsif_dma.c). The question is: why is invalidation region shifted by 2 bytes?
Xil_DCacheFlushRange( ( INTPTR ) pxBuffer->pucEthernetBuffer, ( u32 ) pxBuffer->xDataLength );
Xil_DCacheInvalidateRange( ( ( uint32_t ) pxNewBuffer->pucEthernetBuffer ) - ipconfigPACKET_FILLER_SIZE, ( uint32_t ) dmaRX_TX_BUFFER_SIZE );
I know that pucEthernetBuffer has special alignment to provide easy access to its fields but does it matter here? What about last 2 bytes which now are not included?
And another question here. It is related but separate question. There is a recommendation somewhere to use BufferAllocation_2.c for beginners. So I used it. My guess is that it should not be used with caching even with cache invalidation function because thouse buffers are not chache aligned? Or am I supposed to edit BufferAllocation_2.c to make them chache aligned?