From 951ed739f718c9c0415aa719d42443ef459c31c4 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 21 Nov 2019 18:42:46 +0100 Subject: [PATCH] soc/cpu: add non-xtensa-specific replacement of xthal_get_ccount --- components/soc/esp32/include/soc/cpu.h | 9 +++++++++ components/soc/esp32s2beta/include/soc/cpu.h | 9 +++++++++ 2 files changed, 18 insertions(+) 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