stm32/flashbdev: Protect flash writes from cache flushing and USB MSC.

pull/4133/head
Damien George 2018-09-12 15:58:42 +10:00
rodzic 0941a467e7
commit 6b3d6da74b
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -265,8 +265,10 @@ bool flash_bdev_writeblock(const uint8_t *src, uint32_t block) {
// bad block number
return false;
}
uint32_t basepri = raise_irq_pri(IRQ_PRI_FLASH); // prevent cache flushing and USB access
uint8_t *dest = flash_cache_get_addr_for_write(flash_addr);
memcpy(dest, src, FLASH_BLOCK_SIZE);
restore_irq_pri(basepri);
return true;
}