fix(cache): fixed l2 cache suspended/frozen but l1cache triggers l2 writeback issue

This commit is contained in:
armando
2025-04-07 11:37:40 +08:00
parent 0d11e40920
commit b67b1160e7
4 changed files with 85 additions and 10 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <stdint.h>
#include "soc/soc_caps.h"
#include "esp_err.h"
#include "esp_bit_defs.h"
#include "esp_heap_caps.h"
@@ -15,6 +16,45 @@
extern "C" {
#endif
/**
* @brief Suspend external memory cache
*
* @note CPU branch predictor should be disabled before calling this API
* @note This API is only for internal usage, no thread safety guaranteed
* @note This API is Non-Nestable and Non-Reentrant
* @note Call to this API must be followed by a `esp_cache_resume_ext_mem_cache`
*/
void esp_cache_suspend_ext_mem_cache(void);
/**
* @brief Resume external memory cache
*
* @note This API is only for internal usage, no thread safety guaranteed
* @note This API is Non-Nestable and Non-Reentrant
* @note This API must be called after a `esp_cache_suspend_ext_mem_cache`
*/
void esp_cache_resume_ext_mem_cache(void);
#if SOC_CACHE_FREEZE_SUPPORTED
/**
* @brief Freeze external memory cache
*
* @note This API is only for internal usage, no thread safety guaranteed
* @note This API is Non-Nestable and Non-Reentrant
* @note Call to this API must be followed by a `esp_cache_unfreeze_ext_mem_cache`
*/
void esp_cache_freeze_ext_mem_cache(void);
/**
* @brief Unfreeze external memory cache
*
* @note This API is only for internal usage, no thread safety guaranteed
* @note This API is Non-Nestable and Non-Reentrant
* @note This API must be called after a `esp_cache_freeze_ext_mem_cache`
*/
void esp_cache_unfreeze_ext_mem_cache(void);
#endif
/**
* @brief Helper function for malloc a cache aligned data memory buffer
*