Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12626 Discussions

Using HAL with DMA question

Altera_Forum
Honored Contributor II
970 Views

I am moving from NIOSI to NIOSII. I have an interrupt where if we are still DMA'ing, I just want to return from the interrupt. Before, I just had the following if statement to check the status of the DMA operation:  

 

 

if((na_USB_DMA->np_dmastatus & np_dmastatus_busy_mask) != 0) 

 

How do I do this using HAL? 

 

thanx
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
275 Views

http://www.altera.com/literature/hb/nios2/...pu_nii51006.pdf (http://www.altera.com/literature/hb/nios2/n2cpu_nii51006.pdf

 

On page 8 there is the description of the status register. I haven't checked but there should either be a function call to get the status or some value to read back to use. If not then you can just do the old school method and read it back and mask the other bits you don't care about. 

 

 

http://www.altera.com/literature/hb/nios2/...sw_nii52004.pdf (http://www.altera.com/literature/hb/nios2/n2sw_nii52004.pdf

 

Page 4-18 might be helpful as well. 

 

Happy reading (I know I'm lazy) 

Cheers
0 Kudos
Altera_Forum
Honored Contributor II
275 Views

First you should define a callback function such as dma_done. Assign a mark describing the end of dma transmission. Inputting dma_done as the forth parameter on invoking alt_dma_txchan_send/alt_dma_rxchan_prepare. 

 

I think handbook should describe such usage more clearly.
0 Kudos
Reply