Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16886 Discussions

Why I can not find the alt_irq_enable function in HAL/src(Eclipse for NiosII))

Altera_Forum
Honored Contributor II
2,881 Views

Dear all 

 

I build a SOPC system to realize the UART port communicate with PC. I launch Eclipse NiosII plateform after building SOPC hardware. I assign the UART port the IRQ is 2. I have to call the alt_irq_enable at initializing the UART port. But the C builder inform me undefined reference to `alt_irq_enable'. What happens in my project? Hope get help!
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
1,627 Views

Add following line of code please, 

# include "sys/alt_irq.h"
0 Kudos
Altera_Forum
Honored Contributor II
1,627 Views

 

--- Quote Start ---  

Add following line of code please, 

# include "sys/alt_irq.h" 

--- Quote End ---  

 

 

Hi, waiyung. The line has been added before i post the topic. Are there other cause can lead this problem?
0 Kudos
Altera_Forum
Honored Contributor II
1,627 Views

Hi  

Pilleman said that in other thread: 

 

 

--- Quote Start ---  

My assumption is that you are using the ENHANCED Interrupt API which doesn't implement alt_irq_interruptible()/alt_irq_non_interruptible() anymore. 

 

The only way I know (means not that there is not an other way) how to use the both functions, is to manually change ALT_ENHANCED_INTERRUPT_API_PRESENT in system.h to ALT_LEGACY_INTERRUPT_API_PRESENT. Every time you regenerate your BSP or syslib you have to change it again! 

But that's just a workaround. 

 

I had the same problems and then included the VIC as EIC in my design. You can use the VIC with ENHANCED API. But much better, the VIC can handle the interruptible stuff without changing your code. That means your ISRs are interruptible without a call to alt_irq_interruptible().  

 

Disadvantage: Until the momen, I don't know how set the option that an IRQ is not interruptible. 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
1,627 Views

Thank Aprado! you give me a lot of help!

0 Kudos
Altera_Forum
Honored Contributor II
1,627 Views

Yea, I ran into the same issue using the older style irq register stuff. I have a block of code in QSYS that feeds out an interrupt to the NIOS. Below is an example of old vs enhanced IRQ for you all to see. All of the variables in UPPERCASE were taken from the system.h file. You can also look at a sample in your c:\altera folder in the NIOS directory. look up count_binary. 

 

C:\altera\13.0sp1\nios2eds\examples\software\count_binary 

 

 

 

OLD IRQ API EXAMPLE 

///////// 

static void isr_PUSH_BUTTONS(void *context) 

printf("PB IRQ hit "); 

 

 

main 

alt_irq_register(PUSH_BUTTONS_IRQ, 0 , isr_PUSH_BUTTONS); 

///////// 

 

ENHANCED IRQ API 

///////// 

static void isr_PUSH_BUTTONS(void *context) 

printf("PB IRQ hit "); 

 

 

main 

alt_ic_isr_register(PUSH_BUTTONS_IRQ_INTERRUPT_CONTROLLER_ID, PUSH_BUTTONS_IRQ, isr_PUSH_BUTTONS, 0, 0); 

alt_ic_irq_enable(PUSH_BUTTONS_IRQ_INTERRUPT_CONTROLLER_ID, PUSH_BUTTONS_IRQ); 

while(1){} 

/////////
0 Kudos
Reply