mirror of https://github.com/thesofproject/sof.git
zephyr: make sure non-atomic 64-bit timer is consistent
The Zephyr timer implementation reads high and low 32 bits in a non-atomic way. Add a loop to make sure the read is consistent. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
9ac38d8828
commit
372d3873bd
|
@ -277,10 +277,12 @@ uint64_t platform_timer_get(struct timer *timer)
|
|||
uint32_t high;
|
||||
uint64_t time;
|
||||
|
||||
/* read low 32 bits */
|
||||
low = shim_read(SHIM_EXT_TIMER_STAT);
|
||||
/* TODO: check and see whether 32bit IRQ is pending for timer */
|
||||
high = timer->hitime;
|
||||
do {
|
||||
/* TODO: check and see whether 32bit IRQ is pending for timer */
|
||||
high = timer->hitime;
|
||||
/* read low 32 bits */
|
||||
low = shim_read(SHIM_EXT_TIMER_STAT);
|
||||
} while (high != timer->hitime);
|
||||
|
||||
time = ((uint64_t)high << 32) | low;
|
||||
|
||||
|
|
Loading…
Reference in New Issue