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.
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.
- 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.