pub unsafe extern "C" fn spi_flash_phys2cache(
    phys_offs: usize,
    memory: spi_flash_mmap_memory_t
) -> *const c_void
Expand description

@brief Given a physical offset in flash, return the address where it is mapped in the memory space.

Physical address does not have to have been assigned via spi_flash_mmap(), any address in flash can be looked up.

@note Only the first matching cache address is returned. If MMU flash cache table is configured so multiple entries point to the same physical address, there may be more than one cache address corresponding to that physical address. It is also possible for a single physical address to be mapped to both the IROM and DROM regions.

@note This function doesn’t impose any alignment constraints, but if memory argument is SPI_FLASH_MMAP_INST and phys_offs is not 4-byte aligned, then reading from the returned pointer will result in a crash.

@param phys_offs Physical offset in flash memory to look up. @param memory Address space type to look up a flash cache address mapping for (instruction or data)

@return

  • NULL if the physical address is invalid or not mapped to flash cache of the specified memory type.
  • Cached memory address (in IROM or DROM space) corresponding to phys_offs.