Resumed program execution after sleep
Posted: Sun Jan 26, 2014 12:27 pm
AFAIK, if a processor is put to sleep before the occurrence of the next interrupt, it should (commonly?) resume the program execution from where it’s left off (i.e. from the instruction that immediately follows the "put to sleep" instruction) after the end of the ISR (executed when it next "wakes-up" from sleep). So, if a function call like the following was used to put the system to sleep…
So, my question is: Would the processor actually need to do this “extra” step or not? I guess that if we use any sort of compiler optimisation, this might be avoided, but if we don’t, I think this extra (probably tiny) overhead exists.
Any ideas will be greatly appreciated.
where Go_to_Sleep() is defined as:…
Go_to_Sleep();
…
… the processor should actually return (exit) from the Go_to_Sleep() function before continuing with the execution of anything else (although there isn’t anything following the asm volatile("HLT"); code).void Go_to_Sleep(void)
{
asm volatile("HLT");
}
So, my question is: Would the processor actually need to do this “extra” step or not? I guess that if we use any sort of compiler optimisation, this might be avoided, but if we don’t, I think this extra (probably tiny) overhead exists.
Any ideas will be greatly appreciated.