Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

Enhance Interrupt initiation

Honored Contributor II

Hello Friend's, 


I am trying to use following code for using enhance interrupt initiation but a am not able to initialize Enhance Interrupt, every time i run the application it return -1, mean interrupt not enable. 

i have add Vector Interrupt Controller with NIOS-II using sopc builder and do the necessary connection and generate the sopc builder. 

please comment on code , where i am wrong 


*attached is the output of code  


# include <stdio.h># include "sys/alt_irq.h"# include "system.h"# include "altera_avalon_pio_regs.h" volatile int edge_capture; void handle_load_data_interrupts(void* context, alt_u32 id) { volatile int* edge_capture_ptr = (volatile int*) context; IOWR_ALTERA_AVALON_PIO_IRQ_MASK(LOAD_DATA_BASE, 0x1 ); *edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE); IOWR_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE, 0x1); IORD_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE); } void init_load_pio() { void* edge_capture_ptr = (void*) &edge_capture; IOWR_ALTERA_AVALON_PIO_IRQ_MASK(LOAD_DATA_BASE, 0x1); IOWR_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE, 0x1); alt_ic_isr_register(LOAD_DATA_IRQ_INTERRUPT_CONTROLLER_ID, LOAD_DATA_IRQ, handle_load_data_interrupts, edge_capture_ptr, 0x0); } int main() { int rc; printf("\n\tInitillize the Enhanced Interrupt.."); init_load_pio(); rc = alt_ic_irq_enable(VIC_INTERRUPT_CONTROLLER_ID,VIC_IRQ); if(rc<0) printf("\n\tEnhance Interrupt not enabled, Return value = %d",rc); else printf("\n\tEnhnace interrupt enabled, Return value = %d",rc); return 0; }  


my Victor Interrupt Controller Configuration is as follow 


* VIC configuration 



# define ALT_MODULE_CLASS_VIC altera_vic# define VIC_BASE 0x11041000# define VIC_DAISY_CHAIN_ENABLE 0# define VIC_INTERRUPT_CONTROLLER_ID 0# define VIC_IRQ -1# define VIC_IRQ_INTERRUPT_CONTROLLER_ID -1# define VIC_NAME "/dev/VIC"# define VIC_NUMBER_OF_INT_PORTS 8# define VIC_RIL_WIDTH 4# define VIC_SPAN 1024# define VIC_TYPE "altera_vic"
0 Kudos
1 Reply
Honored Contributor II

just adding desire PORT base address name in place of VIC_IRQ , it start working 


rc = alt_ic_irq_enable(VIC_INTERRUPT_CONTROLLER_ID,VIC_IRQ); 

rc = alt_ic_irq_enable(VIC_INTERRUPT_CONTROLLER_ID,add desire port base name);