mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[ion/device] Lock OTP after writing version
This commit is contained in:
@@ -23,6 +23,7 @@ void PCBVersion(const char * input) {
|
||||
reply(sKO);
|
||||
return;
|
||||
}
|
||||
Board::lockVersionOTP();
|
||||
#endif
|
||||
reply(sOK);
|
||||
}
|
||||
|
||||
@@ -240,6 +240,8 @@ PCBVersion readPCBVersionInMemory() {
|
||||
|
||||
void writePCBVersion(PCBVersion) {}
|
||||
|
||||
void lockVersionOTP() {}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,12 +394,17 @@ PCBVersion readPCBVersionInMemory() {
|
||||
}
|
||||
|
||||
void writePCBVersion(PCBVersion version) {
|
||||
/* TODO: We also need to lock the OTP in which the version has been written. */
|
||||
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPAddresses[pcbVersionOTPIndex]);
|
||||
PCBVersion formattedVersion = ~version;
|
||||
InternalFlash::WriteMemory(destination, reinterpret_cast<uint8_t *>(&formattedVersion), sizeof(formattedVersion));
|
||||
}
|
||||
|
||||
void lockVersionOTP() {
|
||||
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPLocksAddress + pcbVersionOTPIndex);
|
||||
uint8_t zero = 0x00;
|
||||
InternalFlash::WriteMemory(destination, &zero, sizeof(zero));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ typedef uint32_t PCBVersion;
|
||||
PCBVersion readPCBVersion();
|
||||
PCBVersion readPCBVersionInMemory();
|
||||
void writePCBVersion(PCBVersion version);
|
||||
void lockVersionOTP();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user