mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/flash_mmap_output_psram_arg_v4.1' into 'release/v4.1'
mmap: fixed the issue mmap cannot be called with pointers to psram (v4.1) See merge request espressif/esp-idf!17700
This commit is contained in:
commit
23c2556ca7
@ -164,6 +164,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)
|
const void** out_ptr, spi_flash_mmap_handle_t* out_handle)
|
||||||
{
|
{
|
||||||
esp_err_t ret;
|
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;
|
bool need_flush = false;
|
||||||
if (!page_count) {
|
if (!page_count) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
@ -219,8 +221,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?
|
// checked all the region(s) and haven't found anything?
|
||||||
if (start == end) {
|
if (start == end) {
|
||||||
*out_handle = 0;
|
|
||||||
*out_ptr = NULL;
|
|
||||||
ret = ESP_ERR_NO_MEM;
|
ret = ESP_ERR_NO_MEM;
|
||||||
} else {
|
} else {
|
||||||
// set up mapping using pages
|
// set up mapping using pages
|
||||||
@ -262,8 +262,8 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp
|
|||||||
new_entry->page = start;
|
new_entry->page = start;
|
||||||
new_entry->count = page_count;
|
new_entry->count = page_count;
|
||||||
new_entry->handle = ++s_mmap_last_handle;
|
new_entry->handle = ++s_mmap_last_handle;
|
||||||
*out_handle = new_entry->handle;
|
temp_handle = new_entry->handle;
|
||||||
*out_ptr = (void*) (region_addr + (start - region_begin) * SPI_FLASH_MMU_PAGE_SIZE);
|
temp_ptr = (void*) (region_addr + (start - region_begin) * SPI_FLASH_MMU_PAGE_SIZE);
|
||||||
ret = ESP_OK;
|
ret = ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,9 +286,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();
|
spi_flash_enable_interrupts_caches_and_other_cpu();
|
||||||
if (*out_ptr == NULL) {
|
if (temp_ptr == NULL) {
|
||||||
free(new_entry);
|
free(new_entry);
|
||||||
}
|
}
|
||||||
|
*out_ptr = temp_ptr;
|
||||||
|
*out_handle = temp_handle;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user