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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

DMA interruption

Altera_Forum
Honored Contributor II
1,052 Views

Hello, 

 

I would like to make an interruption of the DMA via NIOS II. I took the example from the NIOS II software Developper Handbook and added the three alt_irq commands in order to initialise, register and enable my interruption. My interruption is number 6 thus I wrote :  

 

 

 

alt_u8 buffer[1024]; 

alt_dma_rxchan rx; 

/* flag used to indicate the transaction is complete */ 

volatile int dma_complete = 0;  

 

/* function that is called when the transaction completes */ 

void dma_done (void* handle, void* data) 

dma_complete = 1; 

 

 

int main(void) 

alt_irq_init (VGA_BASE); // avec dans system.h :# define VGA_BASE 0x00008200 

alt_irq_register (6,NULL, dma_done); 

alt_irq_enable (6); 

 

 

/* Obtain a handle for the device */ 

if ((rx = alt_dma_rxchan_open ("/dev/vga")) == NULL) 

printf ("Error: failed to open device\n"); 

exit (1); 

else 

/* Post the receive request */ 

if (alt_dma_rxchan_prepare (rx, buffer, 1024, dma_done, NULL) < 0) 

printf ("Error: failed to post receive request\n"); 

exit (1); 

/* Wait for the transaction to complete */ 

while (!dma_complete); 

printf ("Transaction complete\n"); 

alt_dma_rxchan_close (rx); 

return 0; 

 

 

 

Then, I have the following message on the console : "Error: failed to open device". 

 

I am a newbie with NIOS II so maybe my mistake is huge. Could someone help me ? 

Thank you very much, I am lost.
0 Kudos
0 Replies
Reply