[ion/device/n0110/internal_flash] Add method OTPLockAddress

This commit is contained in:
Gabriel Ozouf
2021-04-15 15:08:27 +02:00
committed by Gabriel
parent 018ea07796
commit 46acd4eb61
2 changed files with 3 additions and 2 deletions

View File

@@ -401,13 +401,13 @@ void writePCBVersion(PCBVersion version) {
}
void lockPCBVersion() {
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPLocksAddress + k_pcbVersionOTPIndex);
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPLockAddress(k_pcbVersionOTPIndex));
uint8_t zero = 0;
InternalFlash::WriteMemory(destination, &zero, sizeof(zero));
}
bool pcbVersionIsLocked() {
return *reinterpret_cast<const uint8_t *>(InternalFlash::Config::OTPLocksAddress + k_pcbVersionOTPIndex) == 0;
return *reinterpret_cast<const uint8_t *>(InternalFlash::Config::OTPLockAddress(k_pcbVersionOTPIndex)) == 0;
}
}

View File

@@ -21,6 +21,7 @@ constexpr static uint32_t OTPLocksAddress = 0x1FF07A00;
constexpr static int NumberOfOTPBlocks = 16;
constexpr static uint32_t OTPBlockSize = 0x20;
constexpr uint32_t OTPAddress(int block) { return OTPStartAddress + block * OTPBlockSize; };
constexpr uint32_t OTPLockAddress(int block) { return OTPLocksAddress + block; }
}
}