Updated lookup for OSCCAL_ADDR value from TDFs.

Included OSCCAL0, OSCCAL1, FOSCCAL0, SOSCCALA register lookups
This commit is contained in:
Nav
2021-06-06 00:43:18 +01:00
parent b78fef4efe
commit e9929927cb
3 changed files with 22 additions and 7 deletions

View File

@@ -584,10 +584,22 @@ std::optional<Register> TargetDescriptionFile::getOscillatorCalibrationRegister(
auto cpuRegisterGroup = this->getCpuRegisterGroup();
if (cpuRegisterGroup.has_value()) {
auto osccalRegisterIt = cpuRegisterGroup->registersMappedByName.find("osccal");
auto& cpuRegisters = cpuRegisterGroup->registersMappedByName;
if (osccalRegisterIt != cpuRegisterGroup->registersMappedByName.end()) {
return osccalRegisterIt->second;
if (cpuRegisters.contains("oscall")) {
return cpuRegisters.at("oscall");
} else if (cpuRegisters.contains("osccal0")) {
return cpuRegisters.at("osccal0");
} else if (cpuRegisters.contains("osccal1")) {
return cpuRegisters.at("osccal1");
} else if (cpuRegisters.contains("fosccal")) {
return cpuRegisters.at("fosccal");
} else if (cpuRegisters.contains("sosccala")) {
return cpuRegisters.at("sosccala");
}
}