 |
| Author |
Message |
|
|
Posted: Jun 15, 2012 - 11:37 PM |
|

Joined: Oct 23, 2004
Posts: 9
|
|
I am new to the AVR32 (but not micros) and I am working with the INTC module.
Q. Why are there no #defines for the interrupt groups?
To explain ...
The ASF provides the following #defines for particular interrupts:
#define AVR32_TC_IRQ0 448
#define AVR32_TC_IRQ1 449
#define AVR32_TC_IRQ2 450
It also provides the following function for registering the handler:
irq_register_handler(func, int_num, int_lvl)
Where int_num is supposed to be the number above. However, this seems extremely misleading to me as the interrupt handler isn't registered for this number, but for the interrupt group (14 - int_num/32). The irq_register_handler function shifts the number right 5 on entry to get rid of the specifics. It would seem to make much more sense to make a function that takes the group number (which isn't defined anywhere).
Additionally, the ISR is going to need to read the IRR for the group to see which interrupt number is actually interrupting - like this:
uint32_t int_req = AVR32_INTC.irr[14];
It would make sense that this 14 is the same #define that doesn't exist above.
Am I missing something about interrupt handling in the AVR32? |
|
|
| |
|
|
|
|
|
Posted: Jun 15, 2012 - 11:55 PM |
|

Joined: Nov 01, 2008
Posts: 191
|
|
The #defines you have listed above have the interrupt group and line encoded into a single number. For example:
group = AVR32_TC_IRQ2 / 32 = 450 / 32 = 14
line = AVR32_TC_IRQ2 % 32 = 450 % 32 = 2 |
_________________ Letting the smoke out since 1978
|
| |
|
|
|
|
|
|
|