Will this allow for the following syntax:
ISR(VectorName, ISR_NOBLOCK)
{
// Code goes here
}
Wouldn't this set both the 'interrupt' and 'signal' attributes at the
same time?
Yes indeed, very astute. the reason for declaring the ISR macro with the
ISR_NOBLOCK (signal) is for backwards compatibility. If no second argument,
the SIGNAL attribute is applied.
I have discovered in testing that having the signal as well as another
ISR-related attribute specified at the same time works correctly and gives
the expected output. If ISR_NOBLOCK is specified, then the resultant ISR
contains a SEI as expected, if ISR_NAKED is specified, then the resulting
code lacks a prologue or epilogue. Since it works fine, I don't think it is
a problem. As a bonus, the SIGNAL attribute forces GCC to spell-check the
vector name.
The only real issue with my macros as I can see it is a lack of a way to
create an ISR_EMPTY equivalent. The only way I can think of doing this would
be to create a "ISR_return()" macro ( #define ISR_return() __asm__
__volatile__ ("reti" ::); ) and then in the docs tell the user the correct
way of doing so would be:
ISR(VectorName, ISR_NAKED)
{
ISR_return();
}
Subject to individual's coding style, of course. I actually see this as a
plus; the "ISR_return()" macro is in a similar style to the sei() and cli()
macros, and so would be useful to those creating their own (non-empty)
ISR_NAKED routines also. Although If the current convention was to be
adhered to, the macro name would be "reti();", I suppose.
Thoughts?
- Dean
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev