Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

DMA interruption

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.
No RepliesBe the first to reply