Using DMA to F2SDRAM and accessing that from the HPS - Arria 10 SoC

How do I access the SDRAM from the HPS? I’m trying to send a streaming fifo into a DMA engine on the FPGA and route that straight to the F2SDRAM port.

I have access to the DMA registers via the lightweight bridge.

But I’m not sure if I need to do special stuff to get access to the memory from the HPS or what address to use when commanding the DMA engine.

thanks

At a very high level you will need to use dma_alloc_coherent to allocate the buffer. From that function call you will receive two addresses, the address to memory that Linux requires is returned (DmaBufferPtr) and the hardware address of that same memory (DmaBufferHandle), here is some pseudo code:

DmaBufferPtr = dma_alloc_coherent(&pdev->dev,
                 buffer_size, &DmaBufferHandle, GFP_KERNEL);

Use the Handle when setting the read/write address for the MSGDMA, use the other address for access via Linux.

A good example with more detail (and great reference in general) are the SOC Workshops, for DMA specifically check out this link, you’ll learn about the device driver development and DMAs:

1 Like