Function esp_idf_svc::sys::spi_flash_mmap

source ยท
pub unsafe extern "C" fn spi_flash_mmap(
    src_addr: usize,
    size: usize,
    memory: u32,
    out_ptr: *mut *const c_void,
    out_handle: *mut u32,
) -> i32
Expand description

@brief Map region of flash memory into data or instruction address space

This function allocates sufficient number of 64kB MMU pages and configures them to map the requested region of flash memory into the address space. It may reuse MMU pages which already provide the required mapping.

As with any allocator, if mmap/munmap are heavily used then the address space may become fragmented. To troubleshoot issues with page allocation, use spi_flash_mmap_dump() function.

@param src_addr Physical address in flash where requested region starts. This address must be aligned to 64kB boundary (SPI_FLASH_MMU_PAGE_SIZE) @param size Size of region to be mapped. This size will be rounded up to a 64kB boundary @param memory Address space where the region should be mapped (data or instruction) @param[out] out_ptr Output, pointer to the mapped memory region @param[out] out_handle Output, handle which should be used for spi_flash_munmap call

@return ESP_OK on success, ESP_ERR_NO_MEM if pages can not be allocated