arch/arm/src/stm32/stm32_tickless.c and arch/arm/src/stm32/stm32_freerun.c: Apply Max's stm32_oneshot.c fix to the tickless implementation and to the freerunning time.

This commit is contained in:
Mateusz Szafoni 2019-03-22 07:57:33 -06:00 committed by Gregory Nutt
parent bb23ac43ce
commit c266f53199
2 changed files with 9 additions and 9 deletions

View File

@ -82,7 +82,7 @@ static int stm32_freerun_handler(int irq, void *context, void *arg)
DEBUGASSERT(freerun != NULL && freerun->overflow < UINT32_MAX);
freerun->overflow++;
STM32_TIM_ACKINT(freerun->tch, 0);
STM32_TIM_ACKINT(freerun->tch, GTIM_SR_UIF);
return OK;
}
#endif /* CONFIG_CLOCK_TIMEKEEPING */
@ -161,8 +161,8 @@ int stm32_freerun_initialize(struct stm32_freerun_s *freerun, int chan,
STM32_TIM_SETMODE(freerun->tch, STM32_TIM_MODE_UP);
#ifndef CONFIG_CLOCK_TIMEKEEPING
STM32_TIM_ACKINT(freerun->tch, 0);
STM32_TIM_ENABLEINT(freerun->tch, 0);
STM32_TIM_ACKINT(freerun->tch, GTIM_SR_UIF);
STM32_TIM_ENABLEINT(freerun->tch, GTIM_DIER_UIE);
#endif
return OK;
@ -221,7 +221,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
if (pending)
{
STM32_TIM_ACKINT(freerun->tch, 0);
STM32_TIM_ACKINT(freerun->tch, GTIM_SR_UIF);
/* Increment the overflow count and use the value of the
* guaranteed to be AFTER the overflow occurred.
@ -298,7 +298,7 @@ int stm32_freerun_uninitialize(struct stm32_freerun_s *freerun)
/* Now we can disable the timer interrupt and disable the timer. */
STM32_TIM_DISABLEINT(freerun->tch, 0);
STM32_TIM_DISABLEINT(freerun->tch, GTIM_DIER_UIE);
STM32_TIM_SETMODE(freerun->tch, STM32_TIM_MODE_DISABLED);
STM32_TIM_SETISR(freerun->tch, NULL, NULL, 0);

View File

@ -342,7 +342,7 @@ static void stm32_timing_handler(void)
{
g_tickless.overflow++;
STM32_TIM_ACKINT(g_tickless.tch, 0);
STM32_TIM_ACKINT(g_tickless.tch, GTIM_SR_UIF);
}
#endif /* CONFIG_CLOCK_TIMEKEEPING */
@ -581,8 +581,8 @@ void arm_timer_initialize(void)
/* Start the timer */
STM32_TIM_ACKINT(g_tickless.tch, 0);
STM32_TIM_ENABLEINT(g_tickless.tch, 0);
STM32_TIM_ACKINT(g_tickless.tch, GTIM_SR_UIF);
STM32_TIM_ENABLEINT(g_tickless.tch, GTIM_DIER_UIE);
}
/****************************************************************************
@ -651,7 +651,7 @@ int up_timer_gettime(FAR struct timespec *ts)
if (pending)
{
STM32_TIM_ACKINT(g_tickless.tch, 0);
STM32_TIM_ACKINT(g_tickless.tch, GTIM_SR_UIF);
/* Increment the overflow count and use the value of the
* guaranteed to be AFTER the overflow occurred.