How to make my peripheral compatible with DMA?

Board: DE10-Nano
FPGA: Cyclone V

Hello, this is my first post in this forum. As I really am a novice in hardware design, I have to apologize in advance that there would be unclear things or my misunderstandings.

I’m currently taking part in a FPGA project in my university, and what I want to make with FPGA is an accelerator for image filtering. To calculate convolution (filtering) for each 3x3 pixel area in my photo, my peripheral on the FPGA takes 3x3(image size)x3(RGB)x8(bytes to bits) = 216 bits as an input and outputs 8 bit value as a result of the convolution. Conversion from RGB to grayscale is done inside the peripheral before the pixels are convolved with a filter.
My teacher advised me to use DMA to send data of the 3x3 area from HPS memory to FPGA, since this peripheral involves much data transfer and DMA would contribute to much faster transfer than PIO.
After some searches, I found robertofem’s brilliant example about DMA transfer which is available here. When I executed the test code available in the same repository, I confirmed that values in my HPS memory were successfully transfered into the FPGA’s on-chip memory. ( though I needed to make minor modifications of the kernel module code to make it executable on DE10-Nano)

So, my question is

  1. How to transfer data from HPS to my own peripheral on FPGA (and the other way around) like the example above does to the on-chip memory? Should I make some modifications to my peripheral’s I/O to make it compatible with DMA? I really appreciate it if someone can direct me to an example where DMA is done between HPS memory and a peripheral that calculate some values on FPGA.

  2. When I tried to run a testbench to test my peripheral, ModelSim reported an error that the number of input pin of this module (216) is larger than the maximum number of user-configurable I/O pins on DE10-Nano. Does it indicate the whole data of 3x3 pixel area cannot be inputted at a time into my peripheral?

Thanks in advance for any help. (Sorry for my poor English)