Used TargetRegisterAccess object in place of a string for Register TDF struct
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <functional>
|
||||
|
||||
#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<std::uint64_t> initialValue;
|
||||
std::optional<std::string> access;
|
||||
std::optional<TargetRegisterAccess> access;
|
||||
std::optional<bool> alternative;
|
||||
std::map<std::string, BitField, std::less<void>> bitFieldsByKey;
|
||||
|
||||
@@ -31,7 +32,7 @@ namespace Targets::TargetDescription
|
||||
std::uint32_t offset,
|
||||
std::uint16_t size,
|
||||
const std::optional<std::uint64_t>& initialValue,
|
||||
const std::optional<std::string>& access,
|
||||
const std::optional<TargetRegisterAccess>& access,
|
||||
const std::optional<bool>& alternative,
|
||||
const std::map<std::string, BitField, std::less<void>>& bitFieldsByKey
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
{}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user