esp_mmu_map() function
Map a physical memory block to external virtual address block, with given capabilities.
Arguments
paddr_start
Start address of the physical memory block
size
Size to be mapped. Size will be rounded up by to the nearest multiple of MMU page size
target
Physical memory target you're going to map to, see `mmu_target_t`
caps
Memory capabilities, see `mmu_mem_caps_t`
out_ptr
Start address of the mapped virtual memory
Return value
- ESP_OK - ESP_ERR_INVALID_ARG: Invalid argument, see printed logs - ESP_ERR_NOT_SUPPORTED: Only on ESP32, PSRAM is not a supported physical memory target - ESP_ERR_NOT_FOUND: No enough size free block to use - ESP_ERR_NO_MEM: Out of memory, this API will allocate some heap memory for internal usage - ESP_ERR_INVALID_STATE: Paddr is mapped already, this API will return corresponding `vaddr_start + new_block_offset` as per the previously mapped block. Only to-be-mapped paddr block is totally enclosed by a previously mapped block will lead to this error. (Identical scenario will behave similarly) new_block_start new_block_end |-------- New Block --------| |--------------- Block ---------------| block_start block_end
Notes
This API does not guarantee thread safety
esp_mmu_map() is called by 2 functions and calls 13 functions:
![]()
esp_mmu_map()
esp_mmu_map() reads 23 variables and writes 10 variables:
![]()
esp_mmu_map()
esp_mmu_map() allocates 1 types:
![]()
esp_mmu_map()