[En-Nut-Discussion] Timer 2 overflow interrupt
Harald Kipp
harald.kipp at egnite.de
Thu Mar 13 17:26:15 CET 2003
Tom,
First, do not use NutRegisterInterrupt() any more, it's
deprecated. Version 3 introduces a new layout for interrupt
handling.
Here's the background: Nut/OS prior version 3 included all
interrupt routines in a single module named irgreg.c. This
has two drawbacks:
1. All IRQ handlers are located inside Nut/OS, making it
impossible to write your own generic handler.
2. At least after the upgrade from ATmega102 to ATmega128
this module became quite big.
With Nut/OS 3.0, only registered interrupt handlers are
included. You are now free to define your own GCC SIGNAL()
routine or ICC interrupt_handler pragma. Specially for
fast running timers this will reduce the call overhead.
For compatibility reasons the old irqreg.c is still available,
but that doesn't work as expected. If an application calls the
old NutRegisterInterrupt(), the whole module will be included
and creates multiple definition conflicts.
For whatever reasons the name of some overflow routines had been
changed, but not consequently. The definitions for the variables
holding timer 1 and 2 handlers differ. While sig_TIMER2_OVF
has been specified in ivect10.c, irqreg.h defines sig_OVERFLOW2,
which actually doesn't exist.
To temporarily fix this, you can add
extern IRQ_HANDLER sig_TIMER2_OVF;
to your application and call
NutRegisterIrqHandler(&sig_TIMER2_OVF, regulator, 0);
It is planned to create some SNMP performance counters in the
future, which will include monitoring interrupts. But only
registered interrupts will be monitored. If you want fast
interrupt responses, better use SIGNAL().
Hope this explained the problem and helps to fix it.
Harald
More information about the En-Nut-Discussion
mailing list