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 <optional>
|
||||||
|
|
||||||
#include "src/Targets/TargetMemorySegmentType.hpp"
|
#include "src/Targets/TargetMemorySegmentType.hpp"
|
||||||
|
#include "src/Targets/TargetMemory.hpp"
|
||||||
|
|
||||||
#include "MemorySegmentSection.hpp"
|
#include "MemorySegmentSection.hpp"
|
||||||
|
|
||||||
@@ -17,18 +18,20 @@ namespace Targets::TargetDescription
|
|||||||
std::string key;
|
std::string key;
|
||||||
std::string name;
|
std::string name;
|
||||||
TargetMemorySegmentType type;
|
TargetMemorySegmentType type;
|
||||||
std::uint32_t startAddress;
|
TargetMemoryAddress startAddress;
|
||||||
std::uint32_t size;
|
TargetMemorySize size;
|
||||||
std::optional<std::uint16_t> pageSize;
|
TargetMemoryAccess access;
|
||||||
|
std::optional<TargetMemorySize> pageSize;
|
||||||
std::map<std::string, MemorySegmentSection, std::less<void>> sectionsByKey;
|
std::map<std::string, MemorySegmentSection, std::less<void>> sectionsByKey;
|
||||||
|
|
||||||
MemorySegment(
|
MemorySegment(
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
TargetMemorySegmentType type,
|
TargetMemorySegmentType type,
|
||||||
std::uint32_t startAddress,
|
TargetMemoryAddress startAddress,
|
||||||
std::uint32_t size,
|
TargetMemorySize size,
|
||||||
const std::optional<std::uint16_t>& pageSize,
|
const TargetMemoryAccess& access,
|
||||||
|
const std::optional<TargetMemorySize>& pageSize,
|
||||||
const std::map<std::string, MemorySegmentSection, std::less<void>>& sectionsByKey
|
const std::map<std::string, MemorySegmentSection, std::less<void>>& sectionsByKey
|
||||||
)
|
)
|
||||||
: key(key)
|
: key(key)
|
||||||
@@ -36,6 +39,7 @@ namespace Targets::TargetDescription
|
|||||||
, type(type)
|
, type(type)
|
||||||
, startAddress(startAddress)
|
, startAddress(startAddress)
|
||||||
, size(size)
|
, size(size)
|
||||||
|
, access(access)
|
||||||
, pageSize(pageSize)
|
, pageSize(pageSize)
|
||||||
, sectionsByKey(sectionsByKey)
|
, sectionsByKey(sectionsByKey)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -394,6 +394,7 @@ namespace Targets::TargetDescription
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto pageSize = TargetDescriptionFile::tryGetAttribute(xmlElement, "page-size");
|
const auto pageSize = TargetDescriptionFile::tryGetAttribute(xmlElement, "page-size");
|
||||||
|
const auto accessString = TargetDescriptionFile::tryGetAttribute(xmlElement, "rw");
|
||||||
|
|
||||||
auto output = MemorySegment(
|
auto output = MemorySegment(
|
||||||
TargetDescriptionFile::getAttribute(xmlElement, "key"),
|
TargetDescriptionFile::getAttribute(xmlElement, "key"),
|
||||||
@@ -401,8 +402,13 @@ namespace Targets::TargetDescription
|
|||||||
*type,
|
*type,
|
||||||
StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "start")),
|
StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "start")),
|
||||||
StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "size")),
|
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()
|
pageSize.has_value()
|
||||||
? std::optional(StringService::toUint16(*pageSize))
|
? std::optional(StringService::toUint32(*pageSize))
|
||||||
: std::nullopt,
|
: std::nullopt,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user