mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
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.
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
69756f277e
commit
225d347306
@@ -614,7 +614,16 @@ int up_timer_gettime(struct timespec *ts)
|
|||||||
int pending;
|
int pending;
|
||||||
irqstate_t flags;
|
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
|
/* Temporarily disable the overflow counter. NOTE that we have to be
|
||||||
* careful here because stm32_tc_getpending() will reset the pending
|
* 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,
|
/* Set interval compare value. Rollover is fine,
|
||||||
* channel will trigger on the next period.
|
* channel will trigger on the next period.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_32BIT_TICKLESS
|
#ifdef HAVE_32BIT_TICKLESS
|
||||||
DEBUGASSERT(period <= UINT32_MAX);
|
DEBUGASSERT(period <= UINT32_MAX);
|
||||||
g_tickless.period = (uint32_t)(period + count);
|
g_tickless.period = (uint32_t)(period + count);
|
||||||
|
|||||||
Reference in New Issue
Block a user