- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.gif
alt_dma_txchan_open is successful, but the call to alt_dma_txchan_send returns a -22. Any help is appreciated. thanx 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_RX_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); transmitdone=0; alt_dma_txchan_ioctl(txchan,ALT_DMA_RX_STREAM_OFF,NULL); //alt_dma_txchan_close(txchan); }Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you post your design of DMA here? Your code is good, but which transferring mode you are using here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanx. 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); }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps you should use
alt_dma_txchan_ioctl(txchan,ALT_DMA_RX_STREAM_ON,start_addr); instead of alt_dma_txchan_ioctl(txchan,ALT_DMA_TX_STREAM_ON,start_addr);
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page