Visible to Intel only — GUID: iga1401397404082
Ixiasoft
Visible to Intel only — GUID: iga1401397404082
Ixiasoft
32.3.2. DMA Descriptors
Storing the descriptor list in an external memory frees up resources in the FPGA; however, an external descriptor list increases the overhead involved when the descriptor processor reads and updates the list. The SG-DMA core has an internal FIFO to store descriptors read from memory, which allows the core to perform descriptor read, execute, and write back operations in parallel, hiding the descriptor access and processing overhead.
The descriptors must be initialized and aligned on a 32-bit boundary. The last descriptor in the list must have its OWNED_BY_HW bit set to 0 because the core relies on a cleared OWNED_BY_HW bit to stop processing.
See the DMA Descriptors section for the structure of the DMA descriptor.
Descriptor Processing
The following steps describe how the DMA descriptors are processed:
- Software builds the descriptor linked list. See the Building and Updating Descriptors List section for more information on how to build and update the descriptor linked list.
- Software writes the address of the first descriptor to the next_descriptor_pointer register and initiates the transfer by setting the RUN bit in the control register to 1. See the Software Programming Model section for more information on the registers.
On the next clock cycle following the assertion of the RUN bit, the core sets the BUSY bit in the status register to 1 to indicate that descriptor processing is executing.
- The descriptor processor block reads the address of the first descriptor from the next_descriptor_pointer register and pushes the retrieved descriptor into the command FIFO, which feeds commands to both the DMA read and write blocks. As soon as the first descriptor is read, the block reads the next descriptor and pushes it into the command FIFO. One descriptor is always read in advance thus maximizing throughput.
- The core performs the data transfer.
- In memory-to-memory configurations, the DMA read block receives the source address from its command FIFO and starts reading data to fill the FIFO on its stream port until the specified number of bytes are transferred. The DMA read block pauses when the FIFO is full until the FIFO has enough space to accept more data. The DMA write block gets the destination address from its command FIFO and starts writing until the specified number of bytes are transferred. If the data FIFO ever empties, the write block pauses until the FIFO has more data to write.
- In memory-to-stream configurations, the DMA read block reads from the source address and transfers the data to the core’s streaming port until the specified number of bytes are transferred or the end of packet is reached. The block uses the end-of-packet indicator for transfers with an unknown transfer size. For data transfers without using the end-of-packet indicator, the transfer size must be a multiple of the data width. Otherwise, the block requires extra logic and may impact the system performance.
- In stream-to-memory configurations, the DMA write block reads from the core’s streaming port and writes to the destination address. The block continues reading until the specified number of bytes are transferred.
- The descriptor processor block receives a status from the DMA read or write block and updates the DESC_CONTROL, DESC_STATUS, and ACTUAL_BYTES_TRANSFERRED fields in the descriptor. The OWNED_BY_HW bit in the DESC_CONTROL field is cleared unless the PARK bit is set to 1.
Once the core starts processing the descriptors, software must not update descriptors with OWNED_BY_HW bit set to 1. It is only safe for software to update a descriptor when its OWNED_BY_HW bit is cleared.
The SG-DMA core continues processing the descriptors until an error condition occurs and the STOP_DMA_ER bit is set to 1, or a descriptor with a cleared OWNED_BY_HW bit is encountered.
Building and Updating Descriptor List
Intel recommends the following method of building and updating the descriptor list:
- Build the descriptor list and terminate the list with a non-hardware owned descriptor (OWNED_BY_HW = 0). The list can be arbitrarily long.
- Set the interrupt IE_CHAIN_COMPLETED.
- Write the address of the first descriptor in the first list to the next_descriptor_pointer register and set the RUN bit to 1 to initiate transfers.
- While the core is processing the first list, build a second list of descriptors.
- When the SGDMS controller core finishes processing the first list, an interrupt is generated. Update the next_descriptor_pointer register with the address of the first descriptor in the second list. Clear the RUN bit and the status register. Set the RUN bit back to 1 to resume transfers.
- If there are new descriptors to add, always add them to the list which the core is not processing. For example, if the core is processing the first list, add new descriptors to the second list and so forth.
This method ensures that the descriptors are not updated when the core is processing them. Because the method requires a response to the interrupt, a high-latency interrupt may cause a problem in systems where stalling data movement is not possible.