I'm a EE and for a project at uni I'm developing hardware assisted image/video filtering on an FPGA (Xilinx ZYNQ), said device also has a dual core ARM A9 processor inside and more importantly there is also an ARM Primecell PL330 DMA controller
I'm using Yocto to build a basic linux environement that I can use on the processor with Xilinx's custom kernel kernel branch.
Now if I'understood correctly I'can't use the kernel DMA API directly, but I would have to write a custom kernel driver, and here lies the problem, since I don't have enough kernel knowledge to be able to do that (and in particular to set up a build environement for the custom module)...
so is there some kind of library/API/anything really that can make DMA transfers from userland? (in particular it would be from memory to a memory mapped peripheral (An AXI4 port between PS and PL on the zynq)
UPDATE
After some late night experimenting, I got a basic hello world kernel module to load correctly, so I think i'll go the right way and write a small device-driverish shim that takes a chunk of data from user space (part of an image in this case) and pass it to the FPGA part if the IC trough DMA api
I'll report my successes or failures ;)
Direct memory access, or DMA, is the advanced topic that completes our overview of memory issues. DMA is the hardware mechanism that allows peripheral components to transfer their I/O data directly to and from main memory without the need for the system processor to be involved in the transfer.
To initiate a DMA copy operation, software first writes a physical address to the DMA source and DMA destination registers. The address in the DMA destination register is the start address where the data will be copied and is always a contiguous block.
The dma_mask represents a bit mask of the addressable region for the device. I.e., if the physical address of the memory anded with the dma_mask is still equal to the physical address, then the device can perform DMA to the memory.
How Direct Memory Access Works. Direct memory access (DMA) is a means of having a peripheral device control a processor's memory bus directly. DMA permits the peripheral, such as a UART, to transfer data directly to or from memory without having each byte (or word) handled by the processor.
One potential option could be to use the UIO interface (See also this blog article)
There is some example code in the link, but the general structure of the code is:
Since you didn't specify what you want to do I cannot be more specific. But you need to figure how to initialize your memory in kernel (See the tag wiki for docs on that LDD3 is great).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With