-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix LowPowerTickerWrapper operation when suspended #8279
Fix LowPowerTickerWrapper operation when suspended #8279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. but still need @c1728p9 to review and confirm.
@@ -32,15 +32,7 @@ void LowPowerTickerWrapper::irq_handler(ticker_irq_handler_type handler) | |||
{ | |||
core_util_critical_section_enter(); | |||
|
|||
if (_suspended) { | |||
if (handler) { | |||
handler(&data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when suspended interrupts need to be passed through so higher layers can run tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note the interrupts are passed as before. I moved _suspended
to the next if
statement to have the flags cleared (i.e. _pending_match
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I didn't realize the interrupt was still getting through.
As there are other 2 dependencies on this fix, please review the latest review |
@c1728p9, could you take another look please? All this patch does, is to actually disable the use of us ticker when the wrapper is suspended, as the docs say: mbed-os/hal/mbed_lp_ticker_wrapper.h Lines 52 to 57 in 19190d6
|
hal/LowPowerTickerWrapper.cpp
Outdated
@@ -271,13 +263,15 @@ void LowPowerTickerWrapper::_schedule_match(timestamp_t current) | |||
return; | |||
} | |||
|
|||
if (!too_close) { | |||
if (!too_close || _suspended) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than checking for _suspended
here I recommend updating LowPowerTickerWrapper::read
and LowPowerTickerWrapper::set_interrupt
to check for _suspended
can call straight into the real interface. That way it is clear in the code that when this is suspended everything is passed through directly.
If you make this change you'll also want to add a delay in LowPowerTickerWrapper::resume
similar to the one in LowPowerTickerWrapper::suspend
to ensure any ongoing hardware writes have taken effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Update the LowPowerTickerWrapper class logic to stop using its internal Timeout object for scheduling LP ticker interrupts after the wrapper has been suspended. Fixes ARMmbed#8278
d2ba2ac
to
effabc5
Compare
Rebased and added a warning about undefined behavior. @c1728p9 , I updated the code as you suggested. Is that ok? |
/morph build |
Build : SUCCESSBuild number : 3467 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 3090 |
Test : SUCCESSBuild number : 3258 |
Description
Update the
LowPowerTickerWrapper
class logic to stop using the internalTimeout
object for scheduling LP ticker interrupts after the wrapper hasbeen suspended.
Fixes #8278
Pull request type
CC @c1728p9 @mprse @jamesbeyond