From 5b54ae76d43449ddafe4b06ca359983b5218c17c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 1 Jul 2022 19:58:23 +0200 Subject: [PATCH] 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. --- .../esp_timer/src/esp_timer_impl_systimer.c | 10 ++++--- .../hal/esp32c2/include/hal/systimer_ll.h | 7 +++++ .../hal/esp32c3/include/hal/systimer_ll.h | 19 ++++--------- .../hal/esp32h2/include/hal/systimer_ll.h | 1 + .../hal/esp32s2/include/hal/systimer_ll.h | 19 ++++--------- .../hal/esp32s3/include/hal/systimer_ll.h | 19 ++++--------- components/hal/include/hal/systimer_hal.h | 20 ++++--------- components/hal/systimer_hal.c | 28 +++++++++++++------ .../esp32c2/include/soc/Kconfig.soc_caps.in | 6 ++-- components/soc/esp32c2/include/soc/soc_caps.h | 16 +++++------ .../esp32c3/include/soc/Kconfig.soc_caps.in | 6 ++-- components/soc/esp32c3/include/soc/soc_caps.h | 16 +++++------ .../esp32h2/include/soc/Kconfig.soc_caps.in | 6 ++-- components/soc/esp32h2/include/soc/soc_caps.h | 16 +++++------ .../esp32s3/include/soc/Kconfig.soc_caps.in | 6 ++-- components/soc/esp32s3/include/soc/soc_caps.h | 16 +++++------ tools/ci/check_copyright_ignore.txt | 4 --- 17 files changed, 102 insertions(+), 113 deletions(-) diff --git a/components/esp_timer/src/esp_timer_impl_systimer.c b/components/esp_timer/src/esp_timer_impl_systimer.c index e7141830b1..a2af82c3be 100644 --- a/components/esp_timer/src/esp_timer_impl_systimer.c +++ b/components/esp_timer/src/esp_timer_impl_systimer.c @@ -64,7 +64,7 @@ uint64_t IRAM_ATTR esp_timer_impl_get_counter_reg(void) int64_t IRAM_ATTR esp_timer_impl_get_time(void) { - return systimer_hal_get_counter_value(&systimer_hal, SYSTIMER_LL_COUNTER_CLOCK) / SYSTIMER_LL_TICKS_PER_US; + return systimer_hal_get_counter_value(&systimer_hal, SYSTIMER_LL_COUNTER_CLOCK) * SYSTIMER_LL_TICKS_PER_US_DIV / SYSTIMER_LL_TICKS_PER_US; } int64_t esp_timer_get_time(void) __attribute__((alias("esp_timer_impl_get_time"))); @@ -96,7 +96,7 @@ static void IRAM_ATTR timer_alarm_isr(void *arg) void IRAM_ATTR esp_timer_impl_update_apb_freq(uint32_t apb_ticks_per_us) { -#if !SOC_SYSTIMER_FIXED_TICKS_US +#if !SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US systimer_hal_on_apb_freq_update(&systimer_hal, apb_ticks_per_us); #endif } @@ -104,7 +104,9 @@ void IRAM_ATTR esp_timer_impl_update_apb_freq(uint32_t apb_ticks_per_us) void esp_timer_impl_set(uint64_t new_us) { portENTER_CRITICAL_SAFE(&s_time_update_lock); - systimer_counter_value_t new_count = { .val = new_us * SYSTIMER_LL_TICKS_PER_US }; + systimer_counter_value_t new_count = { + .val = new_us * SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV + }; systimer_ll_set_counter_value(systimer_hal.dev, SYSTIMER_LL_COUNTER_CLOCK, new_count.val); systimer_ll_apply_counter_value(systimer_hal.dev, SYSTIMER_LL_COUNTER_CLOCK); portEXIT_CRITICAL_SAFE(&s_time_update_lock); @@ -121,7 +123,7 @@ esp_err_t esp_timer_impl_early_init(void) { systimer_hal_init(&systimer_hal); -#if !SOC_SYSTIMER_FIXED_TICKS_US +#if !SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US assert(esp_clk_xtal_freq() == (40 * 1000000) && "update the step for xtal to support other XTAL:APB frequency ratios"); systimer_hal_set_steps_per_tick(&systimer_hal, 0, 2); // for xtal diff --git a/components/hal/esp32c2/include/hal/systimer_ll.h b/components/hal/esp32c2/include/hal/systimer_ll.h index b993bf5347..36cc040840 100644 --- a/components/hal/esp32c2/include/hal/systimer_ll.h +++ b/components/hal/esp32c2/include/hal/systimer_ll.h @@ -9,13 +9,20 @@ #include #include "soc/systimer_struct.h" #include "hal/assert.h" +#include "sdkconfig.h" #define SYSTIMER_LL_COUNTER_CLOCK (0) // Counter used for "wallclock" time #define SYSTIMER_LL_COUNTER_OS_TICK (1) // Counter used for OS tick #define SYSTIMER_LL_ALARM_OS_TICK_CORE0 (0) // Alarm used for OS tick of CPU core 0 #define SYSTIMER_LL_ALARM_CLOCK (2) // Alarm used for "wallclock" time +#ifdef CONFIG_ESP32C2_XTAL_FREQ_26 +#define SYSTIMER_LL_TICKS_PER_US (52) // (26 / 2.5) = 10.4 = 52/5 systimer ticks per us +#define SYSTIMER_LL_TICKS_PER_US_DIV (5) +#else #define SYSTIMER_LL_TICKS_PER_US (16) // 16 systimer ticks == 1us +#define SYSTIMER_LL_TICKS_PER_US_DIV (1) +#endif // ESP32C2_XTAL_FREQ_* #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32c3/include/hal/systimer_ll.h b/components/hal/esp32c3/include/hal/systimer_ll.h index 3628978f68..beedfcb853 100644 --- a/components/hal/esp32c3/include/hal/systimer_ll.h +++ b/components/hal/esp32c3/include/hal/systimer_ll.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include @@ -24,6 +16,7 @@ #define SYSTIMER_LL_ALARM_CLOCK (2) // Alarm used for "wallclock" time #define SYSTIMER_LL_TICKS_PER_US (16) // 16 systimer ticks == 1us +#define SYSTIMER_LL_TICKS_PER_US_DIV (1) #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32h2/include/hal/systimer_ll.h b/components/hal/esp32h2/include/hal/systimer_ll.h index a17b5add9d..c1983eb439 100644 --- a/components/hal/esp32h2/include/hal/systimer_ll.h +++ b/components/hal/esp32h2/include/hal/systimer_ll.h @@ -16,6 +16,7 @@ #define SYSTIMER_LL_ALARM_CLOCK (2) // Alarm used for "wallclock" time #define SYSTIMER_LL_TICKS_PER_US (16) // 16 systimer ticks == 1us +#define SYSTIMER_LL_TICKS_PER_US_DIV (1) #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32s2/include/hal/systimer_ll.h b/components/hal/esp32s2/include/hal/systimer_ll.h index 6066674243..1c0d5498ad 100644 --- a/components/hal/esp32s2/include/hal/systimer_ll.h +++ b/components/hal/esp32s2/include/hal/systimer_ll.h @@ -1,16 +1,8 @@ -// Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include @@ -22,6 +14,7 @@ #define SYSTIMER_LL_ALARM_CLOCK (2) // Alarm used for "wallclock" time #define SYSTIMER_LL_TICKS_PER_US (80) // 80 systimer ticks == 1us +#define SYSTIMER_LL_TICKS_PER_US_DIV (1) #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32s3/include/hal/systimer_ll.h b/components/hal/esp32s3/include/hal/systimer_ll.h index 7f171e92e3..4f4084a5d6 100644 --- a/components/hal/esp32s3/include/hal/systimer_ll.h +++ b/components/hal/esp32s3/include/hal/systimer_ll.h @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include @@ -25,6 +17,7 @@ #define SYSTIMER_LL_ALARM_CLOCK (2) // Alarm used for "wallclock" time #define SYSTIMER_LL_TICKS_PER_US (16) // 16 systimer ticks == 1us +#define SYSTIMER_LL_TICKS_PER_US_DIV (1) #ifdef __cplusplus extern "C" { diff --git a/components/hal/include/hal/systimer_hal.h b/components/hal/include/hal/systimer_hal.h index 9ac3262fa8..f3f197c551 100644 --- a/components/hal/include/hal/systimer_hal.h +++ b/components/hal/include/hal/systimer_hal.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -93,7 +85,7 @@ void systimer_hal_connect_alarm_counter(systimer_hal_context_t *hal, uint32_t al */ void systimer_hal_counter_can_stall_by_cpu(systimer_hal_context_t *hal, uint32_t counter_id, uint32_t cpu_id, bool can); -#if !SOC_SYSTIMER_FIXED_TICKS_US +#if !SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US /** * @brief set increase steps for systimer counter on different clock source */ diff --git a/components/hal/systimer_hal.c b/components/hal/systimer_hal.c index b280c98a53..b2ad63a00d 100644 --- a/components/hal/systimer_hal.c +++ b/components/hal/systimer_hal.c @@ -47,19 +47,25 @@ uint64_t systimer_hal_get_counter_value(systimer_hal_context_t *hal, uint32_t co uint64_t systimer_hal_get_time(systimer_hal_context_t *hal, uint32_t counter_id) { - return systimer_hal_get_counter_value(hal, counter_id) / SYSTIMER_LL_TICKS_PER_US; + return systimer_hal_get_counter_value(hal, counter_id) * SYSTIMER_LL_TICKS_PER_US_DIV / SYSTIMER_LL_TICKS_PER_US; } #if SOC_SYSTIMER_ALARM_MISS_COMPENSATE void systimer_hal_set_alarm_target(systimer_hal_context_t *hal, uint32_t alarm_id, uint64_t target) { - systimer_counter_value_t alarm = { .val = target * SYSTIMER_LL_TICKS_PER_US}; + systimer_counter_value_t alarm = { + .val = target * SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV + }; systimer_ll_enable_alarm(hal->dev, alarm_id, false); systimer_ll_set_alarm_target(hal->dev, alarm_id, alarm.val); systimer_ll_apply_alarm_value(hal->dev, alarm_id); systimer_ll_enable_alarm(hal->dev, alarm_id, true); } -#else + +#else // SOC_SYSTIMER_ALARM_MISS_COMPENSATE + +_Static_assert(SYSTIMER_LL_TICKS_PER_US_DIV == 1, "SYSTIMER_LL_TICKS_PER_US_DIV > 1 && !SOC_SYSTIMER_ALARM_MISS_COMPENSATE hasn't been supported"); + void systimer_hal_set_alarm_target(systimer_hal_context_t *hal, uint32_t alarm_id, uint64_t timestamp) { int64_t offset = SYSTIMER_LL_TICKS_PER_US * 2; @@ -81,12 +87,12 @@ void systimer_hal_set_alarm_target(systimer_hal_context_t *hal, uint32_t alarm_i } } while (1); } -#endif +#endif // SOC_SYSTIMER_ALARM_MISS_COMPENSATE void systimer_hal_set_alarm_period(systimer_hal_context_t *hal, uint32_t alarm_id, uint32_t period) { systimer_ll_enable_alarm(hal->dev, alarm_id, false); - systimer_ll_set_alarm_period(hal->dev, alarm_id, period * SYSTIMER_LL_TICKS_PER_US); + systimer_ll_set_alarm_period(hal->dev, alarm_id, period * SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV); systimer_ll_apply_alarm_value(hal->dev, alarm_id); systimer_ll_enable_alarm(hal->dev, alarm_id, true); } @@ -103,7 +109,10 @@ void systimer_hal_enable_alarm_int(systimer_hal_context_t *hal, uint32_t alarm_i void systimer_hal_counter_value_advance(systimer_hal_context_t *hal, uint32_t counter_id, int64_t time_us) { - systimer_counter_value_t new_count = { .val = systimer_hal_get_counter_value(hal, counter_id) + time_us * SYSTIMER_LL_TICKS_PER_US }; + systimer_counter_value_t new_count = { + .val = systimer_hal_get_counter_value(hal, counter_id) + + time_us * SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV + }; systimer_ll_set_counter_value(hal->dev, counter_id, new_count.val); systimer_ll_apply_counter_value(hal->dev, counter_id); } @@ -137,7 +146,10 @@ void systimer_hal_counter_can_stall_by_cpu(systimer_hal_context_t *hal, uint32_t systimer_ll_counter_can_stall_by_cpu(hal->dev, counter_id, cpu_id, can); } -#if !SOC_SYSTIMER_FIXED_TICKS_US +#if !SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US + +_Static_assert(SYSTIMER_LL_TICKS_PER_US_DIV == 1, "SYSTIMER_LL_TICKS_PER_US_DIV > 1 && !SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US hasn't been supported"); + void systimer_hal_set_steps_per_tick(systimer_hal_context_t *hal, int clock_source, uint32_t steps) { /* Configure the counter: @@ -171,4 +183,4 @@ void systimer_hal_on_apb_freq_update(systimer_hal_context_t *hal, uint32_t apb_t systimer_ll_set_step_for_xtal(hal->dev, SYSTIMER_LL_TICKS_PER_US / apb_ticks_per_us); } } -#endif +#endif // !SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US diff --git a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in index 46b634275e..f5d95c6429 100644 --- a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in @@ -411,9 +411,9 @@ config SOC_SYSTIMER_BIT_WIDTH_HI int default 20 -config SOC_SYSTIMER_FIXED_TICKS_US - int - default 16 +config SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US + bool + default y config SOC_SYSTIMER_INT_LEVEL bool diff --git a/components/soc/esp32c2/include/soc/soc_caps.h b/components/soc/esp32c2/include/soc/soc_caps.h index f87a11e8bf..080debf2db 100644 --- a/components/soc/esp32c2/include/soc/soc_caps.h +++ b/components/soc/esp32c2/include/soc/soc_caps.h @@ -203,14 +203,14 @@ #define SOC_MEMSPI_SRC_FREQ_15M_SUPPORTED 1 /*-------------------------- SYSTIMER CAPS ----------------------------------*/ -#define SOC_SYSTIMER_SUPPORTED 1 -#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units -#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units -#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part -#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part -#define SOC_SYSTIMER_FIXED_TICKS_US (16) // Number of ticks per microsecond is fixed -#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level interrupt -#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) +#define SOC_SYSTIMER_SUPPORTED 1 +#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units +#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units +#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part +#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part +#define SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US (1) // Number of ticks per microsecond is fixed (16 ticks/us if 40MHz XTAL; 10.4 ticks/us if 26MHz XTAL) +#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level interrupt +#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) /*--------------------------- TIMER GROUP CAPS ---------------------------------------*/ #define SOC_TIMER_GROUPS (1U) diff --git a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in index 2f3a1d8fec..9ebc0348c3 100644 --- a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in @@ -603,9 +603,9 @@ config SOC_SYSTIMER_BIT_WIDTH_HI int default 20 -config SOC_SYSTIMER_FIXED_TICKS_US - int - default 16 +config SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US + bool + default y config SOC_SYSTIMER_INT_LEVEL bool diff --git a/components/soc/esp32c3/include/soc/soc_caps.h b/components/soc/esp32c3/include/soc/soc_caps.h index d3729d35e9..e1426cfaa5 100644 --- a/components/soc/esp32c3/include/soc/soc_caps.h +++ b/components/soc/esp32c3/include/soc/soc_caps.h @@ -283,14 +283,14 @@ #define SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED 1 /*-------------------------- SYSTIMER CAPS ----------------------------------*/ -#define SOC_SYSTIMER_SUPPORTED 1 -#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units -#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units -#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part -#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part -#define SOC_SYSTIMER_FIXED_TICKS_US (16) // Number of ticks per microsecond is fixed -#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level interrupt -#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) +#define SOC_SYSTIMER_SUPPORTED 1 +#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units +#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units +#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part +#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part +#define SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US (1) // Number of ticks per microsecond is fixed (16 ticks/us) +#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level interrupt +#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) /*--------------------------- TIMER GROUP CAPS ---------------------------------------*/ #define SOC_TIMER_GROUPS (2) diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index 62c4b4d6b7..381faec6e2 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -579,9 +579,9 @@ config SOC_SYSTIMER_BIT_WIDTH_HI int default 20 -config SOC_SYSTIMER_FIXED_TICKS_US - int - default 16 +config SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US + bool + default y config SOC_SYSTIMER_INT_LEVEL bool diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index c05afd7f9b..d32334c623 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -288,14 +288,14 @@ #define SOC_MEMSPI_SRC_FREQ_12M_SUPPORTED 1 /*-------------------------- SYSTIMER CAPS ----------------------------------*/ -#define SOC_SYSTIMER_SUPPORTED 1 -#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units -#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units -#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part -#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part -#define SOC_SYSTIMER_FIXED_TICKS_US (16) // Number of ticks per microsecond is fixed -#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level interrupt -#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) +#define SOC_SYSTIMER_SUPPORTED 1 +#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units +#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units +#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part +#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part +#define SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US (1) // Number of ticks per microsecond is fixed (16 ticks/us) +#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level interrupt +#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) /*--------------------------- TIMER GROUP CAPS ---------------------------------------*/ #define SOC_TIMER_GROUPS (2) diff --git a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in index ff51e5f55c..dd1962ef33 100644 --- a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in @@ -679,9 +679,9 @@ config SOC_SYSTIMER_BIT_WIDTH_HI int default 20 -config SOC_SYSTIMER_FIXED_TICKS_US - int - default 16 +config SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US + bool + default y config SOC_SYSTIMER_INT_LEVEL bool diff --git a/components/soc/esp32s3/include/soc/soc_caps.h b/components/soc/esp32s3/include/soc/soc_caps.h index c4b63cf5ef..de5b71f250 100644 --- a/components/soc/esp32s3/include/soc/soc_caps.h +++ b/components/soc/esp32s3/include/soc/soc_caps.h @@ -277,14 +277,14 @@ #define SOC_SPIRAM_SUPPORTED 1 /*-------------------------- SYS TIMER CAPS ----------------------------------*/ -#define SOC_SYSTIMER_SUPPORTED 1 -#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units -#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units -#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part -#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part -#define SOC_SYSTIMER_FIXED_TICKS_US (16) // Number of ticks per microsecond is fixed -#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level -#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) +#define SOC_SYSTIMER_SUPPORTED 1 +#define SOC_SYSTIMER_COUNTER_NUM (2) // Number of counter units +#define SOC_SYSTIMER_ALARM_NUM (3) // Number of alarm units +#define SOC_SYSTIMER_BIT_WIDTH_LO (32) // Bit width of systimer low part +#define SOC_SYSTIMER_BIT_WIDTH_HI (20) // Bit width of systimer high part +#define SOC_SYSTIMER_HAS_FIXED_TICKS_PER_US (1) // Number of ticks per microsecond is fixed (16 ticks/us) +#define SOC_SYSTIMER_INT_LEVEL (1) // Systimer peripheral uses level +#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1) // Systimer peripheral can generate interrupt immediately if t(target) > t(current) /*-------------------------- TIMER GROUP CAPS --------------------------------*/ #define SOC_TIMER_GROUPS (2) diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 903ca3293e..bd6000b736 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -758,7 +758,6 @@ components/hal/esp32c3/include/hal/rtc_cntl_ll.h components/hal/esp32c3/include/hal/sha_ll.h components/hal/esp32c3/include/hal/sigmadelta_ll.h components/hal/esp32c3/include/hal/spi_flash_encrypted_ll.h -components/hal/esp32c3/include/hal/systimer_ll.h components/hal/esp32c3/include/hal/uhci_ll.h components/hal/esp32c3/include/hal/usb_serial_jtag_ll.h components/hal/esp32c3/rtc_cntl_hal.c @@ -785,7 +784,6 @@ components/hal/esp32s2/include/hal/rtc_io_ll.h components/hal/esp32s2/include/hal/sha_ll.h components/hal/esp32s2/include/hal/sigmadelta_ll.h components/hal/esp32s2/include/hal/spi_flash_encrypted_ll.h -components/hal/esp32s2/include/hal/systimer_ll.h components/hal/esp32s2/include/hal/trace_ll.h components/hal/esp32s2/include/hal/usb_ll.h components/hal/esp32s2/touch_sensor_hal.c @@ -795,7 +793,6 @@ components/hal/esp32s3/include/hal/rwdt_ll.h components/hal/esp32s3/include/hal/sha_ll.h components/hal/esp32s3/include/hal/sigmadelta_ll.h components/hal/esp32s3/include/hal/spi_flash_encrypted_ll.h -components/hal/esp32s3/include/hal/systimer_ll.h components/hal/esp32s3/include/hal/uhci_ll.h components/hal/esp32s3/include/hal/usb_ll.h components/hal/esp32s3/include/hal/usb_serial_jtag_ll.h @@ -815,7 +812,6 @@ components/hal/include/hal/sigmadelta_hal.h components/hal/include/hal/spi_flash_encrypt_hal.h components/hal/include/hal/spi_slave_hal.h components/hal/include/hal/spi_slave_hd_hal.h -components/hal/include/hal/systimer_hal.h components/hal/include/hal/twai_types.h components/hal/include/hal/uhci_types.h components/hal/include/hal/usb_hal.h