drivers: timers: systick: Enforce a barrier in _timer_cycle_get_32.

The code assumes that when the systick counter hits zero,
the timer interrupt will be taken before the loop can
read the LOAD/VAL registers, but this is not architecturally
guaranteed, and so the code can see a post-reload SysTick->VAL
and a pre-reload clock_accumulated_count, which causes it to
return an incorrectly small cycle count. By adding a ISB we
overcome this issue.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2018-04-20 11:44:23 +05:30 committed by Anas Nashif
commit 36365e38ba

View file

@ -772,6 +772,7 @@ return (u32_t) get_elapsed_count();
#else
count = SysTick->LOAD - SysTick->VAL;
#endif
__ISB();
} while (cac != clock_accumulated_count);
return cac + count;