Time keeping breakage on SOF with Zephyr on i.MX
Describe the bug
Commit c3c94fc5151886f ("header: rtos: use rtos specific version of wait.h") breaks i.MX platforms running SOF with Zephyr.
This happens because commit uses k_cycle_get_64 which always returns 0 on i.MX8 as the CCOUNT register is 32 bits.
e.g
- *wallclock = sof_cycle_get_64();
+ *wallclock = k_cycle_get_64();
On, Xtos we solved this issue by introducing sof_cycle_get_64:
static inline uint64_t sof_cycle_get_64(void)
{
if (IS_ENABLED(CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER))
return k_cycle_get_64();
else
return k_ticks_to_cyc_floor64(k_uptime_ticks());
}
@lgirdwood there are two steps on solving this issue:
- Try to use as much as native Zephyr API for waiting functions:
e.g
replace:
+/* TODO: use equivalent Zephyr */
+static inline void idelay(int n)
+{
+ while (n--)
+ asm volatile("nop");
+}
with k_busy_wait.
- Add again
sof_cycle_get_64wrapper to replacek_cycle_get_64.
Cc: @lgirdwood @LaurentiuM1234
This should be an acceptable fix: https://github.com/thesofproject/sof/pull/6416
This should be an acceptable fix: #6416
Can we close ?
fixed with https://github.com/thesofproject/sof/pull/6416