Use cpu_hal_get_cycle_count for all chips

This commit is contained in:
me-no-dev 2021-04-19 14:25:09 +03:00
parent 55b8f67d80
commit 82161bebe3

View File

@ -22,9 +22,7 @@
#include <Arduino.h> #include <Arduino.h>
#include <esp_partition.h> #include <esp_partition.h>
#ifndef CONFIG_IDF_TARGET_ESP32 // Broken in IDF 20210417 #include <hal/cpu_hal.h>
#include <hal/systimer_hal.h>
#endif
/** /**
* AVR macros for WDT managment * AVR macros for WDT managment
@ -113,13 +111,7 @@ public:
uint32_t ARDUINO_ISR_ATTR EspClass::getCycleCount() uint32_t ARDUINO_ISR_ATTR EspClass::getCycleCount()
{ {
uint32_t ccount; return cpu_hal_get_cycle_count();
#ifdef CONFIG_IDF_TARGET_ESP32
__asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
#else // This should work on ESP32 once the hal is complete
ccount = systimer_hal_get_counter_value(SYSTIMER_COUNTER_0);
#endif
return ccount;
} }
extern EspClass ESP; extern EspClass ESP;