diff --git a/src/Targets/TargetDescription/Register.hpp b/src/Targets/TargetDescription/Register.hpp index 8ec365ea..1ee499cb 100644 --- a/src/Targets/TargetDescription/Register.hpp +++ b/src/Targets/TargetDescription/Register.hpp @@ -7,6 +7,7 @@ #include #include "BitField.hpp" +#include "src/Targets/TargetRegisterDescriptor.hpp" #include "Exceptions/InvalidTargetDescriptionDataException.hpp" @@ -20,7 +21,7 @@ namespace Targets::TargetDescription std::uint32_t offset; std::uint16_t size; std::optional initialValue; - std::optional access; + std::optional access; std::optional alternative; std::map> bitFieldsByKey; @@ -31,7 +32,7 @@ namespace Targets::TargetDescription std::uint32_t offset, std::uint16_t size, const std::optional& initialValue, - const std::optional& access, + const std::optional& access, const std::optional& alternative, const std::map>& bitFieldsByKey ) diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/TargetDescription/TargetDescriptionFile.cpp index dac9ead9..8d056ea3 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.cpp @@ -544,6 +544,7 @@ namespace Targets::TargetDescription Register TargetDescriptionFile::registerFromXml(const QDomElement& xmlElement) { const auto initialValue = TargetDescriptionFile::tryGetAttribute(xmlElement, "initial-value"); const auto alternative = TargetDescriptionFile::tryGetAttribute(xmlElement, "alternative"); + const auto accessString = TargetDescriptionFile::tryGetAttribute(xmlElement, "access"); auto output = Register( TargetDescriptionFile::getAttribute(xmlElement, "key"), @@ -552,7 +553,12 @@ namespace Targets::TargetDescription StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "offset")), StringService::toUint16(TargetDescriptionFile::getAttribute(xmlElement, "size")), initialValue.has_value() ? std::optional(StringService::toUint64(*initialValue)) : std::nullopt, - TargetDescriptionFile::tryGetAttribute(xmlElement, "access"), + accessString.has_value() + ? std::optional(TargetRegisterAccess( + accessString->find('R') != std::string::npos, + accessString->find('W') != std::string::npos + )) + : std::nullopt, alternative.has_value() ? std::optional(*alternative == "true") : std::nullopt, {} );