esp_timer/esp32: Fix case when alarm_reg > counter_reg but FRC_TIMER_INT_STATUS is not set

Closes: WIFI-1576
Closes: https://github.com/espressif/esp-idf/issues/2954
This commit is contained in:
KonstantinKondrashov
2020-01-13 14:36:38 +08:00
parent eaafe7f599
commit 6061d5d65a
2 changed files with 40 additions and 3 deletions

View File

@@ -836,3 +836,13 @@ TEST_CASE("Test case when esp_timer_impl_set_alarm needs set timer < now_time",
printf("alarm_reg = 0x%x, count_reg 0x%x\n", alarm_reg, count_reg);
TEST_ASSERT(alarm_reg <= (count_reg + offset));
}
TEST_CASE("Test esp_timer_impl_set_alarm when the counter is near an overflow value", "[esp_timer]")
{
for (int i = 0; i < 1024; ++i) {
uint32_t count_reg = 0xeffffe00 + i;
REG_WRITE(FRC_TIMER_LOAD_REG(1), count_reg);
printf("%d) count_reg = 0x%x\n", i, count_reg);
esp_timer_impl_set_alarm(1); // timestamp is expired
}
}