Skip to content

Commit

Permalink
Remove interrupt disable around flash operations (#5577)
Browse files Browse the repository at this point in the history
All interrupt service routines are supposed to be in IRAM now, so there
is no need to keep interrupts disabled while doing flash operations.
Remove the IRQ disable/enable from the ESP.flash* methods.

Related to #5568
  • Loading branch information
earlephilhower authored Jan 9, 2019
1 parent 187f6a5 commit 9515f46
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,7 @@ bool EspClass::updateSketch(Stream& in, uint32_t size, bool restartOnFail, bool
static const int FLASH_INT_MASK = ((B10 << 8) | B00111010);

bool EspClass::flashEraseSector(uint32_t sector) {
ets_isr_mask(FLASH_INT_MASK);
int rc = spi_flash_erase_sector(sector);
ets_isr_unmask(FLASH_INT_MASK);
return rc == 0;
}

Expand Down Expand Up @@ -622,7 +620,6 @@ static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
#endif

bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) {
ets_isr_mask(FLASH_INT_MASK);
int rc = 0;
#if PUYA_SUPPORT
if (getFlashChipVendorId() == SPI_FLASH_VENDOR_PUYA) {
Expand All @@ -633,14 +630,11 @@ bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) {
{
rc = spi_flash_write(offset, data, size);
}
ets_isr_unmask(FLASH_INT_MASK);
return rc == 0;
}

bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size) {
ets_isr_mask(FLASH_INT_MASK);
int rc = spi_flash_read(offset, (uint32_t*) data, size);
ets_isr_unmask(FLASH_INT_MASK);
return rc == 0;
}

Expand Down

0 comments on commit 9515f46

Please sign in to comment.