refactor(hal): extract cache && mmu HAL into esp_hal_cache

This commit is contained in:
morris
2026-09-16 21:40:16 +08:00
parent e492079576
commit 193fca5b95
111 changed files with 226 additions and 285 deletions
@@ -10,12 +10,25 @@
#include "soc/hwcrypto_reg.h"
#include "hal/sha_types.h"
#include "soc/dport_reg.h"
#include "hal/mmu_ll.h"
#include "soc/ext_mem_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Check if the external memory vaddr belongs to the DPORT bus region
*
* @param vaddr start of the virtual address
*
* @return True for valid
*/
__attribute__((always_inline))
static inline bool _vaddr_in_dport_bus_region(uint32_t vaddr)
{
return (vaddr >= SOC_DPORT_CACHE_ADDRESS_LOW && vaddr < SOC_DPORT_CACHE_ADDRESS_HIGH);
}
/**
* @brief Enable the bus clock for SHA peripheral module
*
@@ -158,7 +171,7 @@ static inline void sha_ll_fill_text_block(const void *input_text, size_t block_w
* Thus, when accessing data from these addresses we need to ensure
* the operations are word-aligned.
*/
if (mmu_ll_vaddr_in_dport_bus_region((uint32_t)input_text)) {
if (_vaddr_in_dport_bus_region((uint32_t)input_text)) {
force_word_aligned_access = true;
}