Skip to content

Commit

Permalink
Revert "ESP8266: Disable interrupts while reading/writing flash"
Browse files Browse the repository at this point in the history
This reverts commit 83c0929.

Not needed after all
  • Loading branch information
rojer committed Jun 15, 2021
1 parent 83c0929 commit cbd2bd6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/esp8266/esp_vfs_dev_sysflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit cbd2bd6

Please sign in to comment.