1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Remove interrupt disable around flash operations (#5577)

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
This commit is contained in:
Earle F. Philhower, III 2019-01-09 15:03:58 -08:00 committed by GitHub
parent 187f6a58b8
commit 9515f46684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
@ -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) {
@ -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;
}