kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/flash_mmap_output_psram_arg' into 'master'
mmap: fixed the issue mmap cannot be called with pointers to psram See merge request espressif/esp-idf!11537pull/6365/head
commit
4d9df27c2f
|
@ -157,6 +157,8 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp
|
|||
const void** out_ptr, spi_flash_mmap_handle_t* out_handle)
|
||||
{
|
||||
esp_err_t ret;
|
||||
const void* temp_ptr = *out_ptr = NULL;
|
||||
spi_flash_mmap_handle_t temp_handle = *out_handle = (spi_flash_mmap_handle_t)NULL;
|
||||
bool need_flush = false;
|
||||
if (!page_count) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
|
@ -212,8 +214,6 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp
|
|||
}
|
||||
// checked all the region(s) and haven't found anything?
|
||||
if (start == end) {
|
||||
*out_handle = 0;
|
||||
*out_ptr = NULL;
|
||||
ret = ESP_ERR_NO_MEM;
|
||||
} else {
|
||||
// set up mapping using pages
|
||||
|
@ -255,8 +255,8 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp
|
|||
new_entry->page = start;
|
||||
new_entry->count = page_count;
|
||||
new_entry->handle = ++s_mmap_last_handle;
|
||||
*out_handle = new_entry->handle;
|
||||
*out_ptr = (void*) (region_addr + (start - region_begin) * SPI_FLASH_MMU_PAGE_SIZE);
|
||||
temp_handle = new_entry->handle;
|
||||
temp_ptr = (void*) (region_addr + (start - region_begin) * SPI_FLASH_MMU_PAGE_SIZE);
|
||||
ret = ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -279,9 +279,11 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp
|
|||
}
|
||||
|
||||
spi_flash_enable_interrupts_caches_and_other_cpu();
|
||||
if (*out_ptr == NULL) {
|
||||
if (temp_ptr == NULL) {
|
||||
free(new_entry);
|
||||
}
|
||||
*out_ptr = temp_ptr;
|
||||
*out_handle = temp_handle;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue