mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
spi_flash_test: workaround for broken ROM API after new API calls.
This commit is contained in:
parent
8337f0afa2
commit
d48c4e1da7
@ -69,6 +69,26 @@ static int cmp_or_dump(const void *a, const void *b, size_t len)
|
||||
return r;
|
||||
}
|
||||
|
||||
static void IRAM_ATTR fix_rom_func(void)
|
||||
{
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||
esp_rom_spiflash_read_mode_t read_mode;
|
||||
# if defined CONFIG_ESPTOOLPY_FLASHMODE_QIO
|
||||
read_mode = ESP_ROM_SPIFLASH_QIO_MODE;
|
||||
# elif defined CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
read_mode = ESP_ROM_SPIFLASH_QOUT_MODE;
|
||||
# elif defined CONFIG_ESPTOOLPY_FLASHMODE_DIO
|
||||
read_mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
# elif defined CONFIG_ESPTOOLPY_FLASHMODE_DOUT
|
||||
read_mode = ESP_ROM_SPIFLASH_DOUT_MODE;
|
||||
# endif
|
||||
//Currently only call this can fix the rom_read issue, maybe we need to call more functions (freq, dummy, etc) in the future
|
||||
spi_flash_disable_interrupts_caches_and_other_cpu();
|
||||
esp_rom_spiflash_config_readmode(read_mode);
|
||||
spi_flash_enable_interrupts_caches_and_other_cpu();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void IRAM_ATTR test_read(int src_off, int dst_off, int len)
|
||||
{
|
||||
uint32_t src_buf[16];
|
||||
@ -161,6 +181,8 @@ static void IRAM_ATTR test_write(int dst_off, int src_off, int len)
|
||||
}
|
||||
ESP_ERROR_CHECK(spi_flash_write(start + dst_off, src_buf + src_off, len));
|
||||
|
||||
fix_rom_func();
|
||||
|
||||
spi_flash_disable_interrupts_caches_and_other_cpu();
|
||||
esp_rom_spiflash_result_t rc = esp_rom_spiflash_read(start, dst_buf, sizeof(dst_buf));
|
||||
spi_flash_enable_interrupts_caches_and_other_cpu();
|
||||
|
Loading…
x
Reference in New Issue
Block a user