[ion/device/n0110] Change getter for OTPAddress

This commit is contained in:
Gabriel Ozouf
2021-03-24 10:42:26 +01:00
committed by Gabriel
parent ed18f1e95f
commit 36655f1c19
2 changed files with 4 additions and 8 deletions

View File

@@ -390,11 +390,11 @@ PCBVersion readPCBVersion() {
}
PCBVersion readPCBVersionInMemory() {
return ~*reinterpret_cast<const PCBVersion *>(InternalFlash::Config::OTPAddresses[pcbVersionOTPIndex]);
return ~*reinterpret_cast<const PCBVersion *>(InternalFlash::Config::OTPAddress(pcbVersionOTPIndex));
}
void writePCBVersion(PCBVersion version) {
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPAddresses[pcbVersionOTPIndex]);
uint8_t * destination = reinterpret_cast<uint8_t *>(InternalFlash::Config::OTPAddress(pcbVersionOTPIndex));
PCBVersion formattedVersion = ~version;
InternalFlash::WriteMemory(destination, reinterpret_cast<uint8_t *>(&formattedVersion), sizeof(formattedVersion));
}

View File

@@ -19,12 +19,8 @@ constexpr static uint32_t SectorAddresses[NumberOfSectors+1] = {
constexpr static uint32_t OTPStartAddress = 0x1FF07800;
constexpr static uint32_t OTPLocksAddress = 0x1FF07A00;
constexpr static int NumberOfOTPBlocks = 16;
constexpr static uint32_t OTPAddresses[NumberOfOTPBlocks] = {
0x1FF07800, 0x1FF07820, 0x1FF07840, 0x1FF07860,
0x1FF07880, 0x1FF078A0, 0x1FF078C0, 0x1FF078E0,
0x1FF07900, 0x1FF07920, 0x1FF07940, 0x1FF07960,
0x1FF07980, 0x1FF079A0, 0x1FF079C0, 0x1FF079E0,
};
constexpr static uint32_t OTPBlockSize = 0x20;
constexpr uint32_t OTPAddress(int block) { return OTPStartAddress + block * OTPBlockSize; };
}
}