Made physical interface enum more generic (moved out of AVR8-specific context)
This commit is contained in:
@@ -97,6 +97,30 @@ namespace Targets::TargetDescription
|
||||
return addressSpace->get();
|
||||
}
|
||||
|
||||
std::set<TargetPhysicalInterface> TargetDescriptionFile::getPhysicalInterfaces() const {
|
||||
static const auto physicalInterfacesByName = BiMap<std::string, TargetPhysicalInterface>({
|
||||
{"updi", TargetPhysicalInterface::UPDI},
|
||||
{"debugwire", TargetPhysicalInterface::DEBUG_WIRE},
|
||||
{"jtag", TargetPhysicalInterface::JTAG},
|
||||
{"pdi", TargetPhysicalInterface::PDI},
|
||||
{"isp", TargetPhysicalInterface::ISP},
|
||||
});
|
||||
|
||||
auto output = std::set<TargetPhysicalInterface>();
|
||||
|
||||
for (const auto& physicalInterface : this->physicalInterfaces) {
|
||||
const auto interface = physicalInterfacesByName.valueAt(
|
||||
StringService::asciiToLower(physicalInterface.name)
|
||||
);
|
||||
|
||||
if (interface.has_value()) {
|
||||
output.insert(*interface);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void TargetDescriptionFile::init(const std::string& xmlFilePath) {
|
||||
auto file = QFile(QString::fromStdString(xmlFilePath));
|
||||
if (!file.exists()) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Pinout.hpp"
|
||||
|
||||
#include "src/Targets/TargetFamily.hpp"
|
||||
#include "src/Targets/TargetPhysicalInterface.hpp"
|
||||
|
||||
#include GENERATED_TDF_MAPPING_PATH
|
||||
|
||||
@@ -99,6 +100,8 @@ namespace Targets::TargetDescription
|
||||
) const;
|
||||
[[nodiscard]] const AddressSpace& getAddressSpace(std::string_view key) const;
|
||||
|
||||
[[nodiscard]] std::set<Targets::TargetPhysicalInterface> getPhysicalInterfaces() const;
|
||||
|
||||
protected:
|
||||
std::map<std::string, std::string> deviceAttributesByName;
|
||||
std::map<std::string, AddressSpace, std::less<void>> addressSpacesByKey;
|
||||
|
||||
Reference in New Issue
Block a user