Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThis is my code: I dunno why it wont work... the data cant be written into sdram.
--- 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; int a=100; unsigned int dst = SDRAM_BASE + 0x400000; IOWR_ALTERA_AVALON_DMA_STATUS(DMA_BASE, 0x00); for(i=0;i<100;i++) { IOWR(PERIPHERAL_0_BASE, 0, 30); 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,0X199); for(i=0;i<100;i++) { printf("%d\n", IORD(dst, i)); } } --- Quote End ---