timer: increase next timer set in case of delay

Increases value of next timer set in case there is
a delay in tasks execution. Value of 1 is too small
to guarantee that the next interrupt will be triggered.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2020-03-20 13:53:19 +01:00 committed by Janusz Jankowski
parent 3746f459e7
commit 5550a5f676
1 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,9 @@
#include <ipc/stream.h>
#include <stdint.h>
/** \brief Minimum number of timer recovery cycles in case of delay. */
#define TIMER_MIN_RECOVER_CYCLES 100
void platform_timer_start(struct timer *timer)
{
/* run timer */
@ -43,7 +46,8 @@ int64_t platform_timer_set(struct timer *timer, uint64_t ticks)
if (ticks > shim_read64(SHIM_DSPWC))
shim_write64(SHIM_DSPWCT0C, ticks);
else
shim_write64(SHIM_DSPWCT0C, shim_read64(SHIM_DSPWC) + 1);
shim_write64(SHIM_DSPWCT0C, shim_read64(SHIM_DSPWC) +
TIMER_MIN_RECOVER_CYCLES);
/* Enable IRQ */
shim_write(SHIM_DSPWCTCS, SHIM_DSPWCTCS_T0A);