Forum Discussion

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

questions for interrupt register function:alt_irq_register

hi everyone:

the interrupt register function in nios:

int alt_ic_isr_register (alt_u32 ic_id,

alt_u32 irq,

alt_isr_func isr,

void* isr_context,

void* flags)

isr_context is the input argument to isr . isr_context points to a data structure

associated with the device driver instance.

i do not understand what is "isr_context " , so i find some codes from internet:

some people write base_addr to the void* isr_context;

some people write NULLto the void* isr_context;

and nois examples write others.

in my project, i write base_addr, and the interrupt works

what is the meaning of isr_context ?

is it right to write base_addr to it?

thanks,qd0090.

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Interrupt function looks something like:

    
    void ISR_Handler (void* isr_context){
    *** code here ***
    }
    

    isr_context is a pointer which gets passed to the interrupt function, you can use it as a data storage.