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:
parent
023bc923b0
commit
36365e38ba
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue