View previous topic :: View next topic |
Author |
Message |
future
Joined: 14 May 2004 Posts: 330
|
int_default and int_fast |
Posted: Fri Jul 02, 2004 1:50 pm |
|
|
I am at work now and doing some thinking on how to improve my project.
It uses two interrupts, one EXT FAST and one RTCC, on all RTCC interrupts
the scratch area and regs are saved/restored by the compiler.
As the RTCC routine does not do any math or table lookups, I am thinking about change it to an INT DEFAULT and do my own interrupt flag test/clear.
The questions are: Does anybody have done it? how does default and fast work together? |
|
|
Ttelmah Guest
|
Re: int_default and int_fast |
Posted: Fri Jul 02, 2004 3:02 pm |
|
|
future wrote: | I am at work now and doing some thinking on how to improve my project.
It uses two interrupts, one EXT FAST and one RTCC, on all RTCC interrupts
the scratch area and regs are saved/restored by the compiler.
As the RTCC routine does not do any math or table lookups, I am thinking about change it to an INT DEFAULT and do my own interrupt flag test/clear.
The questions are: Does anybody have done it? how does default and fast work together? |
The fast option, doesn't save the registers anyway. So the routine written, has to behave like the 'int default' handler in this regard allready.
This was discussed a while ago, with a general consensus, that it would be nicer, is CCS, offered the option of having the save or not, with a command like the int default for the normal handler. At present though, 'fast', implies 'int default'.
Best Wishes |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Fri Jul 02, 2004 3:19 pm |
|
|
In both handlers I have just one interrupt source, EXT and RTCC.
The FAST interrupt handler does nothing but run the interrupt code.
This way I can have a FAST interrupt handler that just runs the code and a DEFAULT that just runs de code.
int default() {
// does not need to test flags because just one source exists
// clear rtcc flag
// do some things
}
int fast() {
// does not need to test flags because just one source exists
// clear EXT flag
// do some things
}
I dont know if I made myself clear but what I am trying to achieve is to take out all register savings and flag tests from the normal interrupt dispatcher and still have a fast interrupt. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Jul 02, 2004 5:29 pm |
|
|
The idea sounds solid. Why don't you write a small test program and study the list file. You have been playing with interrupts for a while now, so this should be easy for you to check.
You are manually clearing the interrupt in the FAST routine, you don't have to do this as the compiler will do it for you on exit of the interrupt. This is unexpected and undocumented behaviour as you have to do all other housekeeping yourself. If you insist on manually clearing the interrupt you can add the NOCLEAR option. For the FAST interrupt this option was not working in v3.187 but I was promised it would be added in the next release (3.188?).
In the DEFAULT routine you need to clear the interrupt yourself.
In your example the syntax for the two interrupt handlers is incorrect. A slip of the finger?
Code: | #int_default
void default() {
// does not need to test flags because just one source exists
// clear rtcc flag
// do some things
}
#int_ext FAST
void fast() {
// does not need to test flags because just one source exists
// do some things
// compiler will clear EXT flag
} |
|
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Fri Jul 02, 2004 5:46 pm |
|
|
I was just trying to show my ideas.
English is not my main language and sometimes it is difficult to express myself.
I was at work doing nothing and this idea came, I will try it soon. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Jul 02, 2004 6:14 pm |
|
|
Oops: It should have been #int_global instead of #int_default. The #int_default is used to catch unhandled interrupts so would still use the CCS interrupt dispatcher. |
|
|
|