Select one of the symbols to view example projects that use it.
 
Outline
#include "esp_attr.h"
#include "esp_sleep.h"
#include "esp_private/pm_trace.h"
#include "driver/gpio.h"
#include "soc/soc.h"
#include "soc/gpio_reg.h"
s_trace_io
esp_pm_trace_init()
esp_pm_trace_enter(esp_pm_trace_event_t, int)
esp_pm_trace_exit(esp_pm_trace_event_t, int)
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_pm/pm_trace.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include "esp_attr.h" #include "esp_sleep.h" #include "esp_private/pm_trace.h" #include "driver/gpio.h" #include "soc/soc.h" #include "soc/gpio_reg.h"6 includes /* GPIOs to use for tracing of esp_pm events. * Two entries in the array for each type, one for each CPU. * Feel free to change when debugging. *//* ... */ static const int DRAM_ATTR s_trace_io[] = { #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 BIT(4), BIT(5), // ESP_PM_TRACE_IDLE BIT(16), BIT(17), // ESP_PM_TRACE_TICK BIT(18), BIT(18), // ESP_PM_TRACE_FREQ_SWITCH BIT(19), BIT(19), // ESP_PM_TRACE_CCOMPARE_UPDATE BIT(25), BIT(26), // ESP_PM_TRACE_ISR_HOOK BIT(27), BIT(27), // ESP_PM_TRACE_SLEEP/* ... */ #elif CONFIG_IDF_TARGET_ESP32S3 BIT(4), BIT(5), // ESP_PM_TRACE_IDLE BIT(6), BIT(7), // ESP_PM_TRACE_TICK BIT(14), BIT(14), // ESP_PM_TRACE_FREQ_SWITCH BIT(15), BIT(15), // ESP_PM_TRACE_CCOMPARE_UPDATE BIT(16), BIT(17), // ESP_PM_TRACE_ISR_HOOK BIT(18), BIT(18), // ESP_PM_TRACE_SLEEP/* ... */ #elif CONFIG_IDF_TARGET_ESP32H2 BIT(2), BIT(3), // ESP_PM_TRACE_IDLE BIT(4), BIT(5), // ESP_PM_TRACE_TICK BIT(6), BIT(6), // ESP_PM_TRACE_FREQ_SWITCH BIT(7), BIT(7), // ESP_PM_TRACE_CCOMPARE_UPDATE BIT(8), BIT(9), // ESP_PM_TRACE_ISR_HOOK BIT(10), BIT(10), // ESP_PM_TRACE_SLEEP/* ... */ #else BIT(2), BIT(3), // ESP_PM_TRACE_IDLE BIT(4), BIT(5), // ESP_PM_TRACE_TICK BIT(6), BIT(6), // ESP_PM_TRACE_FREQ_SWITCH BIT(7), BIT(7), // ESP_PM_TRACE_CCOMPARE_UPDATE BIT(8), BIT(9), // ESP_PM_TRACE_ISR_HOOK BIT(18), BIT(18), // ESP_PM_TRACE_SLEEP/* ... */ #endif }{...}; void esp_pm_trace_init(void) { for (size_t i = 0; i < sizeof(s_trace_io) / sizeof(s_trace_io[0]); ++i) { int io = __builtin_ffs(s_trace_io[i]); if (io == 0) { continue; }{...} gpio_set_direction(io - 1, GPIO_MODE_OUTPUT); }{...} #if SOC_PM_SUPPORT_RTC_PERIPH_PD /* to force tracing GPIOs to keep state */ esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);/* ... */ #endif }{ ... } void IRAM_ATTR esp_pm_trace_enter(esp_pm_trace_event_t event, int core_id) { REG_WRITE(GPIO_OUT_W1TS_REG, s_trace_io[2 * event + core_id]); }{ ... } void IRAM_ATTR esp_pm_trace_exit(esp_pm_trace_event_t event, int core_id) { REG_WRITE(GPIO_OUT_W1TC_REG, s_trace_io[2 * event + core_id]); }{ ... }
Details