Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
742 Views

Enhance Interrupt initiation

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
Highlighted
Valued Contributor III
6 Views

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);
0 Kudos