mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'feat/cache_preload' into 'master'
cache: preload hal api Closes IDF-7800 See merge request espressif/esp-idf!46106
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -43,6 +43,15 @@ extern "C" {
|
||||
#define CACHE_LL_LEVEL_NUMS 1 //Number of cache levels
|
||||
#define CACHE_LL_L1_ICACHE_AUTOLOAD (1<<2)
|
||||
|
||||
/**
|
||||
* @brief Preload strategy
|
||||
*/
|
||||
typedef enum {
|
||||
CACHE_LL_PRELOAD_UNTIL_FETCH_DONE = 0,
|
||||
CACHE_LL_PRELOAD_AFTER_FETCH = 1,
|
||||
CACHE_LL_PRELOAD_ARBITRARY = 2,
|
||||
} cache_ll_preload_strategy_t;
|
||||
|
||||
/**
|
||||
* @brief Check if Cache auto preload is enabled or not.
|
||||
*
|
||||
@@ -191,6 +200,51 @@ static inline void cache_ll_unfreeze_cache(uint32_t cache_level, cache_type_t ty
|
||||
Cache_Freeze_ICache_Disable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the preload strategy (no-op)
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void cache_ll_preload_set_strategy(uint32_t cache_level, cache_type_t type, uint32_t cache_id, cache_ll_preload_strategy_t strategy)
|
||||
{
|
||||
(void)cache_level;
|
||||
(void)type;
|
||||
(void)cache_id;
|
||||
(void)strategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Preload cache (L1 ICache only)
|
||||
*
|
||||
* Starts preload for the given region and does not wait. Use
|
||||
* cache_ll_preload_wait_done() to wait for completion.
|
||||
* DATA type is no-op.
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void cache_ll_preload(uint32_t cache_level, cache_type_t type, uint32_t cache_id, uint32_t vaddr, uint32_t size, bool ascending)
|
||||
{
|
||||
(void)cache_id;
|
||||
HAL_ASSERT(cache_level == CACHE_LL_LEVEL_EXT_MEM);
|
||||
if (type == CACHE_TYPE_DATA) {
|
||||
return;
|
||||
}
|
||||
Cache_Start_ICache_Preload(vaddr, size, ascending ? 0 : 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait until cache preload is done (L1 only)
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void cache_ll_preload_wait_done(uint32_t cache_level, cache_type_t type, uint32_t cache_id)
|
||||
{
|
||||
(void)cache_id;
|
||||
HAL_ASSERT(cache_level == CACHE_LL_LEVEL_EXT_MEM);
|
||||
if (type == CACHE_TYPE_DATA) {
|
||||
return;
|
||||
}
|
||||
while (Cache_ICache_Preload_Done() == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Cache line size, in bytes
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user