feat(cache): support cache driver on esp32p4

This commit is contained in:
Armando
2023-09-14 12:14:08 +08:00
parent 83aedb202f
commit ea38a2e9a4
38 changed files with 1929 additions and 541 deletions

View File

@@ -341,7 +341,7 @@ void IRAM_ATTR do_multicore_settings(void)
cache_bus_mask_t cache_bus_mask_core0 = cache_ll_l1_get_enabled_bus(0);
#ifndef CONFIG_IDF_TARGET_ESP32
// 1. disable the cache before changing its settings.
cache_hal_disable(CACHE_TYPE_ALL);
cache_hal_disable(CACHE_TYPE_ALL, CACHE_LL_LEVEL_EXT_MEM);
#endif
for (unsigned core = 1; core < SOC_CPU_CORES_NUM; core++) {
// 2. change cache settings. All cores must have the same settings.
@@ -349,7 +349,7 @@ void IRAM_ATTR do_multicore_settings(void)
}
#ifndef CONFIG_IDF_TARGET_ESP32
// 3. enable the cache after changing its settings.
cache_hal_enable(CACHE_TYPE_ALL);
cache_hal_enable(CACHE_TYPE_ALL, CACHE_LL_LEVEL_EXT_MEM);
#endif
}
#endif //#if !CONFIG_IDF_TARGET_ESP32P4
@@ -496,7 +496,7 @@ void IRAM_ATTR call_start_cpu0(void)
#endif // CONFIG_IDF_TARGET_ESP32S3
#if CONFIG_IDF_TARGET_ESP32P4
//TODO: IDF-7516, add cache init API
//TODO: IDF-5670, add cache init API
extern void esp_config_l2_cache_mode(void);
esp_config_l2_cache_mode();
#endif

View File

@@ -1,43 +1,47 @@
menu "Cache config"
choice ESP32P4_L2_CACHE_SIZE
choice CACHE_L2_CACHE_SIZE
prompt "L2 cache size"
default ESP32P4_L2_CACHE_128KB
default CACHE_L2_CACHE_128KB
help
L2 cache size to be set on application startup.
config ESP32P4_L2_CACHE_128KB
config CACHE_L2_CACHE_128KB
bool "128KB"
config ESP32P4_L2_CACHE_256KB
config CACHE_L2_CACHE_256KB
bool "256KB"
config ESP32P4_L2_CACHE_512KB
config CACHE_L2_CACHE_512KB
bool "512KB"
endchoice
config ESP32P4_L2_CACHE_SIZE
config CACHE_L2_CACHE_SIZE
hex
default 0x20000 if ESP32P4_L2_CACHE_128KB
default 0x40000 if ESP32P4_L2_CACHE_256KB
default 0x80000 if ESP32P4_L2_CACHE_512KB
default 0x20000 if CACHE_L2_CACHE_128KB
default 0x40000 if CACHE_L2_CACHE_256KB
default 0x80000 if CACHE_L2_CACHE_512KB
choice ESP32P4_L2_CACHE_LINE_SIZE
choice CACHE_L2_CACHE_LINE_SIZE
prompt "L2 cache line size"
default ESP32P4_L2_CACHE_LINE_64B if ESP32P4_L2_CACHE_128KB
default ESP32P4_L2_CACHE_LINE_64B if ESP32P4_L2_CACHE_256KB
default ESP32P4_L2_CACHE_LINE_128B if ESP32P4_L2_CACHE_512KB
default CACHE_L2_CACHE_LINE_64B if CACHE_L2_CACHE_128KB
default CACHE_L2_CACHE_LINE_64B if CACHE_L2_CACHE_256KB
default CACHE_L2_CACHE_LINE_128B if CACHE_L2_CACHE_512KB
help
L2 cache line size to be set on application startup.
config ESP32P4_L2_CACHE_LINE_64B
config CACHE_L2_CACHE_LINE_64B
bool "64 Bytes"
depends on ESP32P4_L2_CACHE_128KB || ESP32P4_L2_CACHE_256KB
config ESP32P4_L2_CACHE_LINE_128B
depends on CACHE_L2_CACHE_128KB || CACHE_L2_CACHE_256KB
config CACHE_L2_CACHE_LINE_128B
bool "128 Bytes"
endchoice
config ESP32P4_L2_CACHE_LINE_SIZE
config CACHE_L2_CACHE_LINE_SIZE
int
default 64 if ESP32P4_L2_CACHE_LINE_64B
default 128 if ESP32P4_L2_CACHE_LINE_128B
default 64 if CACHE_L2_CACHE_LINE_64B
default 128 if CACHE_L2_CACHE_LINE_128B
config CACHE_L1_CACHE_LINE_SIZE
int
default 64
endmenu # Cache config