mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 22:00:28 +01:00
[ion/device/n0110/internal_flash] Add method OTPLockAddress
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user