mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 11:44:31 +02:00
timer: pooling update bit before reading count value
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user