Some code

This commit is contained in:
devdl11
2022-04-27 19:24:59 +02:00
parent 45b4dd337c
commit c73b13bd41
6 changed files with 35 additions and 16 deletions

View File

@@ -70,6 +70,10 @@ void EnableInternalFlashInterrupt() {
InternalFlash::EnableFlashInterrupt();
}
void ClearInternalFlashErrors() {
InternalFlash::ClearErrors();
}
void LockSlotA() {
ExternalFlash::LockSlotA();
}

View File

@@ -20,6 +20,7 @@ void EnableInternalProtection();
void SetInternalSectorProtection(int i, bool protect);
void EnableInternalSessionLock(); // Will cause BUSERR when enabled
void EnableInternalFlashInterrupt();
void ClearInternalFlashErrors();
void LockSlotA();
void LockSlotB();

View File

@@ -363,6 +363,17 @@ void EnableFlashInterrupt() {
close();
}
void ClearErrors() {
class FLASH::SR sr(0);
// Error flags are cleared by writing 1
sr.setERSERR(true);
sr.setPGPERR(true);
sr.setPGAERR(true);
sr.setWRPERR(true);
sr.setEOP(true);
FLASH.SR()->set(sr);
}
}
}
}

View File

@@ -20,6 +20,7 @@ void DisableProtection();
void SetSectorProtection(int i, bool protect);
void EnableSessionLock();
void EnableFlashInterrupt();
void ClearErrors();
/* The Device is powered by a 2.8V LDO. This allows us to perform writes to the
* Flash 32 bits at once. */