Forum Discussion
Altera_Forum
Honored Contributor
21 years agoDMA transfer length problem
http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif There is a problem in transferring data from SDRAM to my device ( avalon slave device ) . I use the DMA component p...
Altera_Forum
Honored Contributor
21 years agoI still can not solve the problem.
I read the DMA control register and the length register . The results of the two register are normal. This is my soft program : int main(void) { printf("Hello from Nios II!\n"); //perform the DMA test unsigned int* data_source ; data_source = (unsigned int*) alt_uncached_malloc(258624); //fill the source memory int m; for(m=0 ; m < 258624 ; m++ ) { *(data_source+m)=0x00111111; } //test the DMA alt_dma_txchan tx; tx = alt_dma_txchan_open("/dev/dma_0"); if(tx== NULL) { printf("\n DMA Test: DMA ERROR "); } // perform dma transfer void* tx_data =(void*) data_source ; int rc; alt_dma_txchan_ioctl(tx,ALT_DMA_RX_STREAM_ON,(void *)(USER_DEFINED_ME_BASE)); if((rc=alt_dma_txchan_send(tx,tx_data, (1796*80*4) ,tx_done, NULL ))<0) { printf("\n Failed to post transmit request ,reason %i",rc); exit(1); } printf("\n Wait for DMA Transfer ... "); while(!tx_complete){} printf("\n DMA Transaction complete ! "); return 0; }