From: Ivan Grokhotkov Date: Mon, 18 Sep 2017 09:26:59 +0000 (+0800) Subject: spi_flash_cache_enabled: report correct result in single core mode X-Git-Tag: v3.1-dev~148^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee99bdfbad19170ecd7311d1faef687bd4f3f830;p=esp-idf spi_flash_cache_enabled: report correct result in single core mode --- diff --git a/components/spi_flash/cache_utils.c b/components/spi_flash/cache_utils.c index 6da7b47e1b..53a0caf8ee 100644 --- a/components/spi_flash/cache_utils.c +++ b/components/spi_flash/cache_utils.c @@ -287,6 +287,9 @@ static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_sta IRAM_ATTR bool spi_flash_cache_enabled() { - return DPORT_REG_GET_BIT(DPORT_PRO_CACHE_CTRL_REG, DPORT_PRO_CACHE_ENABLE) - && DPORT_REG_GET_BIT(DPORT_APP_CACHE_CTRL_REG, DPORT_APP_CACHE_ENABLE); + bool result = (DPORT_REG_GET_BIT(DPORT_PRO_CACHE_CTRL_REG, DPORT_PRO_CACHE_ENABLE) != 0); +#if portNUM_PROCESSORS == 2 + result = result && (DPORT_REG_GET_BIT(DPORT_APP_CACHE_CTRL_REG, DPORT_APP_CACHE_ENABLE) != 0); +#endif + return result; }