Den 07-03-2011 13:49, Marco van de Voort skrev:
In our previous episode, Jeppe Johansen said:
A better idea, I think, is to use the old interrupt procedure directive.
For some embedded platforms simply allow also specifying a interrupt
vector/index after the interrupt keyword. Ex:
procedure USARTRxInterrupt; interrupt 10;
begin
// Handler code
end;
I do know how GCC does it with the embedded target (dspic) that I use at
work:
the name of the interrupt routine is hardwired to the table entry. This
allows to get rid of the number constants (which are maintained centrally)
all together.
It also allows to keep code portable between different versions that might
have a different interrupt table layout (since the CPU dependant mapping
from names to numbers would be different).
Wouldn't this be the same as having numbered constants? That is allowed
in the implementation
You could have somthing like this, and control it with the
controllertype unit
unit stm32f103re;
interface
const
UsartRXInt = 10;
implementation
end.
...
unit stm32f103ct;
interface
const
UsartRXInt = 32;
implementation
end.
...
program myprogram;
procedure MyRXInterrupt; interrupt UsartRXInt;
begin
end;
begin
end.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel