Altera_Forum
Honored Contributor
20 years agoAbout DMA ,help!
I have a sopc system include a DMA controller called "avalon_bus", which set up a channel to avalon bus.
My purpose is to realize memory-to-memory data transfer and sram is attached to avalon bus. But once the funcation "alt_dma_txchan_open("/dev/avalon_dma")" runs, the program freezes. I am not sure where the problem occures,the program or the sopc system. the code show below is from <<Nios II Software Developer's Handbook>>. Please give me some help ,thanks a lot! int main (int argc, char* argv[], char* envp[]) { int rc; alt_dma_txchan txchan; alt_dma_rxchan rxchan; void* tx_data = (void*) 0x901000; /* pointer to data to send */ void* rx_buffer = (void*) 0x902000; /* pointer to rx buffer */ /* Create the transmit channel */ if ((txchan = alt_dma_txchan_open("/dev/avalon_dma")) == NULL) { printf ("Failed to open transmit channel\n"); exit (1); } /* Create the receive channel */ if ((rxchan = alt_dma_rxchan_open("/dev/avalon_dma")) == NULL) { printf ("Failed to open receive channel\n"); exit (1); } /* Post the transmit request */ if ((rc = alt_dma_txchan_send (txchan, tx_data, 128, NULL, NULL)) < 0) { printf ("Failed to post transmit request, reason = %i\n", rc); exit (1); } ... .................................