esp-idf/components/hal/esp32s2
Ivan Grokhotkov 5b54ae76d4 esp_timer, hal: add support for non-integer systimer frequency
When ESP32-C2 is paired with a 26 MHz XTAL, the systimer tick
frequency becomes equal to 26 / 2.5 = 10.4 MHz. Previously we always
assumed that systimer tick frequency is integer (and 1 MHz * power of
two, above that!).
This commit introduces a new LL macro, SYSTIMER_LL_TICKS_PER_US_DIV.
It should be set in such a way that:

1. SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV equals the
   actual systimer tick frequency,
2. and SYSTIMER_LL_TICKS_PER_US is integer.

For ESP32-C2 this means that SYSTIMER_LL_TICKS_PER_US = 52 and
SYSTIMER_LL_TICKS_PER_US_DIV = 5.

This introduced two possible issues:

1. Overflow when multiplying systimer counter by 5
   - Should not be an issue, since systimer counter is 52-bit, so
     counter * 5 is no more than 55-bit.
2. The code needs to perform:
   - divide by 5: when converting from microseconds to ticks
   - divide by 52: when converting from ticks to microseconds
   The latter potentially introduces a performance issue for the
   esp_timer_get_time function.
2022-07-11 12:24:37 +08:00
..
include/hal esp_timer, hal: add support for non-integer systimer frequency 2022-07-11 12:24:37 +08:00
brownout_hal.c G0: Support Xtensa targets for G0-only compilation 2022-06-20 11:34:20 +00:00
cp_dma_hal.c dma: move from driver to hw_support 2022-06-28 14:17:12 +08:00
dac_hal.c adc: support adc dma driver on all chips 2021-12-16 00:19:15 +00:00
efuse_hal.c efuse: Adds major and minor versions and others 2022-07-05 14:38:27 +08:00
touch_sensor_hal.c touch_sensor: fix esp32s2 touch sensor default power source 2021-05-08 11:09:17 +08:00