Forum Discussion
Altera_Forum
Honored Contributor
21 years agoalt_dma_txchan_send status
I am getting an error from alt_dma_txchan_send. The status returned is -22. Below is the code. I lifted this code from this forum http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile...
Altera_Forum
Honored Contributor
21 years agoThanx. Truth is, I lifted this code from this forum http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
This line calls the dma function: nr_dma_copy_range_to_1_nli("/dev/USB_DMA",(void *)txdata,(void *)usbdata, ByteCount, ALT_DMA_SET_MODE_8 ); Following is the whole routine it gets stuck in the while(!transmitdone) logic like the callback is never called...... /* ************************************************************************* */ /* The following routines is for range-to-1 processing. */ /* ************************************************************************* */ void nr_dma_copy_range_to_1_nli(const char* dma_name, void* start_addr, //Here,start_addr is the "range" void* desti_addr, //and desti_addr is the "1" alt_32 transfer_count, alt_32 transfer_mode) { alt_32 flag; alt_dma_txchan txchan; if((txchan=alt_dma_txchan_open(dma_name))==NULL) { printf("\n Failed to open transmit channel(range-to-1)!\n"); //exit(1); } alt_dma_txchan_ioctl(txchan,transfer_mode,NULL); alt_dma_txchan_ioctl(txchan,ALT_DMA_TX_STREAM_ON,start_addr); if((flag=alt_dma_txchan_send(txchan,desti_addr,transfer_count,transmit_done,NULL ))<0) { printf("\n Failed to post transmit request(range-to-1)!\n"); //exit(1); } while(!transmitdone) usleep(20); transmitdone=0; alt_dma_txchan_ioctl(txchan,ALT_DMA_RX_STREAM_OFF,NULL); //alt_dma_txchan_close(txchan); }