feat(etm): add ETM LL and GPIO ETM support on esp32s31

Enable ETM caps and add S31 ETM/GPIO LL and retention support for
GPTimer ETM builds.
This commit is contained in:
morris
2026-04-07 14:47:36 +08:00
parent 953c40c9aa
commit 43bc8c2fe5
56 changed files with 754 additions and 1268 deletions
+10
View File
@@ -113,6 +113,7 @@ static etm_group_t *etm_acquire_group_handle(int group_id)
PERIPH_RCC_ATOMIC() {
etm_ll_enable_bus_clock(group_id, true);
etm_ll_reset_register(group_id);
etm_ll_enable_function_clock(group_id, true);
}
#if ETM_USE_RETENTION_LINK
@@ -257,6 +258,15 @@ esp_err_t esp_etm_new_channel(const esp_etm_channel_config_t *config, esp_etm_ch
int group_id = group->group_id;
int chan_id = chan->chan_id;
#if ETM_LL_SUPPORT(CLOCK_SRC)
// set the clock source for the ETM group
etm_clock_source_t clk_src = config->clk_src;
if (clk_src == 0) {
clk_src = ETM_CLK_SRC_DEFAULT;
}
etm_ll_set_clock_source(group_id, clk_src);
#endif
// set the initial state to INIT
atomic_init(&chan->fsm, ETM_CHAN_FSM_INIT);
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <stdio.h>
#include "esp_err.h"
#include "hal/etm_types.h"
#ifdef __cplusplus
extern "C" {
@@ -32,6 +33,7 @@ typedef struct esp_etm_task_t *esp_etm_task_handle_t;
* @brief ETM channel configuration
*/
typedef struct {
etm_clock_source_t clk_src; /*!< Clock source for the ETM channel */
/// Extra configuration flags for ETM channel
struct etm_chan_flags {
uint32_t allow_pd : 1; /*!< If set, driver allows the power domain to be powered off when system enters sleep mode.