Forum Discussion
Altera_Forum
Honored Contributor
13 years agoDelayed Interrupt
Nios-II response to Continuous interrupt is delayed (sometime), due to this i am loosing my data what precaution should i take to handle this issue please have a look on print screen of m...
Altera_Forum
Honored Contributor
13 years agoIs below code is correct for using Enhanced Interrupt ....as while compiling there is no error but during porting this code to nios downloading process stuck at 80% and nothing will happen afterword
i found through altera literature that using enhance interrupt we may significantly improve our interrupt response time //-------------------------------------------
//#ifdef LOAD_DATA_BASE
# ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
static void handle_load_data_interrupts(void* context)# else
static void handle_load_data_interrupts(void* context, alt_u32 id)# endif
{
/* 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;
// IOWR_ALTERA_AVALON_PIO_IRQ_MASK(LOAD_DATA_BASE, 0xf );
/* Store the value in the Button's edge capture register in *context. */
*edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE);
/* Reset the Button's edge capture register. */
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE, 0XF);
/* Read the PIO to delay ISR exit. This is done to prevent a spurious interrupt in systems with high processor -> pio latency and fast interrupts. */
IORD_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE);
}
/* Initialize the load_pio. */
static void init_load_pio()
{
/* Recast the edge_capture pointer to match the alt_irq_register() function prototype. */
void* edge_capture_ptr = (void*) &edge_capture;
/* Enable all 4 button interrupts. */
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(LOAD_DATA_BASE, 0xf);
/* Reset the edge capture register. */
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(LOAD_DATA_BASE, 0xF);
/* Register the interrupt handler. */
# ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT
alt_ic_isr_register(VIC_IRQ_INTERRUPT_CONTROLLER_ID,
VIC_IRQ,
handle_load_data_interrupts,
edge_capture_ptr,0x0);
# else
alt_irq_register( VIC_IRQ,
edge_capture_ptr,
handle_load_data_interrupts);
# endif
}
//#endif /* LOAD_DATA_BASE */
Main()
{
printf("\nInitillize the Enhanced Interrupt..\n");
init_load_pio();
}