Forum Discussion

Matt1's avatar
Matt1
Icon for Occasional Contributor rankOccasional Contributor
5 years ago

msgdma descriptor fifo depth

hello,

my target is to transfer about 1GB of data from system memory to local memory

the drop down field in the descriptor fifo depth in qsys have max 1024Kb

i wish to create 128 descriptors

hope the calculation of descriptor size is as follows.

each descriptor size is 20Bytes

so 128 descriptor = 20x128= 2.5KB

based on the above calculation i need a bigger buffer in the sgdma,

How can i allocate more memory to the dispatcher to do the memory transfer.

please correct me if my understanding is wrong.

thanks in advance

2 Replies

  • TKruse's avatar
    TKruse
    Icon for New Contributor rankNew Contributor

    Hi Matt1,

    the DMA is not used to hold all the data that you want to transfer at once. A DMA transfers data chunk wise. Therefore, you have to split your source data (1GB) into chunks of data that fit into your DMA data fifo and then you push the DMA transaction into the descriptor fifo.

    As an example, if you configure the MSGDMA with a Maximum Transfer Length of 4KB and a Descriptor FIFO Depth of 256 then you can instruct the MSGDMA to transfer data chunks of maximum 4KB at a time. While the first 4KB are initiated and are tranferred you can already push the next 4KB into the MSGDMA but since the DMA is busy they will be pushed into the descriptor fifo. As configured you can push 256 data chunks into the descriptor fifo. Whenever a transaction is done and there is another transaction queued in the descriptor fifo the next data chunk will be transferred until the descriptor fifo is empty.

    Back to your 1GB task. If you want to transfer the data in 20Byte chunks, you need a pseudo code like the following

    start_addr = where your data is
    size = 1024 * 1024 * 1024 // 1GB
    chunk_size = 20
    end_addr = start_addr + size
    chunk_start_addr = start_addr
    do {
        wait until descriptor buffer is not full
        push descriptor with start addr of "chunk_start_addr" and "chunk_size" bytes to transfer
        chunk_start_addr += chunk_size
    } while(chunk_start_addr < end_addr)
    push descriptor with the remaining bytes
    wait until transfer is done

    Although transmitting chunks of 20 bytes will work, I recommend you to transfer as many bytes as you configure in the MSGDMA component via "Maximum Transfer Length"

    I hope this helps.

    • Matt1's avatar
      Matt1
      Icon for Occasional Contributor rankOccasional Contributor

      Hello TKruse,

      thank you for your detailed reply.