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++

Basic NIOS II interrupt.

Altera_Forum
Honored Contributor II
2,493 Views

I am getting the warning.  

 

 

--- Quote Start ---  

warning: implicit declaration of function 'alt_irq_register' 

--- Quote End ---  

 

 

Call in code is  

 

alt_irq_register(CODEC_SIMPLE_MASTER_2_0_IRQ_INTERRUPT_CONTROLLER_ID, (void *) NULL, codec_isr); 

 

I have also included <alt_irq.h> 

 

Can I ignore this warning?
0 Kudos
14 Replies
Altera_Forum
Honored Contributor II
1,046 Views

Have you implemented the internal irq controller or the VIC? 

If the latter, you must use the enhanced interrupt APIs: alt_ic_isr_register
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

 

--- Quote Start ---  

Have you implemented the internal irq controller or the VIC? 

If the latter, you must use the enhanced interrupt APIs: alt_ic_isr_register 

--- Quote End ---  

 

 

The internal interrupt controller.
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

Try # include "alt_legacy_irq.h" 

although this should be automatically included by alt_irq.h whenever the enhanced irq APIs are not enabled, namely if you don't use the external irq controller.
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

I am now getting 

 

warning: alt_legacy_irq.h: No such file or directory
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

 

--- Quote Start ---  

I am now getting 

 

warning: alt_legacy_irq.h: No such file or directory 

--- Quote End ---  

 

 

Ok....  

 

I included  

 

# include "priv/alt_legacy_irq.h" 

 

 

Now I get warning.....  

 

"passing argument 3 of 'alt_irq_register' from incompatible pointer type" 

 

 

Prototype for alt_irq_resgister in priv/alt_legacy_irq.h is 

 

extern int alt_irq_register (alt_u32 id,  

void* context,  

alt_isr_func handler); 

 

 

As I said my file calls 

 

alt_irq_register(CODEC_SIMPLE_MASTER_2_0_IRQ_INTERRUPT_CONTROLLER_ID, NULL, codec_isr); 

 

codec_isr is handler and is defined as 

 

static void codec_isr(void * context, alt_u32 id) 

.... 

..... 

...... 

}
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

Search the headers for the definition of alt_isr_func, probably doesn't quite match the function you supplied. 

Or my 'trick', add -E to the gcc command file and then open the .o file in a text editor and search through the pre-processed output. 

(Might be difficult from the IDE)
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

 

--- Quote Start ---  

Search the headers for the definition of alt_isr_func, probably doesn't quite match the function you supplied. 

Or my 'trick', add -E to the gcc command file and then open the .o file in a text editor and search through the pre-processed output. 

(Might be difficult from the IDE) 

--- Quote End ---  

 

 

From alt_irq.h all I can see is this. 

 

# ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT 

typedef void (*alt_isr_func)(void* isr_context); 

# else 

typedef void (*alt_isr_func)(void* isr_context, alt_u32 id); 

# endif 

 

Hmmm...
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

I'd try removing the u32 parameter and see if the warning goes away. 

If that is what the compiler is complaining about you need to sort out whether you should be using the enhanced interrupt api or not. 

Eveything will need to be consistent.
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

I included the line  

 

# undef ALT_ENHANCED_INTERRUPT_API_PRESENT 

 

In my main c file.  

 

The warning went away.  

 

I am rusty on this. Probably a better way of doing this.
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

The warning might have gone away, but that doesn't mean the actual call (to your ISR) will provide the extra parameter. 

I'd guess there is some BSP config option that sets it.
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

I can't see any BSP config however this is where I am at.  

 

I got the thing to build again using  

 

ALT_ENHANCED_INTERRUPT_API_PRESENT 

 

And using Enhanced Interrupts.  

 

I set up the interrupt in code by calling 

 

alt_ic_isr_register (CODEC_SIMPLE_MASTER_2_0_IRQ_INTERRUPT_CONTROLLER_ID, CODEC_SIMPLE_MASTER_2_0_IRQ, codec_isr, NULL, 0x0); 

 

My interrupt service routine is.  

 

 

static void codec_isr (void *context) 

 

 

This builds fine however the processor seems to hang when the interrupt is asserted.  

 

 

I did an enhanced interrupt based PIO based project and I can get into the interrupt here (to check if my setup was correct).  

 

 

So my custom peripheral's interrupt seems to hang the NIOS II processor. (The main loop is no longer running).  

 

Weird.  

 

Any ideas?
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

Found the problem.  

 

Me and my software bugs.  

 

I was setting up the DMA with a wrong address and probably overwriting a critical area of memory.  

 

 

Ooops.... :oops:
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

only you include# undef ALT_ENHANCED_INTERRUPT_API_PRESENT and dissapear the warning??? 

 

I've incluided this line, but the warning continues, and the interrupt doens't work 

 

Help me in this problem
0 Kudos
Altera_Forum
Honored Contributor II
1,046 Views

By default ALT_ENHANCED_INTERRUPT_API_PRESENT is defined. Therefore you need to set up with the interrupt prototypes for these given in the appropriate header file.

0 Kudos
Reply