From cbd2bd6506628a46d050dbd9d21c89e4329bfe0c Mon Sep 17 00:00:00 2001 From: "Deomid \"rojer\" Ryabkov" Date: Tue, 15 Jun 2021 23:46:47 +0100 Subject: [PATCH] Revert "ESP8266: Disable interrupts while reading/writing flash" This reverts commit 83c092925464ae4d98759f7cce4ab2889472b0fc. Not needed after all --- src/esp8266/esp_vfs_dev_sysflash.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/esp8266/esp_vfs_dev_sysflash.c b/src/esp8266/esp_vfs_dev_sysflash.c index fd9e669..52e8c5e 100644 --- a/src/esp8266/esp_vfs_dev_sysflash.c +++ b/src/esp8266/esp_vfs_dev_sysflash.c @@ -46,9 +46,8 @@ static enum mgos_vfs_dev_err esp_spi_flash_readwrite_128(size_t addr, uint32_t aligned_addr = addr & (-FLASH_UNIT_SIZE); size_t aligned_size = ((size + (FLASH_UNIT_SIZE - 1)) & -FLASH_UNIT_SIZE) + FLASH_UNIT_SIZE; - mgos_ints_disable(); + int sres = spi_flash_read(aligned_addr, (uint32 *) tmp_buf, aligned_size); - mgos_ints_enable(); if (sres != 0) { LOG(LL_ERROR, ("spi_flash_read failed: %d (%d, %d)", sres, (int) aligned_addr, (int) aligned_size)); @@ -62,9 +61,7 @@ static enum mgos_vfs_dev_err esp_spi_flash_readwrite_128(size_t addr, memcpy(((uint8_t *) tmp_buf) + (addr - aligned_addr), data, size); - mgos_ints_disable(); sres = spi_flash_write(aligned_addr, (uint32 *) tmp_buf, aligned_size); - mgos_ints_enable(); if (sres != 0) { LOG(LL_ERROR, ("spi_flash_write failed: %d (%d, %d)", sres, (int) aligned_addr, (int) aligned_size)); @@ -118,10 +115,7 @@ static enum mgos_vfs_dev_err esp_vfs_dev_sysflash_erase( } u32_t sector = (offset / FLASH_SECTOR_SIZE); while (sector * FLASH_SECTOR_SIZE < offset + len) { - mgos_ints_disable(); - int ret = spi_flash_erase_sector(sector); - mgos_ints_enable(); - if (ret != SPI_FLASH_RESULT_OK) { + if (spi_flash_erase_sector(sector) != SPI_FLASH_RESULT_OK) { res = MGOS_VFS_DEV_ERR_IO; goto out; }