From cf36c11b813aa5af3b4a42f2cf51bb35a4a12985 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 1 Jul 2024 12:11:41 +0800 Subject: [PATCH] feat(lp-core): added support for using ETM events as wake-up source --- .../include/esp_private/etm_interface.h | 1 + .../hal/esp32c5/include/hal/lp_aon_ll.h | 18 +++ .../hal/esp32p4/include/hal/lp_core_ll.h | 9 ++ components/hal/include/hal/lp_core_types.h | 41 ++++++ .../esp32c6/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32c6/include/soc/soc_caps.h | 1 + .../esp32p4/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32p4/include/soc/soc_caps.h | 3 + components/ulp/CMakeLists.txt | 4 + components/ulp/lp_core/include/lp_core_etm.h | 60 ++++++++ components/ulp/lp_core/lp_core.c | 2 +- .../ulp/lp_core/lp_core/lp_core_utils.c | 10 +- components/ulp/lp_core/lp_core_etm.c | 90 ++++++++++++ .../ulp/test_apps/lp_core/main/CMakeLists.txt | 4 + .../test_apps/lp_core/main/test_lp_core_etm.c | 130 ++++++++++++++++++ docs/doxygen/Doxyfile | 1 + docs/doxygen/Doxyfile_esp32c5 | 3 +- docs/doxygen/Doxyfile_esp32c6 | 1 + docs/doxygen/Doxyfile_esp32p4 | 1 + docs/en/api-reference/system/ulp-lp-core.rst | 10 +- .../api-reference/system/ulp-lp-core.rst | 10 +- 21 files changed, 400 insertions(+), 7 deletions(-) create mode 100644 components/hal/include/hal/lp_core_types.h create mode 100644 components/ulp/lp_core/include/lp_core_etm.h create mode 100644 components/ulp/lp_core/lp_core_etm.c create mode 100644 components/ulp/test_apps/lp_core/main/test_lp_core_etm.c diff --git a/components/esp_hw_support/include/esp_private/etm_interface.h b/components/esp_hw_support/include/esp_private/etm_interface.h index 04c02964f9..a3924a064b 100644 --- a/components/esp_hw_support/include/esp_private/etm_interface.h +++ b/components/esp_hw_support/include/esp_private/etm_interface.h @@ -27,6 +27,7 @@ typedef enum { ETM_TRIG_PERIPH_MCPWM, /*!< ETM trigger source: MCPWM */ ETM_TRIG_PERIPH_ANA_CMPR, /*!< ETM trigger source: Analog Comparator */ ETM_TRIG_PERIPH_TSENS, /*!< ETM trigger source: Temperature Sensor */ + ETM_TRIG_PERIPH_LP_CORE, /*!< ETM trigger source: Low-Power Core */ } etm_trigger_peripheral_t; /** diff --git a/components/hal/esp32c5/include/hal/lp_aon_ll.h b/components/hal/esp32c5/include/hal/lp_aon_ll.h index dc65bb3225..e355237135 100644 --- a/components/hal/esp32c5/include/hal/lp_aon_ll.h +++ b/components/hal/esp32c5/include/hal/lp_aon_ll.h @@ -92,6 +92,24 @@ static inline void lp_aon_ll_inform_wakeup_type(bool dslp) } } +/** + * @brief Get the flag that marks whether LP CPU is awakened by ETM + * + * @return Return true if lpcore is woken up by soc_etm + */ +static inline bool lp_aon_ll_get_lpcore_etm_wakeup_flag(void) +{ + return REG_GET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG); +} + +/** + * @brief Clear the flag that marks whether LP CPU is awakened by soc_etm + */ +static inline void lp_aon_ll_clear_lpcore_etm_wakeup_flag(void) +{ + REG_SET_BIT(LP_AON_LPCORE_REG, LP_AON_LPCORE_ETM_WAKEUP_FLAG_CLR); +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32p4/include/hal/lp_core_ll.h b/components/hal/esp32p4/include/hal/lp_core_ll.h index d67c0c52bb..b045f4703c 100644 --- a/components/hal/esp32p4/include/hal/lp_core_ll.h +++ b/components/hal/esp32p4/include/hal/lp_core_ll.h @@ -148,6 +148,15 @@ static inline void lp_core_ll_request_sleep(void) PMU.lp_ext.pwr1.sleep_req = 1; } +/** + * @brief Clear the ETM wakeup interrupt sources on the LP core + * + */ +static inline void lp_core_ll_clear_etm_wakeup_status(void) +{ + LP_SYS.sys_ctrl.lp_core_etm_wakeup_flag_clr = 1; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/lp_core_types.h b/components/hal/include/hal/lp_core_types.h new file mode 100644 index 0000000000..046840a7e1 --- /dev/null +++ b/components/hal/include/hal/lp_core_types.h @@ -0,0 +1,41 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "soc/soc_caps.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if SOC_LP_CORE_SUPPORTED + +#if SOC_LP_CORE_SUPPORT_ETM +/** + * @brief LP-Core event types enum + */ +typedef enum { + LP_CORE_EVENT_ERR_INTR, /*!< Exception triggered on LP-Core */ + LP_CORE_EVENT_START_INTR, /*!< LP-Core clock has been turned on */ + LP_CORE_EVENT_MAX, /*!< Maximum number of LP-Core events */ +} lp_core_etm_event_type_t; + +/** + * @brief LP-Core task types enum + */ +typedef enum { + LP_CORE_TASK_WAKEUP_CPU, /*!< LP-Core wake-up task */ + LP_CORE_TASK_MAX, /*!< Maximum number of LP-Core tasks */ +} lp_core_etm_task_type_t; + +#endif //SOC_LP_CORE_SUPPORT_ETM + +#endif //SOC_LP_CORE_SUPPORTED + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in index 4361773ea5..58b38d4fc9 100644 --- a/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in @@ -1486,3 +1486,7 @@ config SOC_CAPS_NO_RESET_BY_ANA_BOD config SOC_LP_CORE_SINGLE_INTERRUPT_VECTOR bool default y + +config SOC_LP_CORE_SUPPORT_ETM + bool + default y diff --git a/components/soc/esp32c6/include/soc/soc_caps.h b/components/soc/esp32c6/include/soc/soc_caps.h index 257529c923..7976d24688 100644 --- a/components/soc/esp32c6/include/soc/soc_caps.h +++ b/components/soc/esp32c6/include/soc/soc_caps.h @@ -591,3 +591,4 @@ /*------------------------------------- ULP CAPS -------------------------------------*/ #define SOC_LP_CORE_SINGLE_INTERRUPT_VECTOR (1) /*!< LP Core interrupts all map to a single entry in vector table */ +#define SOC_LP_CORE_SUPPORT_ETM (1) /*!< LP Core supports ETM */ diff --git a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in index bfe0ed7664..e8453b4e6e 100644 --- a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in @@ -1734,3 +1734,7 @@ config SOC_LCDCAM_CAM_PERIPH_NUM config SOC_LCDCAM_CAM_DATA_WIDTH_MAX int default 16 + +config SOC_LP_CORE_SUPPORT_ETM + bool + default y diff --git a/components/soc/esp32p4/include/soc/soc_caps.h b/components/soc/esp32p4/include/soc/soc_caps.h index 55f3b8565a..e552ad0751 100644 --- a/components/soc/esp32p4/include/soc/soc_caps.h +++ b/components/soc/esp32p4/include/soc/soc_caps.h @@ -684,3 +684,6 @@ #define SOC_LCDCAM_CAM_SUPPORT_RGB_YUV_CONV (1) #define SOC_LCDCAM_CAM_PERIPH_NUM (1U) #define SOC_LCDCAM_CAM_DATA_WIDTH_MAX (16U) + +/*------------------------------------- ULP CAPS -------------------------------------*/ +#define SOC_LP_CORE_SUPPORT_ETM (1) /*!< LP Core supports ETM */ diff --git a/components/ulp/CMakeLists.txt b/components/ulp/CMakeLists.txt index dd159c8a60..24ea46461d 100644 --- a/components/ulp/CMakeLists.txt +++ b/components/ulp/CMakeLists.txt @@ -69,6 +69,10 @@ if(CONFIG_ULP_COPROC_TYPE_LP_CORE) if(CONFIG_SOC_LP_SPI_SUPPORTED) list(APPEND srcs "lp_core/lp_core_spi.c") endif() + + if(CONFIG_SOC_LP_CORE_SUPPORT_ETM) + list(APPEND srcs "lp_core/lp_core_etm.c") + endif() endif() idf_component_register(SRCS ${srcs} diff --git a/components/ulp/lp_core/include/lp_core_etm.h b/components/ulp/lp_core/include/lp_core_etm.h new file mode 100644 index 0000000000..5550906adb --- /dev/null +++ b/components/ulp/lp_core/include/lp_core_etm.h @@ -0,0 +1,60 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "esp_err.h" +#include "esp_etm.h" +#include "hal/lp_core_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief LP-Core ETM event configuration + */ +typedef struct { + lp_core_etm_event_type_t event_type; /*!< LP-Core ETM event type */ +} lp_core_etm_event_config_t; + +/** + * @brief LP-Core ETM task configuration + */ +typedef struct { + lp_core_etm_task_type_t task_type; /*!< LP-Core ETM task type */ +} lp_core_etm_task_config_t; + +/** + * @brief Create a ETM event for LP-Core + * + * @note The created ETM event object can be deleted later by calling `esp_etm_del_event` + * + * @param[in] config LP-Core ETM event configuration + * @param[out] out_event Returned ETM event handle + * @return + * - ESP_OK: Get ETM event successfully + * - ESP_ERR_INVALID_ARG: Get ETM event failed because of invalid argument + * - ESP_FAIL: Get ETM event failed because of other error + */ +esp_err_t lp_core_new_etm_event(const lp_core_etm_event_config_t *config, esp_etm_event_handle_t *out_event); + +/** + * @brief Create a ETM task for LP-Core + * + * @note The created ETM task object can be deleted later by calling `esp_etm_del_task` + * + * @param[in] config LP-Core ETM task configuration + * @param[out] out_task Returned ETM task handle + * @return + * - ESP_OK: Get ETM task successfully + * - ESP_ERR_INVALID_ARG: Get ETM task failed because of invalid argument + * - ESP_FAIL: Get ETM task failed because of other error + */ +esp_err_t lp_core_new_etm_task(const lp_core_etm_task_config_t *config, esp_etm_task_handle_t *out_task); + +#ifdef __cplusplus +} +#endif diff --git a/components/ulp/lp_core/lp_core.c b/components/ulp/lp_core/lp_core.c index e578e077ac..84f6d9c32b 100644 --- a/components/ulp/lp_core/lp_core.c +++ b/components/ulp/lp_core/lp_core.c @@ -126,7 +126,7 @@ esp_err_t ulp_lp_core_run(ulp_lp_core_cfg_t* cfg) } #endif - if (cfg->wakeup_source & (ULP_LP_CORE_WAKEUP_SOURCE_LP_UART | ULP_LP_CORE_WAKEUP_SOURCE_LP_IO | ULP_LP_CORE_WAKEUP_SOURCE_ETM)) { + if (cfg->wakeup_source & (ULP_LP_CORE_WAKEUP_SOURCE_LP_UART | ULP_LP_CORE_WAKEUP_SOURCE_LP_IO)) { ESP_LOGE(TAG, "Wake-up source not yet supported"); return ESP_ERR_INVALID_ARG; } diff --git a/components/ulp/lp_core/lp_core/lp_core_utils.c b/components/ulp/lp_core/lp_core/lp_core_utils.c index bcc84daa47..0eecf4006d 100644 --- a/components/ulp/lp_core/lp_core/lp_core_utils.c +++ b/components/ulp/lp_core/lp_core/lp_core_utils.c @@ -15,6 +15,10 @@ #include "hal/uart_ll.h" #include "hal/rtc_io_ll.h" +#if !CONFIG_IDF_TARGET_ESP32P4 +#include "hal/lp_aon_ll.h" +#endif + #if SOC_ETM_SUPPORTED #include "hal/etm_ll.h" #endif @@ -52,7 +56,11 @@ void ulp_lp_core_update_wakeup_cause(void) if ((lp_core_ll_get_wakeup_source() & LP_CORE_LL_WAKEUP_SOURCE_ETM) \ && etm_ll_is_lpcore_wakeup_triggered()) { lp_wakeup_cause |= LP_CORE_LL_WAKEUP_SOURCE_ETM; - etm_ll_clear_lpcore_wakeup_status(); +#if CONFIG_IDF_TARGET_ESP32P4 + lp_core_ll_clear_etm_wakeup_status(); +#else + lp_aon_ll_clear_lpcore_etm_wakeup_flag(); +#endif } #endif /* SOC_ETM_SUPPORTED */ diff --git a/components/ulp/lp_core/lp_core_etm.c b/components/ulp/lp_core/lp_core_etm.c new file mode 100644 index 0000000000..16be0fc5da --- /dev/null +++ b/components/ulp/lp_core/lp_core_etm.c @@ -0,0 +1,90 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "sdkconfig.h" +#include "lp_core_etm.h" +#include "esp_private/etm_interface.h" +#include "esp_err.h" +#include "esp_check.h" +#include "esp_heap_caps.h" +#include "soc/soc_etm_source.h" + +#define LP_CORE_ETM_EVENT_TABLE(event) \ + (uint32_t [LP_CORE_EVENT_MAX]){ \ + [LP_CORE_EVENT_ERR_INTR] = ULP_EVT_ERR_INTR, \ + [LP_CORE_EVENT_START_INTR] = ULP_EVT_START_INTR, \ + }[event] + +#define LP_CORE_ETM_TASK_TABLE(task) \ + (uint32_t [LP_CORE_TASK_MAX]){ \ + [LP_CORE_TASK_WAKEUP_CPU] = ULP_TASK_WAKEUP_CPU, \ + }[task] + +const static char* TAG = "lp-core-etm"; + +static esp_err_t lp_core_del_etm_event(esp_etm_event_t *event) +{ + free(event); + return ESP_OK; +} + +static esp_err_t lp_core_del_etm_task(esp_etm_task_t *task) +{ + free(task); + return ESP_OK; +} + +esp_err_t lp_core_new_etm_task(const lp_core_etm_task_config_t *config, esp_etm_task_handle_t *out_task) +{ + esp_etm_task_t *task = NULL; + esp_err_t ret = ESP_OK; + ESP_GOTO_ON_FALSE(config && out_task, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); + ESP_GOTO_ON_FALSE(config->task_type < LP_CORE_TASK_MAX, ESP_ERR_INVALID_ARG, err, TAG, "invalid task type"); + task = heap_caps_calloc(1, sizeof(esp_etm_task_t), MALLOC_CAP_DEFAULT); + ESP_GOTO_ON_FALSE(task, ESP_ERR_NO_MEM, err, TAG, "no memory for ETM task"); + + uint32_t task_id = LP_CORE_ETM_TASK_TABLE(config->task_type); + ESP_GOTO_ON_FALSE(task_id != 0, ESP_ERR_NOT_SUPPORTED, err, TAG, "not supported task type"); + + // fill the ETM task object + task->task_id = task_id; + task->trig_periph = ETM_TRIG_PERIPH_LP_CORE; + task->del = lp_core_del_etm_task; + ESP_LOGD(TAG, "new task @%p, task_id=%"PRIu32, task, task_id); + *out_task = task; + return ESP_OK; + +err: + if (task) { + lp_core_del_etm_task(task); + } + return ret; +} + +esp_err_t lp_core_new_etm_event(const lp_core_etm_event_config_t *config, esp_etm_event_handle_t *out_event) +{ + esp_etm_event_t *event = NULL; + esp_err_t ret = ESP_OK; + ESP_GOTO_ON_FALSE(config && out_event, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); + ESP_GOTO_ON_FALSE(config->event_type < LP_CORE_EVENT_MAX, ESP_ERR_INVALID_ARG, err, TAG, "invalid event type"); + event = heap_caps_calloc(1, sizeof(esp_etm_event_t), MALLOC_CAP_DEFAULT); + ESP_GOTO_ON_FALSE(event, ESP_ERR_NO_MEM, err, TAG, "no memory for ETM event"); + + uint32_t event_id = LP_CORE_ETM_EVENT_TABLE(config->event_type); + ESP_GOTO_ON_FALSE(event_id != 0, ESP_ERR_NOT_SUPPORTED, err, TAG, "not supported event type"); + + // fill the ETM event object + event->event_id = event_id; + event->trig_periph = ETM_TRIG_PERIPH_LP_CORE; + event->del = lp_core_del_etm_event; + *out_event = event; + return ESP_OK; + +err: + if (event) { + lp_core_del_etm_event(event); + } + return ret; +} diff --git a/components/ulp/test_apps/lp_core/main/CMakeLists.txt b/components/ulp/test_apps/lp_core/main/CMakeLists.txt index 0e152e7969..5072dec7e3 100644 --- a/components/ulp/test_apps/lp_core/main/CMakeLists.txt +++ b/components/ulp/test_apps/lp_core/main/CMakeLists.txt @@ -8,6 +8,10 @@ if(CONFIG_SOC_LP_SPI_SUPPORTED) list(APPEND app_sources "test_lp_core_spi.c") endif() +if(CONFIG_SOC_LP_CORE_SUPPORT_ETM AND CONFIG_SOC_ETM_SUPPORTED) + list(APPEND app_sources "test_lp_core_etm.c") +endif() + set(lp_core_sources "lp_core/test_main.c") set(lp_core_sources_counter "lp_core/test_main_counter.c") diff --git a/components/ulp/test_apps/lp_core/main/test_lp_core_etm.c b/components/ulp/test_apps/lp_core/main/test_lp_core_etm.c new file mode 100644 index 0000000000..4e640ac0f5 --- /dev/null +++ b/components/ulp/test_apps/lp_core/main/test_lp_core_etm.c @@ -0,0 +1,130 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "lp_core_test_app_counter.h" +#include "ulp_lp_core.h" +#include "test_shared.h" +#include "unity.h" +#include "test_utils.h" +#include "esp_log.h" +#include "driver/gptimer.h" +#include "lp_core_etm.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +extern const uint8_t lp_core_main_counter_bin_start[] asm("_binary_lp_core_test_app_counter_bin_start"); +extern const uint8_t lp_core_main_counter_bin_end[] asm("_binary_lp_core_test_app_counter_bin_end"); + +static void load_and_start_lp_core_firmware(ulp_lp_core_cfg_t* cfg, const uint8_t* firmware_start, const uint8_t* firmware_end) +{ + TEST_ASSERT(ulp_lp_core_load_binary(firmware_start, + (firmware_end - firmware_start)) == ESP_OK); + + TEST_ASSERT(ulp_lp_core_run(cfg) == ESP_OK); + +} + +#define STOP_TEST_ITERATIONS 50 +#define TIMER_PERIOD_MS 10 + +static int timer_cb_count; + +static bool on_gptimer_alarm_cb(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_ctx) +{ + timer_cb_count++; + if (timer_cb_count >= STOP_TEST_ITERATIONS) { + gptimer_stop(timer); + } + return false; +} + +/** + * @brief Test connects ULP wakeup source to a GP timer alarm ETM event. + * At every wakeup the ULP program increments a counter and in the + * end we check that the ULP woke-up the expected number of times. + */ +TEST_CASE("LP core can be woken up by ETM event", "[ulp]") +{ + // GPTimer alarm ---> ETM channel A ---> ULP wake-up + printf("allocate etm channel\r\n"); + esp_etm_channel_config_t etm_config = {}; + esp_etm_channel_handle_t etm_channel_a; + TEST_ESP_OK(esp_etm_new_channel(&etm_config, &etm_channel_a)); + + esp_etm_task_handle_t lp_core_task = NULL; + + lp_core_etm_task_config_t lp_core_task_config = { + .task_type = LP_CORE_TASK_WAKEUP_CPU, + }; + TEST_ESP_OK(lp_core_new_etm_task(&lp_core_task_config, &lp_core_task)); + + printf("create a gptimer\r\n"); + gptimer_handle_t gptimer = NULL; + gptimer_config_t timer_config = { + .clk_src = GPTIMER_CLK_SRC_DEFAULT, + .direction = GPTIMER_COUNT_UP, + .resolution_hz = 1 * 1000 * 1000, // 1MHz, 1 tick = 1us + }; + TEST_ESP_OK(gptimer_new_timer(&timer_config, &gptimer)); + + printf("get gptimer etm event handle\r\n"); + esp_etm_event_handle_t gptimer_event = NULL; + gptimer_etm_event_config_t gptimer_etm_event_conf = { + .event_type = GPTIMER_ETM_EVENT_ALARM_MATCH, + }; + TEST_ESP_OK(gptimer_new_etm_event(gptimer, &gptimer_etm_event_conf, &gptimer_event)); + + printf("connect event and task to the channel\r\n"); + TEST_ESP_OK(esp_etm_channel_connect(etm_channel_a, gptimer_event, lp_core_task)); + + printf("enable etm channel\r\n"); + TEST_ESP_OK(esp_etm_channel_enable(etm_channel_a)); + + printf("set timer alarm action\r\n"); + gptimer_alarm_config_t alarm_config = { + .reload_count = 0, + .alarm_count = TIMER_PERIOD_MS * 1000, // 10ms per alarm event + .flags.auto_reload_on_alarm = true, + }; + TEST_ESP_OK(gptimer_set_alarm_action(gptimer, &alarm_config)); + + printf("register alarm callback\r\n"); + gptimer_event_callbacks_t cbs = { + .on_alarm = on_gptimer_alarm_cb, + }; + TEST_ESP_OK(gptimer_register_event_callbacks(gptimer, &cbs, NULL)); + + /* Load ULP firmware and start the coprocessor */ + ulp_lp_core_cfg_t cfg = { + .wakeup_source = ULP_LP_CORE_WAKEUP_SOURCE_ETM, +#if ESP_ROM_HAS_LP_ROM + .skip_lp_rom_boot = true, +#endif //ESP_ROM_HAS_LP_ROM + }; + + load_and_start_lp_core_firmware(&cfg, lp_core_main_counter_bin_start, lp_core_main_counter_bin_end); + + printf("enable and start timer\r\n"); + TEST_ESP_OK(gptimer_enable(gptimer)); + TEST_ESP_OK(gptimer_start(gptimer)); + + // Wait for more than the expected time for the test to complete + // To ensure that the ULP ran exactly as many times as we expected + vTaskDelay((TIMER_PERIOD_MS * STOP_TEST_ITERATIONS * 2) / portTICK_PERIOD_MS); + + TEST_ASSERT_EQUAL(STOP_TEST_ITERATIONS, timer_cb_count); + TEST_ASSERT_EQUAL(STOP_TEST_ITERATIONS, ulp_counter); + + TEST_ESP_OK(gptimer_disable(gptimer)); + TEST_ESP_OK(gptimer_del_timer(gptimer)); + + TEST_ESP_OK(esp_etm_del_task(lp_core_task)); + TEST_ESP_OK(esp_etm_del_event(gptimer_event)); + TEST_ESP_OK(esp_etm_channel_disable(etm_channel_a)); + TEST_ESP_OK(esp_etm_del_channel(etm_channel_a)); +} diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 4f7e79e3e0..50539c457b 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -264,6 +264,7 @@ INPUT = \ $(PROJECT_PATH)/components/hal/include/hal/uart_types.h \ $(PROJECT_PATH)/components/hal/include/hal/efuse_hal.h \ $(PROJECT_PATH)/components/hal/include/hal/eth_types.h \ + $(PROJECT_PATH)/components/hal/include/hal/lp_core_types.h \ $(PROJECT_PATH)/components/heap/include/esp_heap_caps_init.h \ $(PROJECT_PATH)/components/heap/include/esp_heap_caps.h \ $(PROJECT_PATH)/components/heap/include/esp_heap_trace.h \ diff --git a/docs/doxygen/Doxyfile_esp32c5 b/docs/doxygen/Doxyfile_esp32c5 index 82c15ca68e..faf09ce4a4 100644 --- a/docs/doxygen/Doxyfile_esp32c5 +++ b/docs/doxygen/Doxyfile_esp32c5 @@ -1,4 +1,4 @@ -# TODO: IDF-9197 Use beta3 in doc temprory +# TODO: IDF-9197 Use beta3 in doc temporary INPUT += \ $(PROJECT_PATH)/components/soc/$(IDF_TARGET)/mp/include/soc/soc_caps.h \ $(PROJECT_PATH)/components/soc/$(IDF_TARGET)/mp/include/soc/clk_tree_defs.h \ @@ -6,6 +6,7 @@ INPUT += \ $(PROJECT_PATH)/components/soc/$(IDF_TARGET)/mp/include/soc/uart_channel.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_i2c.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_uart.h \ + $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_etm.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \ diff --git a/docs/doxygen/Doxyfile_esp32c6 b/docs/doxygen/Doxyfile_esp32c6 index ddd75aad3c..cc8eb9578a 100644 --- a/docs/doxygen/Doxyfile_esp32c6 +++ b/docs/doxygen/Doxyfile_esp32c6 @@ -1,6 +1,7 @@ INPUT += \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_i2c.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_uart.h \ + $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_etm.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \ diff --git a/docs/doxygen/Doxyfile_esp32p4 b/docs/doxygen/Doxyfile_esp32p4 index cd1724d538..b219cec328 100644 --- a/docs/doxygen/Doxyfile_esp32p4 +++ b/docs/doxygen/Doxyfile_esp32p4 @@ -2,6 +2,7 @@ INPUT += \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_i2c.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_uart.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_spi.h \ + $(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_etm.h \ $(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \ diff --git a/docs/en/api-reference/system/ulp-lp-core.rst b/docs/en/api-reference/system/ulp-lp-core.rst index 8f8b08efbb..430fe5fa78 100644 --- a/docs/en/api-reference/system/ulp-lp-core.rst +++ b/docs/en/api-reference/system/ulp-lp-core.rst @@ -233,10 +233,16 @@ Main CPU API Reference .. include-build-file:: inc/lp_core_i2c.inc .. include-build-file:: inc/lp_core_uart.inc -.. only:: CONFIG_SOC_LP_SPI_SUPPORTED +.. only:: SOC_LP_SPI_SUPPORTED .. include-build-file:: inc/lp_core_spi.inc +.. only:: SOC_LP_CORE_SUPPORT_ETM + + .. include-build-file:: inc/lp_core_etm.inc + +.. include-build-file:: inc/lp_core_types.inc + LP Core API Reference ~~~~~~~~~~~~~~~~~~~~~~ @@ -247,7 +253,7 @@ LP Core API Reference .. include-build-file:: inc/ulp_lp_core_print.inc .. include-build-file:: inc/ulp_lp_core_interrupts.inc -.. only:: CONFIG_SOC_LP_SPI_SUPPORTED +.. only:: SOC_LP_SPI_SUPPORTED .. include-build-file:: inc/ulp_lp_core_spi.inc diff --git a/docs/zh_CN/api-reference/system/ulp-lp-core.rst b/docs/zh_CN/api-reference/system/ulp-lp-core.rst index 06e805e662..02b5aae14c 100644 --- a/docs/zh_CN/api-reference/system/ulp-lp-core.rst +++ b/docs/zh_CN/api-reference/system/ulp-lp-core.rst @@ -197,10 +197,16 @@ API 参考 .. include-build-file:: inc/lp_core_i2c.inc .. include-build-file:: inc/lp_core_uart.inc -.. only:: CONFIG_SOC_LP_SPI_SUPPORTED +.. only:: SOC_LP_SPI_SUPPORTED .. include-build-file:: inc/lp_core_spi.inc +.. only:: SOC_LP_CORE_SUPPORT_ETM + + .. include-build-file:: inc/lp_core_etm.inc + +.. include-build-file:: inc/lp_core_types.inc + LP 内核 API 参考 ~~~~~~~~~~~~~~~~~~~~~~ @@ -211,7 +217,7 @@ LP 内核 API 参考 .. include-build-file:: inc/ulp_lp_core_print.inc .. include-build-file:: inc/ulp_lp_core_interrupts.inc -.. only:: CONFIG_SOC_LP_SPI_SUPPORTED +.. only:: SOC_LP_SPI_SUPPORTED .. include-build-file:: inc/ulp_lp_core_spi.inc