Forum Discussion
Altera_Forum
Honored Contributor
15 years agocurrently, this is my code:
--- Quote Start --- # include "io.h"# include <stdio.h># include <unistd.h># include <sys/alt_dma.h># include "altera_avalon_dma_regs.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"# include "system.h" //#include "sys/alt_timestamp.h" int main() { int i; unsigned int dst = SDRAM_BASE + 0x200000; for(i=0; i<128; i++) { IOWR_32DIRECT(PERIPHERAL_0_BASE, 0, i); //printf("%d\n", IORD_32DIRECT(PERIPHERAL_0_BASE, 0)); } IOWR_ALTERA_AVALON_DMA_STATUS(DMA_BASE, 0x00); printf("%d\n", IORD_ALTERA_AVALON_DMA_STATUS(DMA_BASE)); IOWR_32DIRECT(PERIPHERAL_0_BASE, 0, i); IOWR_ALTERA_AVALON_DMA_RADDRESS(DMA_BASE, PERIPHERAL_0_BASE); IOWR_ALTERA_AVALON_DMA_WADDRESS(DMA_BASE,dst); IOWR_ALTERA_AVALON_DMA_LENGTH(DMA_BASE,100); IOWR_ALTERA_AVALON_DMA_CONTROL(DMA_BASE,0x19C); usleep(200000); for(i=0; i<128; i++) { printf("%d\n", IORD_32DIRECT(dst, i)); } return 0; } --- Quote End --- i dont know if the arrangement of my code is correct. update: i just manage to get the result for this: printf("%d\n", IORD_ALTERA_AVALON_DMA_STATUS(DMA_BASE)); which is 0