From 211c3c0e054224be81788695479f967935ad9aa2 Mon Sep 17 00:00:00 2001 From: Armando Date: Mon, 17 Jul 2023 17:10:52 +0800 Subject: [PATCH] feat(esp_timer): added esp_timer p4 base support --- components/esp_timer/src/esp_timer.c | 2 ++ components/esp_timer/src/esp_timer_impl_systimer.c | 7 +++++++ components/esp_timer/src/ets_timer_legacy.c | 2 ++ components/esp_timer/src/system_time.c | 2 ++ 4 files changed, 13 insertions(+) diff --git a/components/esp_timer/src/esp_timer.c b/components/esp_timer/src/esp_timer.c index 180de74c57..5fffae5770 100644 --- a/components/esp_timer/src/esp_timer.c +++ b/components/esp_timer/src/esp_timer.c @@ -37,6 +37,8 @@ #include "esp32c6/rtc.h" #elif CONFIG_IDF_TARGET_ESP32H2 #include "esp32h2/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32P4 +#include "esp32p4/rtc.h" #endif #include "sdkconfig.h" diff --git a/components/esp_timer/src/esp_timer_impl_systimer.c b/components/esp_timer/src/esp_timer_impl_systimer.c index 7471b2b3b8..ea79ebcfb8 100644 --- a/components/esp_timer/src/esp_timer_impl_systimer.c +++ b/components/esp_timer/src/esp_timer_impl_systimer.c @@ -192,9 +192,16 @@ esp_err_t esp_timer_impl_init(intr_handler_t alarm_handler) #endif | ESP_INTR_FLAG_IRAM; +#if !CONFIG_IDF_TARGET_ESP32P4 +//TODO: IDF-7486 esp_err_t err = esp_intr_alloc(ETS_SYSTIMER_TARGET2_EDGE_INTR_SOURCE, isr_flags, &timer_alarm_isr, NULL, &s_timer_interrupt_handle[(ISR_HANDLERS == 1) ? 0 : xPortGetCoreID()]); +#else + esp_err_t err = esp_intr_alloc(ETS_SYSTIMER_TARGET2_INTR_SOURCE, isr_flags, + &timer_alarm_isr, NULL, + &s_timer_interrupt_handle[(ISR_HANDLERS == 1) ? 0 : xPortGetCoreID()]); +#endif if (err != ESP_OK) { ESP_EARLY_LOGE(TAG, "esp_intr_alloc failed (0x%x)", err); return err; diff --git a/components/esp_timer/src/ets_timer_legacy.c b/components/esp_timer/src/ets_timer_legacy.c index 5ba2868e1d..dc80901a43 100644 --- a/components/esp_timer/src/ets_timer_legacy.c +++ b/components/esp_timer/src/ets_timer_legacy.c @@ -36,6 +36,8 @@ #include "esp32c6/rom/ets_sys.h" #elif CONFIG_IDF_TARGET_ESP32H2 #include "esp32h2/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32P4 +#include "esp32p4/rom/ets_sys.h" #endif /* We abuse 'timer_arg' field of ETSTimer structure to hold a pointer to esp_timer */ diff --git a/components/esp_timer/src/system_time.c b/components/esp_timer/src/system_time.c index e7844a2ccd..253ea56c76 100644 --- a/components/esp_timer/src/system_time.c +++ b/components/esp_timer/src/system_time.c @@ -31,6 +31,8 @@ #include "esp32c6/rtc.h" #elif CONFIG_IDF_TARGET_ESP32H2 #include "esp32h2/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32P4 +#include "esp32p4/rtc.h" #endif __attribute__((unused)) static const char* TAG = "system_time";