gowin: avoid multiple status register access

This commit is contained in:
Gwenhael Goavec-Merou 2023-12-04 07:05:40 +01:00
parent 01d6244a0f
commit 0dcd851187
1 changed files with 7 additions and 4 deletions

View File

@ -657,9 +657,10 @@ bool Gowin::writeSRAM(const uint8_t *data, int length)
send_command(CONFIG_DISABLE); // config disable
send_command(NOOP); // noop
uint32_t status_reg = readStatusReg();
if (_verbose)
displayReadReg("after write sram", readStatusReg());
if (readStatusReg() & STATUS_DONE_FINAL) {
displayReadReg("after write sram", status_reg);
if (status_reg & STATUS_DONE_FINAL) {
printSuccess("DONE");
return true;
} else {
@ -780,9 +781,11 @@ bool Gowin::eraseSRAM()
printError("FAIL");
return false;
}
uint32_t status_reg = readStatusReg();
if (_verbose)
displayReadReg("after erase sram", readStatusReg());
if (readStatusReg() & STATUS_DONE_FINAL) {
displayReadReg("after erase sram", status_reg);
if (status_reg & STATUS_DONE_FINAL) {
printError("FAIL");
return false;
} else {