Merge branch 'feature/c3_IDF-2554' into 'master'

global: Uses CCOUNT API instead of XTHAL macro

Closes IDF-2554

See merge request espressif/esp-idf!11954
This commit is contained in:
Angus Gratton
2021-01-13 12:55:21 +08:00
27 changed files with 78 additions and 47 deletions

View File

@@ -18,9 +18,9 @@
#include <string.h>
#include <sys/param.h>
#include "esp_attr.h"
#include "hal/cpu_hal.h"
#include "esp32s3/clk.h"
#include "soc/wdev_reg.h"
#include "xtensa/core-macros.h"
uint32_t IRAM_ATTR esp_random(void)
{
@@ -48,7 +48,7 @@ uint32_t IRAM_ATTR esp_random(void)
uint32_t ccount;
uint32_t result = 0;
do {
ccount = XTHAL_GET_CCOUNT();
ccount = cpu_hal_get_cycle_count();
result ^= REG_READ(WDEV_RND_REG);
} while (ccount - last_ccount < cpu_to_apb_freq_ratio * 16);
last_ccount = ccount;