- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
int context=0;
volatile int edge_capture;
int main()
{
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE,0xF);
alt_irq_register(PIO_0_IRQ,(void*)&edge_capture, handle_pio);
while(5);
return 0;
}
static void handle_pio(void* context, alt_u32 id){
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE, 0);
/* Cast context to edge_capture's type. It is important that this be
* declared volatile to avoid unwanted compiler optimization.
*/
volatile int* edge_capture_ptr = (volatile int*) context;
/* Store the value in the Button's edge capture register in *context. */
*edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE);
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(PIO_0_BASE,0);
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_0_BASE,0xF);
}
Why the interrupt never happens? It's a simple PIO (1bit)that i set to 1 in my verilog code (configured to generate a rising edge irq on my SOPC).. Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you not only need to enable interrupts on the PIO core, but on the NIOS side as well.
you can enable and disable interrupts using alt_irq_enable and alt_irq_disable. try adding this after you register your ISR. alt_irq_enable(PIO_0_IRQ);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot!! It works
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page