Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

How to use the Nios DMA?

Hi, in order to improve the performance, I hope use the Nios DMA (Not Nios II) module to increase the transfer speed. But now I don't know how to use it. I simply use its subroutine on my original circuit, but it does not work. So, can anybody send a simple exaple to me?? Thus, let me understand the design method of DMA module between the software and the hardware. And I will very appreciate your kindness. Thanks.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Why not NIOS2 ?

    I where made DMA to speed up transfer between 2 memory's using nios2 and it not very dificault

    And i use HAL for that

    I can give examle to you

    if it's exactly that what you want.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Here is soft for using DMA on NIOS2

    void memcpy_my(int *where,int * from,int howmurch)

    {

    while ((IORD_ALTERA_AVALON_DMA_STATUS(WR_DMA_BASE) & ALTERA_AVALON_DMA_STATUS_BUSY_MSK));

    IOWR_ALTERA_AVALON_DMA_CONTROL(WR_DMA_BASE,0);

    IOWR_ALTERA_AVALON_DMA_STATUS(WR_DMA_BASE, 0);

    IOWR_ALTERA_AVALON_DMA_LENGTH(WR_DMA_BASE, howmurch);

    IOWR_ALTERA_AVALON_DMA_RADDRESS(WR_DMA_BASE, from);

    IOWR_ALTERA_AVALON_DMA_WADDRESS(WR_DMA_BASE, where);

    IOWR_ALTERA_AVALON_DMA_CONTROL(WR_DMA_BASE,ALTERA_AVALON_DMA_CONTROL_GO_MSK |

    ALTERA_AVALON_DMA_CONTROL_BYTE_MSK|

    ALTERA_AVALON_DMA_CONTROL_WEEN_MSK|

    ALTERA_AVALON_DMA_CONTROL_LEEN_MSK);

    while ((IORD_ALTERA_AVALON_DMA_STATUS(WR_DMA_BASE) & ALTERA_AVALON_DMA_STATUS_BUSY_MSK));# ifdef DEBUG

    printf("\nDMA packet\nfrom 0x%x\nwhere - 0x%x\nhowmurch - %d",from,where,howmurch);

    short status=0;# endif

    }
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi All,

    I'm trying to use NIOS2 DMA too, but actually I have to transfer data to/from an external device from/to my NIOS2 cpu. Please,

    what's your impression on this, does anyone have some suggestion to me in the architecture definition? I should have some kind of input/output

    device to connect to the dma avalon master, maybe a PIO? and how to manage FLOW control trough the PIO, for DMA and my external

    device?

    Thanks a Lot Massy