Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
19692 Discussions

TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID, TIMER_0_IRQ could not be resolved

Rodo
New Contributor I
162 Views

Hi all,

I'm playing with an old BeMicro dev kit (MAX10). I got it to work and blinking an LED just fine. Now I added a timer and some old code I had for the ISR but at build time (NIOS II eclipse) I keep getting these two errors about unresolved TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID and TIMER_0_IRQ. This to me means it can not find them. But they're listed at the end of the system.h file in the BSP project. BTW I'm not doing anything with the IRQ yet.  How do I get rid of the errors? Any help is appreciated. Thanks.

 

Here is what I have for the c file:


#include "system.h"
#include "alt_types.h"
#include "io.h"

#include <unistd.h> //for usleep

#include "sys/alt_irq.h" //for irq
#include "altera_avalon_timer_regs.h" //for timer

//=======================================
//====== Function prototypes  ===========
//=======================================
static void timer_isr();

//========================================
//========== main() Function =============
//========================================
int main()
{
//register the timer irq
alt_ic_isr_register(TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID, TIMER_0_IRQ, timer_isr, 0, 0);

IOWR(LEDS_BASE, LED_OFF, 0xff); //all LEDs off

//This loop just blinks an LED on the board at 1s interval
while(1)
{
IOWR(LEDS_BASE,LED_ON,0x01); //LED D1 on
usleep(1000000); //delay 1s
IOWR(LEDS_BASE,LED_OFF,0x01); //LED D1 off
usleep(1000000); //delay 1s
}
return 0;
}
//=======================================
//==== Interrupt Service Routine ========
//=======================================
//void timer_isr(void *context)
void timer_isr()
{
/*
Do something here...eventually
*/
IOWR_ALTERA_AVALON_TIMER_STATUS(TIMER_0_BASE, 0); // clear TimeOut flag
}

 

Here is the system.h file (I'm just showing the timer_0 configuration). Bold text just to highlight the definitions:

 


/*
* timer_0 configuration
*
*/

#define ALT_MODULE_CLASS_timer_0 altera_avalon_timer
#define TIMER_0_ALWAYS_RUN 0
#define TIMER_0_BASE 0x51000
#define TIMER_0_COUNTER_SIZE 32
#define TIMER_0_FIXED_PERIOD 0
#define TIMER_0_FREQ 50000000
#define TIMER_0_IRQ 0
#define TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID 0
#define TIMER_0_LOAD_VALUE 49
#define TIMER_0_MULT 1.0E-6
#define TIMER_0_NAME "/dev/timer_0"
#define TIMER_0_PERIOD 1
#define TIMER_0_PERIOD_UNITS "us"
#define TIMER_0_RESET_OUTPUT 0
#define TIMER_0_SNAPSHOT 0
#define TIMER_0_SPAN 32
#define TIMER_0_TICKS_PER_SEC 1000000
#define TIMER_0_TIMEOUT_PULSE_OUTPUT 0
#define TIMER_0_TYPE "altera_avalon_timer"

 

0 Kudos
2 Replies
Rodo
New Contributor I
145 Views

I didn't see a way to erase this post. I erase the workspace and created it in another folder.  Then imported the project into new workspace, clean all, recompile and all errors went away. Weird.

EricMunYew_C_Intel
Moderator
128 Views

I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.


Reply