drivers: timer: stm32 lptim stops counting on timeout FOREVER
When setting a timeout K_TICKS_FOREVER,the lptimer clock is stopped (no reset of the lptim). Then is the lptim possibly re-started when another source asks for. The lptim clock must then be re-started and continue counting. This is the case when wakeup from sleep mode, for example. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
b9dcc9b283
commit
0856e99155
1 changed files with 6 additions and 2 deletions
|
@ -178,12 +178,16 @@ void z_clock_set_timeout(int32_t ticks, bool idle)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticks == K_TICKS_FOREVER) {
|
if (ticks == K_TICKS_FOREVER) {
|
||||||
/* disable LPTIM */
|
/* disable LPTIM clock to avoid counting */
|
||||||
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPTIM1);
|
|
||||||
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_LPTIM1);
|
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_LPTIM1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if LPTIM clock was previously stopped, it must now be restored */
|
||||||
|
if (!LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_LPTIM1)) {
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPTIM1);
|
||||||
|
}
|
||||||
|
|
||||||
/* passing ticks==1 means "announce the next tick",
|
/* passing ticks==1 means "announce the next tick",
|
||||||
* ticks value of zero (or even negative) is legal and
|
* ticks value of zero (or even negative) is legal and
|
||||||
* treated identically: it simply indicates the kernel would like the
|
* treated identically: it simply indicates the kernel would like the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue