Commit graph

20 commits

Author SHA1 Message Date
KonstantinKondrashov
ab0f6aceac 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
2020-02-05 10:43:47 +00:00
KonstantinKondrashov
648f25e275 esp_timer: Add Test case when set_alarm needs set timer < now_time 2019-12-14 04:36:41 +08:00
KonstantinKondrashov
48a3f7d716 esp32: Add UTs to check the System time does not jump back 2019-11-05 12:47:17 +00:00
Ivan Grokhotkov
01007698b7 esp_timer: handle esp_timer_delete in timer task
Closes https://github.com/espressif/esp-idf/issues/3458
2019-11-05 12:47:17 +00:00
Ivan Grokhotkov
742f8e7f8a esp_timer: fix occasional failures in "monotonic values" test
1. ref_clock used in unit tests occasionally produces time off by ~100
microseconds shortly after being started. Add a delay to let
ref_clock stabilise, until the cause is found.

2. Reduce roundoff error accumulation which would occasionally cause
the test to fail, by choosing an overflow value which can be divided
by APB frequency.

3. Move time sampling part of the test into an IRAM function to
reduce variations due to cache behavior.

4. Remove calculation of "standard deviation" in the test, as what was
calculated was not actually standard deviation, and it did not add any
useful information.
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov
7e16a79cf7 esp_timer: improve unit test robustness
1. call esp_timer_get_time and ref_clock_get in the same order on
   start and in the loop

2. disable interrupts when calculating delta between ref_clock
   and esp_timer

3. ensure both functions are in cache before calculating the delta
2019-02-28 20:38:31 +08:00
Ivan Grokhotkov
b4e836eb97 esp_timer: test for monotonic values of esp_timer_get_timer in CI
Reduce test time by increasing overflow rate, make test more robust.
2018-06-11 02:37:19 +00:00
Ivan Grokhotkov
49d200aaa7 esp_timer: add test for esp_timer_impl_set_alarm
Ref https://github.com/espressif/esp-idf/issues/1891
2018-06-11 02:37:19 +00:00
Ivan Grokhotkov
141e51b468 esp_timer: reduce overflow value in unit tests
This allows testing for race conditions which occur near timer
overflow point more effectively.
2018-06-11 02:37:19 +00:00
Ivan Grokhotkov
296b280801 esp_timer: fix esp_timer_impl_advance not triggering expired timers 2018-05-09 22:52:41 +08:00
Ivan Grokhotkov
f0547d58e4 esp_timer: add documentation, expose profiling option in Kconfig 2017-11-29 11:44:46 +08:00
Ivan Grokhotkov
6e7eb3c776 esp_timer: fix for the case when timer is deleted in callback
Timer callback can delete the timer. If CONFIG_ESP_TIMER_PROFILING was
enabled, this caused an access to invalid (freed) memory.
This fix adds a pointer to track the timer while executing the callback.
This is needed so that we can check if callback deletes the timer,
in which case we won't try updating profiling counters for this timer
after the callback is done.
2017-11-29 11:44:46 +08:00
He Yin Ling
0c40b2ec9d test: collect performance for esp-timer / spinlock 2017-11-16 17:48:48 +08:00
Ivan Grokhotkov
4798b7d775 unit tests: add test to dump esp_timer stats 2017-10-18 14:19:15 +08:00
Ivan Grokhotkov
3788b35f87 unit tests: more robust esp_timer test 2017-10-18 14:19:15 +08:00
Ivan Grokhotkov
f13623d97d make esp_timer.h public 2017-10-18 12:31:38 +08:00
Ivan Grokhotkov
06af8cd086 esp_timer: return signed timestamp (int64_t)
Since timestamps are 64-bit, loosing one bit of range due to sign does
not present an issue, however for applications doing calculations on
timestamps, signed return type is more convenient.
2017-09-01 10:34:36 +08:00
Ivan Grokhotkov
c5632d3012 esp32: use ref_clock in esp_timer and delay tests 2017-09-01 10:34:36 +08:00
Ivan Grokhotkov
1af6384349 esp_timer: lock-free implementation of esp_timer_get_time
The implementation of esp_timer_get_time used a critical section, which
resulted in a call time of ~1.8us. To make esp_timer_get_time more
useable as a high-resolution time source, this change replaces the lock
with polling. Call time is reduced to ~0.7us.
2017-09-01 10:34:36 +08:00
Ivan Grokhotkov
857a29872d esp_timer: add high resolution software timer API 2017-08-28 11:35:26 +08:00