Skip to content

Commit

Permalink
change(mmu): improve mmu_ll_entry_id_to_paddr_base on p4
Browse files Browse the repository at this point in the history
  • Loading branch information
Icarus113 committed Sep 8, 2023
1 parent a1c0d9c commit 956c947
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/hal/esp32p4/include/hal/mmu_ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ static inline uint32_t mmu_ll_entry_id_to_paddr_base(uint32_t mmu_id, uint32_t e
{
HAL_ASSERT(entry_id < SOC_MMU_ENTRY_NUM);

uint32_t paddr_base = 0;
mmu_page_size_t page_size = mmu_ll_get_page_size(mmu_id);
uint32_t shift_code = 0;
switch (page_size) {
Expand All @@ -432,13 +433,15 @@ static inline uint32_t mmu_ll_entry_id_to_paddr_base(uint32_t mmu_id, uint32_t e
}
if (mmu_id == MMU_LL_FLASH_MMU_ID) {
REG_WRITE(SPI_MEM_C_MMU_ITEM_INDEX_REG, entry_id);
return (REG_READ(SPI_MEM_C_MMU_ITEM_CONTENT_REG) & SOC_MMU_FLASH_VALID_VAL_MASK) << shift_code;
paddr_base = (REG_READ(SPI_MEM_C_MMU_ITEM_CONTENT_REG) & SOC_MMU_FLASH_VALID_VAL_MASK) << shift_code;
} else if (mmu_id == MMU_LL_PSRAM_MMU_ID) {
REG_WRITE(SPI_MEM_S_MMU_ITEM_INDEX_REG, entry_id);
return (REG_READ(SPI_MEM_S_MMU_ITEM_CONTENT_REG) & SOC_MMU_PSRAM_VALID_VAL_MASK) << shift_code;
paddr_base = (REG_READ(SPI_MEM_S_MMU_ITEM_CONTENT_REG) & SOC_MMU_PSRAM_VALID_VAL_MASK) << shift_code;
} else {
HAL_ASSERT(false);
}

return paddr_base;
}

/**
Expand Down

0 comments on commit 956c947

Please sign in to comment.