Arria® 10 or Cyclone® 10 GX Avalon® Memory-Mapped (Avalon-MM) DMA Interface for PCI Express* Solutions User Guide

ID 683425
Date 9/10/2024
Public
Document Table of Contents

6.7.5. Software Program for Simultaneous Read and Write DMA

Program the following steps to implement a simultaneous DMA transfer:

  1. Allocate PCIe* system memory for the Read and Write DMA descriptor tables. If, for example, each table supports up to 128, eight-DWORD descriptors and 128, one-DWORD status entries for a total of 1152 DWORDs. Total memory for the Read and Write DMA descriptor tables is 2304 DWORDs.
  2. Allocate PCIe* system memory and initialize it with data for the Read Data Mover to read.
  3. Allocate PCIe* system memory for the Write Data Mover to write.
  4. Create all the descriptors for the read DMA descriptor table. Assign the DMA Descriptor IDs sequentially, starting with 0 to a maximum of 127. For the read DMA, the source address is the memory space allocated in Step 2. The destination address is the Avalon‑MM address that the Read Data Mover module writes. Specify the DMA length in DWORDs. Each descriptor transfers contiguous memory. Assuming a base address of 0, for the Read DMA, the following assignments illustrate construction of a read descriptor:
    1. RD_LOW_SRC_ADDR = 0x0000 (The base address for the read descriptor table in the PCIe system memory.)
    2. RD_HIGH_SRC_ADDR = 0x0004
    3. RD_CTRL_LOW_DEST_ADDR 0x0008
    4. RD_CTRL_HIGH_DEST_ADDR = 0x000C
    5. RD_DMA_LAST_PTR = 0x0010
    Writing the RD_DMA_LAST_PTR register starts operation.
  5. For the Write DMA, the source address is the Avalon‑MM address that the Write Data Mover module should read. The destination address is the PCIe* system memory space allocated in Step 3. Specify the DMA size in DWORDs. Assuming a base address of 0x100, for the Write Data Mover, the following assignments illustrate construction of a write descriptor:
    1. WD_LOW_SRC_ADDR = 0x0100 (The base address for the write descriptor table in the PCIe* system memory.)
    2. WD_HIGH_SRC_ADDR = 0x0104
    3. WD_CTRL_LOW_DEST_ADDR 0x0108
    4. WD_CTRL_HIGH_DEST_ADDR = 0x010C
    5. WD_DMA_LAST_PTR = 0x0110
    Writing the WD_DMA_LAST_PTR register starts operation.
  6. To improve throughput, the Read DMA module copies the descriptor table to the Avalon-MM memory before beginning operation. Specify the memory address by writing to the Descriptor Table Base (Low) and (High) registers.
  7. An MSI interrupt is sent for each WD_DMA_LAST_PTR or RD_DMA_LAST_PTR that completes. These completions result in updates to the done status bits. Host software can then read status bits to determine which DMA operations are complete.
Note: If the transfer size of the read DMA is greater than the maximum read request size, the Read DMA creates multiple read requests. For example, if maximum read request size is 512 bytes, the Read Data Mover breaks a 4 KB read request into 8 requests with 8 different tags. The Read Completions can come back in any order. The Read Data Mover's Avalon-MM master port writes the data received in the Read Completions to the correct locations in Avalon® -MM memory, based on the tags in the same order as it receives the Completions. This order is not necessarily in increasing address order;. The data mover does not include an internal reordering buffer. If system allows out of order read completions, then status for the latest entry is latest only in number, but potentially earlier than other completions chronologically