1 // Copyright 2020 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #ifndef __MMU_H__ 15 #define __MMU_H__ 16 17 #pragma once 18 19 #include <stdint.h> 20 #include "soc/dport_reg.h" 21 #include "soc/soc.h" 22 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif /* __cplusplus */ 27 28 /* Defined for flash mmap */ 29 #define SOC_MMU_REGIONS_COUNT 4 30 #define SOC_MMU_PAGES_PER_REGION 64 31 #define SOC_MMU_IROM0_PAGES_START 64 32 #define SOC_MMU_IROM0_PAGES_END 256 33 #define SOC_MMU_DROM0_PAGES_START 0 34 #define SOC_MMU_DROM0_PAGES_END 64 35 #define SOC_MMU_INVALID_ENTRY_VAL DPORT_FLASH_MMU_TABLE_INVALID_VAL 36 #define SOC_MMU_ADDR_MASK DPORT_MMU_ADDRESS_MASK 37 #define SOC_MMU_PAGE_IN_FLASH(page) (page) 38 #define SOC_MMU_DPORT_PRO_FLASH_MMU_TABLE ((volatile uint32_t*) 0x3FF10000) 39 #define SOC_MMU_VADDR1_START_ADDR SOC_IROM_MASK_LOW 40 #define SOC_MMU_PRO_IRAM0_FIRST_USABLE_PAGE ((SOC_MMU_VADDR1_FIRST_USABLE_ADDR - SOC_MMU_VADDR1_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + SOC_MMU_IROM0_PAGES_START) 41 #define SOC_MMU_VADDR0_START_ADDR SOC_DROM_LOW 42 #define SOC_MMU_VADDR1_FIRST_USABLE_ADDR SOC_IROM_LOW 43 44 45 #ifdef __cplusplus 46 } 47 #endif /* __cplusplus */ 48 #endif /* __MMU_H__ */