diff --git a/components/soc/esp32/include/soc/cpu.h b/components/soc/esp32/include/soc/cpu.h index 57ccd6e17..5e1eca273 100644 --- a/components/soc/esp32/include/soc/cpu.h +++ b/components/soc/esp32/include/soc/cpu.h @@ -131,4 +131,13 @@ static inline uint32_t esp_cpu_process_stack_pc(uint32_t pc) return pc - 3; } +typedef uint32_t esp_cpu_ccount_t; + +static inline esp_cpu_ccount_t esp_cpu_get_ccount(void) +{ + uint32_t result; + RSR(CCOUNT, result); + return result; +} + #endif diff --git a/components/soc/esp32s2beta/include/soc/cpu.h b/components/soc/esp32s2beta/include/soc/cpu.h index fdde8c91a..420350cdb 100644 --- a/components/soc/esp32s2beta/include/soc/cpu.h +++ b/components/soc/esp32s2beta/include/soc/cpu.h @@ -129,4 +129,13 @@ static inline uint32_t esp_cpu_process_stack_pc(uint32_t pc) return pc - 3; } +typedef uint32_t esp_cpu_ccount_t; + +static inline esp_cpu_ccount_t esp_cpu_get_ccount(void) +{ + uint32_t result; + RSR(CCOUNT, result); + return result; +} + #endif