Forum Discussion
Altera_Forum
Honored Contributor
20 years agohow call function on hardware exceptions
Hey expert guys!
How can i set my fuction for pointer of functions (alt_irq[i]) ? Again, i just need that my function execute when exeption are true. I have a hardware interruption connected on my system address 1. I need rewrite alt_irq_handler(void) function ? Thanks. This forum is very good!3 Replies
- Altera_Forum
Honored Contributor
if anyone interested. now i'm trying with alt_irq_register(...) function of HAL library.
- Altera_Forum
Honored Contributor
Look at the "Count Binary" example, shipped with the Nios II Kit installation.
- slacker - Altera_Forum
Honored Contributor
Hey guys now i have good news. Interruptions are working here!
I make a single exemple for help others guys: /********************************************************/ My context: I have 1 IRQ on my system. IRQ N.º 1. /********************************************************/# include <stdio.h># include <sys/alt_irq.h> /********************************************************/ int main(){ alt_u32 id = 1; volatile int button=1; printf("start:\n"); alt_irq_register( id, (void*)&button, my_isr ); while(1){ if(button!=0){ printf("exception runing...\n"); button=0; } else printf("main runing... \n"); } return 0; } /********************************************************/ static void my_isr(void* context, alt_u32 id) { int* button = (int *)context; if( id == 1 ) //test interruption id *button = 1; else *button = 0; } /********************************************************/ Slacker, thanks for exemple. Its help me too ^^