Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12590 Discussions

how to pass a pointer or array name to the interrupt function?

Altera_Forum
Honored Contributor II
1,488 Views

hi 

i register a interrupt in nios, and it works well 

alt_ic_isr_register (NIOS_FT245_INTERFACE_0_IRQ_INTERRUPT_CONTROLLER_ID, 

NIOS_FT245_INTERFACE_0_IRQ, 

ft245_interrupt, 

NULL, 

NULL); 

 

i want to pass a pointer or array name to the interrupt function ft245_interrupt, how can i do it? 

 

 

thanks!
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
756 Views

The documentation for the HAL functions are in altera_hal_api.pdf. Whatever you give to the context arg will be passed to your isr function. In your code this is the first NULL.

0 Kudos
Altera_Forum
Honored Contributor II
756 Views

hi, i tried and it works! 

this is the code: 

void ft245_interrupt(alt_u32 precision_data[500]) 

..... 

 

int main() 

alt_u32 i=0; 

alt_u32 precision_data_1[500]={0}; 

i=alt_irq_enabled(); 

alt_ic_isr_register (NIOS_FT245_INTERFACE_0_IRQ_INTERRUPT_CONTROLLER_ID, 

NIOS_FT245_INTERFACE_0_IRQ, 

ft245_interrupt, 

precision_data_1, 

NULL); 

 

 

 

but the eclipse give me a warning 

Description Resource Path Location Type 

passing argument 3 of 'alt_ic_isr_register' from incompatible pointer type hello_world.c /project3 line 99 C/C++ Problem
0 Kudos
Altera_Forum
Honored Contributor II
756 Views

The warning is because the type of your ISR function argument doesn't match what alt_ic_isr_register expects which is (void *). Try using (void *)precision_data_1 for that argument. 

 

Edit: wrong argument.
0 Kudos
Reply