Scalable Scatter-Gather DMA Intel® FPGA IP User Guide

ID 823097
Date 4/07/2025
Public
Document Table of Contents

5. HAL Driver for DMA SoC Mode 

This section describes the HAL driver for the DMA SoC mode. SSGDMA IP is equipped with AXI-4/4- LITE interfaces which is intended to pair with the HPS / Nios® V processor.  

Note: This driver is not supported for the Nios® II processor.
Note: For DMA only mode, the host writes the descriptor directly to the SSGDMA controller. You need to create your own custom Prefetcher logic and driver for DMA Only mode.

The driver only returns a negative value as an error if the error is due to software or can be detected with HW-CSR. An error while reading/writing registers (IORD or IOWR) or due to wrong configuration of Device_Interface_Control/Device_Interface_Control (Data descriptor) is not be considered. 

The driver does not allocate or manage memory for the data buffers. You should do this in the application. 

The driver allocates contiguous memory for data and responder descriptor blocks. After allocation, the same function initializes the data descriptor with format and index. The link descriptor is also chained with the next address. Besides that, the responder table also is filled. (For more information, refer to intel_ssgdma_setup_device_port). If you decide to do non-contiguous memory allocation, then the driver needs to be modified manually. 

You may set different descriptor and responder blocks and should not “skip” the data descriptor, (for example, setting valid in control to 0). This is to ensure, that the driver gets the correct responder.  If these are violated, you need to modify the driver to get the correct responder. For more information, refer to the Descriptor Indexing section. 

There are no memory management for HAL OS. Ensure that the memory management for HAL OS has sufficient heap memory for dynamic memory allocation. For example, if the design has three device ports and each device port has two blocks of descriptors, and responders are enabled:
  • Required minimum heap size: 49KB
  • sizeof(intel_ssgdma_device_port) = 40 bytes
  • Descriptor per block = 128, size of one descriptor = 32 bytes
  • Two descriptor blocks = 2 x 128 x 32 = 8192 bytes
  • If responder is enabled, memory for descriptor together with responder is equal to 8192 x 2 = 16384 bytes.
  • Bytes required per port = 16384 + 40 = 16424 bytes. If three ports are used, 3 x 16424 = 49KB.

If heap and stack shares the same memory, ensure that at least 100KB is free. Ensure that you increase the memory of the design to meet the minimal 100KB of free memory space or else this causes unrecoverable memory allocation error.

The condition of Descriptor buffer full or empty is indicated by the last slot in the circular descriptor. The last slot of the circular descriptor is “sacrificed” to distinguish empty and full condition.
Figure 19. Buffer Full
Figure 20. Buffer Empty
Figure 21. Buffer Full in the middle of Descriptor