all devices: add support to (un)protect flash, implement pre/post flash access. Use new spiInterface methods

This commit is contained in:
Gwenhael Goavec-Merou
2021-12-22 19:11:35 +01:00
parent af14e9b518
commit 45f7f72030
18 changed files with 431 additions and 347 deletions
+3 -2
View File
@@ -206,7 +206,7 @@ void Gowin::programFlash()
displayReadReg(readStatusReg());
}
void Gowin::program(unsigned int offset)
void Gowin::program(unsigned int offset, bool unprotect_flash)
{
(void) offset;
@@ -235,7 +235,8 @@ void Gowin::program(unsigned int offset)
wr_rd(0x3D, NULL, 0, NULL, 0);
SPIFlash spiFlash(this, (_verbose ? 1 : (_quiet ? -1 : 0)));
SPIFlash spiFlash(this, unprotect_flash,
(_verbose ? 1 : (_quiet ? -1 : 0)));
spiFlash.reset();
spiFlash.read_id();
spiFlash.display_status_reg(spiFlash.read_status_reg());