From ef1560cb1393c500dfae2252d5a892b06541348c Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 15 Jun 2020 16:16:27 +0100 Subject: [PATCH] zephyr: agent: Use Zephyr clocks and complain more loudly. Signed-off-by: Liam Girdwood --- src/lib/agent.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/agent.c b/src/lib/agent.c index 9b8194075..81ccae293 100644 --- a/src/lib/agent.c +++ b/src/lib/agent.c @@ -33,6 +33,10 @@ #include #include +#ifdef __ZEPHYR__ +#include +#endif + /* 5276b491-5b64-464e-8984-dc228ef9e6a1 */ DECLARE_SOF_UUID("sa", sa_uuid, 0x5276b491, 0x5b64, 0x464e, 0x89, 0x84, 0xdc, 0x22, 0x8e, 0xf9, 0xe6, 0xa1); @@ -88,7 +92,11 @@ void sa_init(struct sof *sof, uint64_t timeout) SOF_MEM_CAPS_RAM, sizeof(*sof->sa)); /* set default timeouts */ +#ifdef __ZEPHYR__ + ticks = k_us_to_cyc_ceil64(timeout); +#else ticks = clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * timeout / 1000; +#endif /* TODO: change values after minimal drifts will be assured */ sof->sa->panic_timeout = 2 * ticks; /* 100% delay */