Skip to content

Commit 1c5cade

Browse files
committed
fix(cache): fixed SOC_CACHE_FREEZE_SUPPORTED not defined on c3/c2 issue
1 parent 0fc082d commit 1c5cade

File tree

6 files changed

+64
-2
lines changed

6 files changed

+64
-2
lines changed

components/hal/esp32c2/include/hal/cache_ll.h

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -162,6 +162,32 @@ static inline void cache_ll_invalidate_all(uint32_t cache_level, cache_type_t ty
162162
Cache_Invalidate_ICache_All();
163163
}
164164

165+
/**
166+
* @brief Freeze Cache
167+
*
168+
* @param cache_level level of the cache
169+
* @param type see `cache_type_t`
170+
* @param cache_id id of the cache in this type and level
171+
*/
172+
__attribute__((always_inline))
173+
static inline void cache_ll_freeze_cache(uint32_t cache_level, cache_type_t type, uint32_t cache_id)
174+
{
175+
Cache_Freeze_ICache_Enable(CACHE_FREEZE_ACK_BUSY);
176+
}
177+
178+
/**
179+
* @brief Unfreeze Cache
180+
*
181+
* @param cache_level level of the cache
182+
* @param type see `cache_type_t`
183+
* @param cache_id id of the cache in this type and level
184+
*/
185+
__attribute__((always_inline))
186+
static inline void cache_ll_unfreeze_cache(uint32_t cache_level, cache_type_t type, uint32_t cache_id)
187+
{
188+
Cache_Freeze_ICache_Disable();
189+
}
190+
165191
/**
166192
* @brief Get Cache line size, in bytes
167193
*

components/hal/esp32c3/include/hal/cache_ll.h

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -165,6 +165,32 @@ static inline void cache_ll_invalidate_all(uint32_t cache_level, cache_type_t ty
165165
Cache_Invalidate_ICache_All();
166166
}
167167

168+
/**
169+
* @brief Freeze Cache
170+
*
171+
* @param cache_level level of the cache
172+
* @param type see `cache_type_t`
173+
* @param cache_id id of the cache in this type and level
174+
*/
175+
__attribute__((always_inline))
176+
static inline void cache_ll_freeze_cache(uint32_t cache_level, cache_type_t type, uint32_t cache_id)
177+
{
178+
Cache_Freeze_ICache_Enable(CACHE_FREEZE_ACK_BUSY);
179+
}
180+
181+
/**
182+
* @brief Unfreeze Cache
183+
*
184+
* @param cache_level level of the cache
185+
* @param type see `cache_type_t`
186+
* @param cache_id id of the cache in this type and level
187+
*/
188+
__attribute__((always_inline))
189+
static inline void cache_ll_unfreeze_cache(uint32_t cache_level, cache_type_t type, uint32_t cache_id)
190+
{
191+
Cache_Freeze_ICache_Disable();
192+
}
193+
168194
/**
169195
* @brief Get Cache line size, in bytes
170196
*

components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ config SOC_SHARED_IDCACHE_SUPPORTED
227227
bool
228228
default y
229229

230+
config SOC_CACHE_FREEZE_SUPPORTED
231+
bool
232+
default y
233+
230234
config SOC_CPU_CORES_NUM
231235
int
232236
default 1

components/soc/esp32c2/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393

9494
/*-------------------------- CACHE CAPS --------------------------------------*/
9595
#define SOC_SHARED_IDCACHE_SUPPORTED 1 //Shared Cache for both instructions and data
96+
#define SOC_CACHE_FREEZE_SUPPORTED 1
9697

9798
/*-------------------------- CPU CAPS ----------------------------------------*/
9899
#define SOC_CPU_CORES_NUM (1U)

components/soc/esp32c3/include/soc/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ config SOC_SHARED_IDCACHE_SUPPORTED
315315
bool
316316
default y
317317

318+
config SOC_CACHE_FREEZE_SUPPORTED
319+
bool
320+
default y
321+
318322
config SOC_CACHE_MEMORY_IBANK_SIZE
319323
hex
320324
default 0x4000

components/soc/esp32c3/include/soc/soc_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125

126126
/*-------------------------- CACHE CAPS --------------------------------------*/
127127
#define SOC_SHARED_IDCACHE_SUPPORTED 1 //Shared Cache for both instructions and data
128+
#define SOC_CACHE_FREEZE_SUPPORTED 1
128129
#define SOC_CACHE_MEMORY_IBANK_SIZE 0x4000 // has to be same as the definition in ROM component
129130

130131
/*-------------------------- CPU CAPS ----------------------------------------*/

0 commit comments

Comments
 (0)