mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
timer: pooling update bit before reading count value
This commit is contained in:
parent
f5939c9e68
commit
deea402cf4
@ -103,6 +103,7 @@ static inline void timer_ll_set_counter_value(timg_dev_t *hw, timer_idx_t timer_
|
||||
FORCE_INLINE_ATTR void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *timer_val)
|
||||
{
|
||||
hw->hw_timer[timer_num].update = 1;
|
||||
while (hw->hw_timer[timer_num].update) {}
|
||||
*timer_val = ((uint64_t) hw->hw_timer[timer_num].cnt_high << 32) | (hw->hw_timer[timer_num].cnt_low);
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ static inline void timer_ll_set_counter_value(timg_dev_t *hw, timer_idx_t timer_
|
||||
FORCE_INLINE_ATTR void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *timer_val)
|
||||
{
|
||||
hw->hw_timer[timer_num].update.update = 1;
|
||||
while (hw->hw_timer[timer_num].update.update) {}
|
||||
*timer_val = ((uint64_t) hw->hw_timer[timer_num].cnt_high << 32) | (hw->hw_timer[timer_num].cnt_low);
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ static inline void timer_ll_set_counter_value(timg_dev_t *hw, timer_idx_t timer_
|
||||
FORCE_INLINE_ATTR void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *timer_val)
|
||||
{
|
||||
hw->hw_timer[timer_num].update.update = 1;
|
||||
while (hw->hw_timer[timer_num].update.update) {}
|
||||
*timer_val = ((uint64_t) hw->hw_timer[timer_num].cnt_high.hi << 32) | (hw->hw_timer[timer_num].cnt_low);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user