You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/06/17 14:05:47 UTC
[nuttx] branch master updated: stm32 tickless: stop assertion when calling up_timer_gettime before initialised
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 225d347306 stm32 tickless: stop assertion when calling up_timer_gettime before initialised
225d347306 is described below
commit 225d347306a028620f941772d9d2ced96bf22854
Author: Richard Tucker <ri...@gmail.com>
AuthorDate: Sat Jun 17 17:30:17 2023 +1000
stm32 tickless: stop assertion when calling up_timer_gettime before initialised
up_timer_gettime can be called before module is initialised when
CONFIG_SCHED_IRQMONITOR is enabled.
This fix aligns with stm32f7 implementation.
---
arch/arm/src/stm32/stm32_tickless.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/src/stm32/stm32_tickless.c b/arch/arm/src/stm32/stm32_tickless.c
index d3d87d35ed..f4220d71a9 100644
--- a/arch/arm/src/stm32/stm32_tickless.c
+++ b/arch/arm/src/stm32/stm32_tickless.c
@@ -614,7 +614,16 @@ int up_timer_gettime(struct timespec *ts)
int pending;
irqstate_t flags;
- DEBUGASSERT(g_tickless.tch && ts);
+ DEBUGASSERT(ts);
+
+ /* Timer not initialized yet, return zero */
+
+ if (g_tickless.tch == 0)
+ {
+ ts->tv_nsec = 0;
+ ts->tv_sec = 0;
+ return OK;
+ }
/* Temporarily disable the overflow counter. NOTE that we have to be
* careful here because stm32_tc_getpending() will reset the pending
@@ -938,6 +947,7 @@ int up_timer_start(const struct timespec *ts)
/* Set interval compare value. Rollover is fine,
* channel will trigger on the next period.
*/
+
#ifdef HAVE_32BIT_TICKLESS
DEBUGASSERT(period <= UINT32_MAX);
g_tickless.period = (uint32_t)(period + count);