Added access member to TDF MemorySegment struct. Also used target memory alias types
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include "src/Targets/TargetMemorySegmentType.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
#include "MemorySegmentSection.hpp"
|
||||
|
||||
@@ -17,18 +18,20 @@ namespace Targets::TargetDescription
|
||||
std::string key;
|
||||
std::string name;
|
||||
TargetMemorySegmentType type;
|
||||
std::uint32_t startAddress;
|
||||
std::uint32_t size;
|
||||
std::optional<std::uint16_t> pageSize;
|
||||
TargetMemoryAddress startAddress;
|
||||
TargetMemorySize size;
|
||||
TargetMemoryAccess access;
|
||||
std::optional<TargetMemorySize> pageSize;
|
||||
std::map<std::string, MemorySegmentSection, std::less<void>> sectionsByKey;
|
||||
|
||||
MemorySegment(
|
||||
const std::string& key,
|
||||
const std::string& name,
|
||||
TargetMemorySegmentType type,
|
||||
std::uint32_t startAddress,
|
||||
std::uint32_t size,
|
||||
const std::optional<std::uint16_t>& pageSize,
|
||||
TargetMemoryAddress startAddress,
|
||||
TargetMemorySize size,
|
||||
const TargetMemoryAccess& access,
|
||||
const std::optional<TargetMemorySize>& pageSize,
|
||||
const std::map<std::string, MemorySegmentSection, std::less<void>>& sectionsByKey
|
||||
)
|
||||
: key(key)
|
||||
@@ -36,6 +39,7 @@ namespace Targets::TargetDescription
|
||||
, type(type)
|
||||
, startAddress(startAddress)
|
||||
, size(size)
|
||||
, access(access)
|
||||
, pageSize(pageSize)
|
||||
, sectionsByKey(sectionsByKey)
|
||||
{}
|
||||
|
||||
@@ -394,6 +394,7 @@ namespace Targets::TargetDescription
|
||||
}
|
||||
|
||||
const auto pageSize = TargetDescriptionFile::tryGetAttribute(xmlElement, "page-size");
|
||||
const auto accessString = TargetDescriptionFile::tryGetAttribute(xmlElement, "rw");
|
||||
|
||||
auto output = MemorySegment(
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "key"),
|
||||
@@ -401,8 +402,13 @@ namespace Targets::TargetDescription
|
||||
*type,
|
||||
StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "start")),
|
||||
StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "size")),
|
||||
TargetMemoryAccess(
|
||||
accessString.has_value() ? accessString->find('R') != std::string::npos : true,
|
||||
accessString.has_value() ? accessString->find('W') != std::string::npos : true,
|
||||
accessString.has_value() ? accessString->find('W') != std::string::npos : true
|
||||
),
|
||||
pageSize.has_value()
|
||||
? std::optional(StringService::toUint16(*pageSize))
|
||||
? std::optional(StringService::toUint32(*pageSize))
|
||||
: std::nullopt,
|
||||
{}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user