Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

ID 814346
Date 11/27/2024
Public
Document Table of Contents

5.1.7.4. DMA Initialization

This section provides the instructions for initializing the DMA registers in the proper sequence. This initialization sequence can be done after the EMAC interface initialization has been completed. Perform the following steps to initialize the DMA:

  1. Provide a software reset to reset all of the EMAC internal registers and logic. (SWR, bit 0 of DMA_Mode register).
  2. Wait for the completion of the reset process (poll SWR, bit 0 of the DMA_Mode register, which is only cleared after the reset operation is completed).
  3. Program the following fields to initialize the DMA_SysBus_Mode register:
    1. AAL
    2. UNDEF
    3. EAME
    4. If fixed burst length is enabled (UNDEF = 0), select the maximum burst length possible on the AXI bus (bits [7:1]).
  4. Create a descriptor list for transmit and receive. In addition, ensure that the receive descriptors are owned by DMA (set bit 31 of descriptor TDES3/RDES3).
    Note: Descriptor address from start to end of the ring must not cross the 4 GB boundary.
  5. Program the transmit and receive ring length registers (DMA_CH(#i)_Tx_Control2 and DMA_CH(#i)_Rx_Control2). The ring length programmed must at least be the size of the descriptor cache of the corresponding DMA.
  6. Initialize receive and transmit descriptor list address with the base address of the transmit and receive descriptor (DMA_CH(#i)_TxDesc_List_LAddress, DMA_CH(#i)_RxDesc_List_LAddress). Program transmit and receive tail pointer registers indicating to the DMA about the available descriptors (DMA_CH(#i)_TxDesc_Tail_LPointer and DMA_CH(#i)_RxDesc_Tail_LPointer).
    Note: For 40- or 48-bit addressing mode, program the higher address list registers (DMA_CH(#i)_TxDesc_List_HAddress, DMA_CH(#i)_RxDesc_List_HAddress).
  7. Enable the interrupts by programming the DMA_CH(#i)_Interrupt_Enable register.
  8. Program the settings of the DMA_CH(#i)_Control, DMA_CH(#i)_Tx_Control and DMA_CH(#i)_Rx_Control for the parameters like maximum burst-length (PBL) initiated by DMA, descriptor skip lengths, OSP in case of TX DMA; RBSZ in case of RX DMA, and so on.
  9. Start the receive and transmit DMA by setting bit 0 of the DMA_CH(#i)_Tx_Control register and bit 0 of the DMA_CH(#i)_Rx_Control register. Repeat steps 4 to 9 for all DMA Tx and Rx channels selected in the configuration.
Repeat steps 4 to 9 for all DMA TX and RX channels selected in the configuration.