esp_timer: use freertos critical section compliant APIs

Some modules use esp_timer from interrupt context and hence
with vanilla FreeRTOS it should use correct critical section
API
This commit is contained in:
Mahavir Jain
2019-11-14 11:39:11 +05:30
parent 59d818c387
commit d0a37704a3
4 changed files with 44 additions and 6 deletions

View File

@@ -222,7 +222,7 @@ uint64_t IRAM_ATTR esp_timer_impl_get_time(void)
void IRAM_ATTR esp_timer_impl_set_alarm(uint64_t timestamp)
{
portENTER_CRITICAL(&s_time_update_lock);
portENTER_CRITICAL_SAFE(&s_time_update_lock);
// Alarm time relative to the moment when counter was 0
uint64_t time_after_timebase_us = timestamp - s_time_base_us;
// Adjust current time if overflow has happened
@@ -252,7 +252,7 @@ void IRAM_ATTR esp_timer_impl_set_alarm(uint64_t timestamp)
alarm_reg_val = (uint32_t) compare_val;
}
REG_WRITE(FRC_TIMER_ALARM_REG(1), alarm_reg_val);
portEXIT_CRITICAL(&s_time_update_lock);
portEXIT_CRITICAL_SAFE(&s_time_update_lock);
}
static void IRAM_ATTR timer_alarm_isr(void *arg)