Updated application to code to accomodate changes to TDF format (new pad elements and changes to variant elements)
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
#include "src/TargetController/Commands/RemoveBreakpoint.hpp"
|
||||
#include "src/TargetController/Commands/SetTargetProgramCounter.hpp"
|
||||
#include "src/TargetController/Commands/SetTargetStackPointer.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetGpioPinStates.hpp"
|
||||
#include "src/TargetController/Commands/SetTargetGpioPinState.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetGpioPadStates.hpp"
|
||||
#include "src/TargetController/Commands/SetTargetGpioPadState.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetStackPointer.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetProgramCounter.hpp"
|
||||
#include "src/TargetController/Commands/EnableProgrammingMode.hpp"
|
||||
@@ -47,8 +47,8 @@ namespace Services
|
||||
using TargetController::Commands::RemoveBreakpoint;
|
||||
using TargetController::Commands::SetTargetProgramCounter;
|
||||
using TargetController::Commands::SetTargetStackPointer;
|
||||
using TargetController::Commands::GetTargetGpioPinStates;
|
||||
using TargetController::Commands::SetTargetGpioPinState;
|
||||
using TargetController::Commands::GetTargetGpioPadStates;
|
||||
using TargetController::Commands::SetTargetGpioPadState;
|
||||
using TargetController::Commands::GetTargetStackPointer;
|
||||
using TargetController::Commands::GetTargetProgramCounter;
|
||||
using TargetController::Commands::EnableProgrammingMode;
|
||||
@@ -74,8 +74,8 @@ namespace Services
|
||||
|
||||
using Targets::TargetPinoutDescriptor;
|
||||
using Targets::TargetPinDescriptor;
|
||||
using Targets::TargetGpioPinState;
|
||||
using Targets::TargetGpioPinDescriptorAndStatePairs;
|
||||
using Targets::TargetGpioPadState;
|
||||
using Targets::TargetGpioPadDescriptorAndStatePairs;
|
||||
|
||||
TargetControllerService::AtomicSession::AtomicSession(TargetControllerService& targetControllerService)
|
||||
: targetControllerService(targetControllerService)
|
||||
@@ -270,22 +270,22 @@ namespace Services
|
||||
);
|
||||
}
|
||||
|
||||
TargetGpioPinDescriptorAndStatePairs TargetControllerService::getGpioPinStates(
|
||||
const TargetPinoutDescriptor& pinoutDescriptor
|
||||
TargetGpioPadDescriptorAndStatePairs TargetControllerService::getGpioPadStates(
|
||||
const Targets::TargetPadDescriptors& padDescriptors
|
||||
) const {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetTargetGpioPinStates>(pinoutDescriptor),
|
||||
std::make_unique<GetTargetGpioPadStates>(padDescriptors),
|
||||
this->defaultTimeout,
|
||||
this->activeAtomicSessionId
|
||||
)->gpioPinStates;
|
||||
)->gpioPadStates;
|
||||
}
|
||||
|
||||
void TargetControllerService::setGpioPinState(
|
||||
const TargetPinDescriptor& pinDescriptor,
|
||||
const TargetGpioPinState& state
|
||||
void TargetControllerService::setGpioPadState(
|
||||
const Targets::TargetPadDescriptor& padDescriptor,
|
||||
const TargetGpioPadState& state
|
||||
) const {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<SetTargetGpioPinState>(pinDescriptor, state),
|
||||
std::make_unique<SetTargetGpioPadState>(padDescriptor, state),
|
||||
this->defaultTimeout,
|
||||
this->activeAtomicSessionId
|
||||
);
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "src/Targets/TargetRegisterGroupDescriptor.hpp"
|
||||
#include "src/Targets/TargetRegisterDescriptor.hpp"
|
||||
#include "src/Targets/TargetPinoutDescriptor.hpp"
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
#include "src/Targets/TargetGpioPinState.hpp"
|
||||
#include "src/Targets/TargetPadDescriptor.hpp"
|
||||
#include "src/Targets/TargetGpioPadState.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Targets/TargetBreakpoint.hpp"
|
||||
|
||||
@@ -205,23 +205,23 @@ namespace Services
|
||||
void setProgramCounter(Targets::TargetMemoryAddress address) const;
|
||||
|
||||
/**
|
||||
* Retrieves the pin states for a particular target variant.
|
||||
* Retrieves the GPIO states for the given GPIO pads.
|
||||
*
|
||||
* @param pinoutDescriptor
|
||||
* @param padDescriptors
|
||||
*/
|
||||
Targets::TargetGpioPinDescriptorAndStatePairs getGpioPinStates(
|
||||
const Targets::TargetPinoutDescriptor& pinoutDescriptor
|
||||
Targets::TargetGpioPadDescriptorAndStatePairs getGpioPadStates(
|
||||
const Targets::TargetPadDescriptors& padDescriptors
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Updates the pin state on the target, for a specific pin.
|
||||
*
|
||||
* @param pinDescriptor
|
||||
* @param padDescriptor
|
||||
* @param state
|
||||
*/
|
||||
void setGpioPinState(
|
||||
const Targets::TargetPinDescriptor& pinDescriptor,
|
||||
const Targets::TargetGpioPinState& state
|
||||
void setGpioPadState(
|
||||
const Targets::TargetPadDescriptor& padDescriptor,
|
||||
const Targets::TargetGpioPadState& state
|
||||
) const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace TargetController::Commands
|
||||
REMOVE_BREAKPOINT,
|
||||
SET_TARGET_PROGRAM_COUNTER,
|
||||
SET_TARGET_STACK_POINTER,
|
||||
GET_TARGET_GPIO_PIN_STATES,
|
||||
SET_TARGET_GPIO_PIN_STATE,
|
||||
GET_TARGET_GPIO_PAD_STATES,
|
||||
SET_TARGET_GPIO_PAD_STATE,
|
||||
GET_TARGET_STACK_POINTER,
|
||||
GET_TARGET_PROGRAM_COUNTER,
|
||||
ENABLE_PROGRAMMING_MODE,
|
||||
|
||||
32
src/TargetController/Commands/GetTargetGpioPadStates.hpp
Normal file
32
src/TargetController/Commands/GetTargetGpioPadStates.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "Command.hpp"
|
||||
|
||||
#include "src/TargetController/Responses/TargetGpioPadStates.hpp"
|
||||
#include "src/Targets/TargetPadDescriptor.hpp"
|
||||
|
||||
namespace TargetController::Commands
|
||||
{
|
||||
class GetTargetGpioPadStates: public Command
|
||||
{
|
||||
public:
|
||||
using SuccessResponseType = Responses::TargetGpioPadStates;
|
||||
|
||||
static constexpr CommandType type = CommandType::GET_TARGET_GPIO_PAD_STATES;
|
||||
static const inline std::string name = "GetTargetGpioPadStates";
|
||||
|
||||
const Targets::TargetPadDescriptors padDescriptors;
|
||||
|
||||
explicit GetTargetGpioPadStates(const Targets::TargetPadDescriptors& padDescriptors)
|
||||
: padDescriptors(padDescriptors)
|
||||
{};
|
||||
|
||||
[[nodiscard]] CommandType getType() const override {
|
||||
return GetTargetGpioPadStates::type;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool requiresStoppedTargetState() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Command.hpp"
|
||||
|
||||
#include "src/TargetController/Responses/TargetGpioPinStates.hpp"
|
||||
|
||||
namespace TargetController::Commands
|
||||
{
|
||||
class GetTargetGpioPinStates: public Command
|
||||
{
|
||||
public:
|
||||
using SuccessResponseType = Responses::TargetGpioPinStates;
|
||||
|
||||
static constexpr CommandType type = CommandType::GET_TARGET_GPIO_PIN_STATES;
|
||||
static const inline std::string name = "GetTargetGpioPinStates";
|
||||
|
||||
const Targets::TargetPinoutDescriptor& pinoutDescriptor;
|
||||
|
||||
explicit GetTargetGpioPinStates(const Targets::TargetPinoutDescriptor& pinoutDescriptor)
|
||||
: pinoutDescriptor(pinoutDescriptor)
|
||||
{};
|
||||
|
||||
[[nodiscard]] CommandType getType() const override {
|
||||
return GetTargetGpioPinStates::type;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool requiresStoppedTargetState() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
35
src/TargetController/Commands/SetTargetGpioPadState.hpp
Normal file
35
src/TargetController/Commands/SetTargetGpioPadState.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "Command.hpp"
|
||||
|
||||
#include "src/Targets/TargetPadDescriptor.hpp"
|
||||
#include "src/Targets/TargetGpioPadState.hpp"
|
||||
|
||||
namespace TargetController::Commands
|
||||
{
|
||||
class SetTargetGpioPadState: public Command
|
||||
{
|
||||
public:
|
||||
static constexpr CommandType type = CommandType::SET_TARGET_GPIO_PAD_STATE;
|
||||
static const inline std::string name = "SetTargetGpioPadState";
|
||||
|
||||
const Targets::TargetPadDescriptor& padDescriptor;
|
||||
Targets::TargetGpioPadState state;
|
||||
|
||||
SetTargetGpioPadState(
|
||||
const Targets::TargetPadDescriptor& padDescriptor,
|
||||
const Targets::TargetGpioPadState& state
|
||||
)
|
||||
: padDescriptor(padDescriptor)
|
||||
, state(state)
|
||||
{};
|
||||
|
||||
[[nodiscard]] CommandType getType() const override {
|
||||
return SetTargetGpioPadState::type;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool requiresStoppedTargetState() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Command.hpp"
|
||||
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
#include "src/Targets/TargetGpioPinState.hpp"
|
||||
|
||||
namespace TargetController::Commands
|
||||
{
|
||||
class SetTargetGpioPinState: public Command
|
||||
{
|
||||
public:
|
||||
static constexpr CommandType type = CommandType::SET_TARGET_GPIO_PIN_STATE;
|
||||
static const inline std::string name = "SetTargetGpioPinState";
|
||||
|
||||
const Targets::TargetPinDescriptor& pinDescriptor;
|
||||
Targets::TargetGpioPinState state;
|
||||
|
||||
SetTargetGpioPinState(
|
||||
const Targets::TargetPinDescriptor& pinDescriptor,
|
||||
const Targets::TargetGpioPinState& state
|
||||
)
|
||||
: pinDescriptor(pinDescriptor)
|
||||
, state(state)
|
||||
{};
|
||||
|
||||
[[nodiscard]] CommandType getType() const override {
|
||||
return SetTargetGpioPinState::type;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool requiresStoppedTargetState() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace TargetController::Responses
|
||||
TARGET_REGISTERS_READ,
|
||||
TARGET_MEMORY_READ,
|
||||
TARGET_STATE,
|
||||
TARGET_GPIO_PIN_STATES,
|
||||
TARGET_GPIO_PAD_STATES,
|
||||
TARGET_STACK_POINTER,
|
||||
TARGET_PROGRAM_COUNTER,
|
||||
BREAKPOINT,
|
||||
|
||||
29
src/TargetController/Responses/TargetGpioPadStates.hpp
Normal file
29
src/TargetController/Responses/TargetGpioPadStates.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Response.hpp"
|
||||
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
#include "src/Targets/TargetGpioPadState.hpp"
|
||||
|
||||
#include "src/Helpers/Pair.hpp"
|
||||
|
||||
namespace TargetController::Responses
|
||||
{
|
||||
class TargetGpioPadStates: public Response
|
||||
{
|
||||
public:
|
||||
static constexpr ResponseType type = ResponseType::TARGET_GPIO_PAD_STATES;
|
||||
|
||||
Targets::TargetGpioPadDescriptorAndStatePairs gpioPadStates;
|
||||
|
||||
explicit TargetGpioPadStates(const Targets::TargetGpioPadDescriptorAndStatePairs& gpioPadStates)
|
||||
: gpioPadStates(gpioPadStates)
|
||||
{}
|
||||
|
||||
[[nodiscard]] ResponseType getType() const override {
|
||||
return TargetGpioPadStates::type;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Response.hpp"
|
||||
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
#include "src/Targets/TargetGpioPinState.hpp"
|
||||
|
||||
#include "src/Helpers/Pair.hpp"
|
||||
|
||||
namespace TargetController::Responses
|
||||
{
|
||||
class TargetGpioPinStates: public Response
|
||||
{
|
||||
public:
|
||||
static constexpr ResponseType type = ResponseType::TARGET_GPIO_PIN_STATES;
|
||||
|
||||
Targets::TargetGpioPinDescriptorAndStatePairs gpioPinStates;
|
||||
|
||||
explicit TargetGpioPinStates(const Targets::TargetGpioPinDescriptorAndStatePairs& gpioPinStates)
|
||||
: gpioPinStates(gpioPinStates)
|
||||
{}
|
||||
|
||||
[[nodiscard]] ResponseType getType() const override {
|
||||
return TargetGpioPinStates::type;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -44,8 +44,8 @@ namespace TargetController
|
||||
using Commands::RemoveBreakpoint;
|
||||
using Commands::SetTargetProgramCounter;
|
||||
using Commands::SetTargetStackPointer;
|
||||
using Commands::GetTargetGpioPinStates;
|
||||
using Commands::SetTargetGpioPinState;
|
||||
using Commands::GetTargetGpioPadStates;
|
||||
using Commands::SetTargetGpioPadState;
|
||||
using Commands::GetTargetStackPointer;
|
||||
using Commands::GetTargetProgramCounter;
|
||||
using Commands::EnableProgrammingMode;
|
||||
@@ -55,7 +55,7 @@ namespace TargetController
|
||||
using Responses::AtomicSessionId;
|
||||
using Responses::TargetRegistersRead;
|
||||
using Responses::TargetMemoryRead;
|
||||
using Responses::TargetGpioPinStates;
|
||||
using Responses::TargetGpioPadStates;
|
||||
using Responses::TargetStackPointer;
|
||||
using Responses::TargetProgramCounter;
|
||||
using Responses::Breakpoint;
|
||||
@@ -233,12 +233,12 @@ namespace TargetController
|
||||
std::bind(&TargetControllerComponent::handleSetProgramCounter, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<GetTargetGpioPinStates>(
|
||||
std::bind(&TargetControllerComponent::handleGetTargetGpioPinStates, this, std::placeholders::_1)
|
||||
this->registerCommandHandler<GetTargetGpioPadStates>(
|
||||
std::bind(&TargetControllerComponent::handleGetTargetGpioPadStates, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<SetTargetGpioPinState>(
|
||||
std::bind(&TargetControllerComponent::handleSetTargetGpioPinState, this, std::placeholders::_1)
|
||||
this->registerCommandHandler<SetTargetGpioPadState>(
|
||||
std::bind(&TargetControllerComponent::handleSetTargetGpioPadState, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<GetTargetStackPointer>(
|
||||
@@ -1007,7 +1007,7 @@ namespace TargetController
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleStepTargetExecution(StepTargetExecution& command) {
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleStepTargetExecution(StepTargetExecution&) {
|
||||
this->stepTarget();
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
@@ -1053,14 +1053,14 @@ namespace TargetController
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
std::unique_ptr<TargetGpioPinStates> TargetControllerComponent::handleGetTargetGpioPinStates(
|
||||
GetTargetGpioPinStates& command
|
||||
std::unique_ptr<TargetGpioPadStates> TargetControllerComponent::handleGetTargetGpioPadStates(
|
||||
GetTargetGpioPadStates& command
|
||||
) {
|
||||
return std::make_unique<TargetGpioPinStates>(this->target->getGpioPinStates(command.pinoutDescriptor));
|
||||
return std::make_unique<TargetGpioPadStates>(this->target->getGpioPadStates(command.padDescriptors));
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleSetTargetGpioPinState(SetTargetGpioPinState& command) {
|
||||
this->target->setGpioPinState(command.pinDescriptor, command.state);
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleSetTargetGpioPadState(SetTargetGpioPadState& command) {
|
||||
this->target->setGpioPadState(command.padDescriptor, command.state);
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
@@ -1076,7 +1076,7 @@ namespace TargetController
|
||||
return std::make_unique<TargetProgramCounter>(this->target->getProgramCounter());
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleEnableProgrammingMode(EnableProgrammingMode& command) {
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleEnableProgrammingMode(EnableProgrammingMode&) {
|
||||
if (!this->target->programmingModeEnabled()) {
|
||||
this->enableProgrammingMode();
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ namespace TargetController
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleDisableProgrammingMode(DisableProgrammingMode& command) {
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleDisableProgrammingMode(DisableProgrammingMode&) {
|
||||
if (this->target->programmingModeEnabled()) {
|
||||
this->disableProgrammingMode();
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include "Commands/RemoveBreakpoint.hpp"
|
||||
#include "Commands/SetTargetProgramCounter.hpp"
|
||||
#include "Commands/SetTargetStackPointer.hpp"
|
||||
#include "Commands/GetTargetGpioPinStates.hpp"
|
||||
#include "Commands/SetTargetGpioPinState.hpp"
|
||||
#include "Commands/GetTargetGpioPadStates.hpp"
|
||||
#include "Commands/SetTargetGpioPadState.hpp"
|
||||
#include "Commands/GetTargetStackPointer.hpp"
|
||||
#include "Commands/GetTargetProgramCounter.hpp"
|
||||
#include "Commands/EnableProgrammingMode.hpp"
|
||||
@@ -53,7 +53,7 @@
|
||||
#include "Responses/TargetState.hpp"
|
||||
#include "Responses/TargetRegistersRead.hpp"
|
||||
#include "Responses/TargetMemoryRead.hpp"
|
||||
#include "Responses/TargetGpioPinStates.hpp"
|
||||
#include "Responses/TargetGpioPadStates.hpp"
|
||||
#include "Responses/TargetStackPointer.hpp"
|
||||
#include "Responses/TargetProgramCounter.hpp"
|
||||
#include "Responses/Breakpoint.hpp"
|
||||
@@ -369,10 +369,10 @@ namespace TargetController
|
||||
std::unique_ptr<Responses::Response> handleRemoveBreakpoint(Commands::RemoveBreakpoint& command);
|
||||
std::unique_ptr<Responses::Response> handleSetProgramCounter(Commands::SetTargetProgramCounter& command);
|
||||
std::unique_ptr<Responses::Response> handleSetStackPointer(Commands::SetTargetStackPointer& command);
|
||||
std::unique_ptr<Responses::TargetGpioPinStates> handleGetTargetGpioPinStates(
|
||||
Commands::GetTargetGpioPinStates& command
|
||||
std::unique_ptr<Responses::TargetGpioPadStates> handleGetTargetGpioPadStates(
|
||||
Commands::GetTargetGpioPadStates& command
|
||||
);
|
||||
std::unique_ptr<Responses::Response> handleSetTargetGpioPinState(Commands::SetTargetGpioPinState& command);
|
||||
std::unique_ptr<Responses::Response> handleSetTargetGpioPadState(Commands::SetTargetGpioPadState& command);
|
||||
std::unique_ptr<Responses::TargetStackPointer> handleGetTargetStackPointer(
|
||||
Commands::GetTargetStackPointer& command
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ target_sources(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetRegisterGroupDescriptor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetRegisterDescriptor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetBitFieldDescriptor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetPadDescriptor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetPinoutDescriptor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetPinDescriptor.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetVariantDescriptor.cpp
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "IspParameters.hpp"
|
||||
|
||||
@@ -33,7 +34,7 @@ namespace Targets::Microchip::Avr8
|
||||
, family(this->targetDescriptionFile.getAvrFamily())
|
||||
, physicalInterfaces(this->targetDescriptionFile.getPhysicalInterfaces())
|
||||
, gpioPortPeripheralDescriptors(this->targetDescriptionFile.gpioPortPeripheralDescriptors())
|
||||
, gpioPadDescriptorsByPadName(Avr8::generateGpioPadDescriptorMapping(this->gpioPortPeripheralDescriptors))
|
||||
, gpioPadDescriptorsByPadId(Avr8::generateGpioPadDescriptorMapping(this->gpioPortPeripheralDescriptors))
|
||||
, fuseEnableStrategy(this->targetDescriptionFile.getFuseEnableStrategy().value_or(FuseEnableStrategy::CLEAR))
|
||||
{
|
||||
const auto cpuPeripheralDescriptor = this->targetDescriptionFile.getTargetPeripheralDescriptor("cpu");
|
||||
@@ -265,6 +266,7 @@ namespace Targets::Microchip::Avr8
|
||||
this->targetDescriptionFile.tryGetVendorName().value_or("Microchip"),
|
||||
this->targetDescriptionFile.targetAddressSpaceDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetPeripheralDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetPadDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetPinoutDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetVariantDescriptors(),
|
||||
this->getBreakpointResources()
|
||||
@@ -558,11 +560,11 @@ namespace Targets::Microchip::Avr8
|
||||
}
|
||||
}
|
||||
|
||||
TargetGpioPinDescriptorAndStatePairs Avr8::getGpioPinStates(const TargetPinoutDescriptor& pinoutDescriptor) {
|
||||
auto output = TargetGpioPinDescriptorAndStatePairs{};
|
||||
TargetGpioPadDescriptorAndStatePairs Avr8::getGpioPadStates(const TargetPadDescriptors& padDescriptors) {
|
||||
auto output = TargetGpioPadDescriptorAndStatePairs{};
|
||||
|
||||
// To reduce the number of memory reads we perform here, we cache the data and map it by start address.
|
||||
auto cachedRegsByStartAddress = std::map<TargetMemoryAddress, unsigned char>{};
|
||||
auto cachedRegsByStartAddress = std::unordered_map<TargetMemoryAddress, unsigned char>{};
|
||||
const auto readGpioReg = [this, &cachedRegsByStartAddress] (const TargetRegisterDescriptor& descriptor) {
|
||||
assert(descriptor.size == 1);
|
||||
|
||||
@@ -577,33 +579,32 @@ namespace Targets::Microchip::Avr8
|
||||
return cachedRegIt->second;
|
||||
};
|
||||
|
||||
for (const auto& pinDescriptor : pinoutDescriptor.pinDescriptors) {
|
||||
if (pinDescriptor.type != TargetPinType::GPIO) {
|
||||
for (const auto* padDescriptor : padDescriptors) {
|
||||
if (padDescriptor->type != TargetPadType::GPIO) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto padDescriptorIt = this->gpioPadDescriptorsByPadName.find(pinDescriptor.padName);
|
||||
if (padDescriptorIt == this->gpioPadDescriptorsByPadName.end()) {
|
||||
const auto gpioPadDescriptorIt = this->gpioPadDescriptorsByPadId.find(padDescriptor->id);
|
||||
if (gpioPadDescriptorIt == this->gpioPadDescriptorsByPadId.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& padDescriptor = padDescriptorIt->second;
|
||||
|
||||
const auto& gpioPadDescriptor = gpioPadDescriptorIt->second;
|
||||
const auto ddrValue = (
|
||||
readGpioReg(padDescriptor.dataDirectionRegisterDescriptor) & padDescriptor.registerMask
|
||||
) != 0 ? TargetGpioPinState::DataDirection::OUTPUT : TargetGpioPinState::DataDirection::INPUT;
|
||||
readGpioReg(gpioPadDescriptor.dataDirectionRegisterDescriptor) & gpioPadDescriptor.registerMask
|
||||
) != 0 ? TargetGpioPadState::DataDirection::OUTPUT : TargetGpioPadState::DataDirection::INPUT;
|
||||
|
||||
const auto& stateRegisterDescriptor = ddrValue == TargetGpioPinState::DataDirection::OUTPUT
|
||||
? padDescriptor.outputRegisterDescriptor
|
||||
: padDescriptor.inputRegisterDescriptor;
|
||||
const auto& stateRegisterDescriptor = ddrValue == TargetGpioPadState::DataDirection::OUTPUT
|
||||
? gpioPadDescriptor.outputRegisterDescriptor
|
||||
: gpioPadDescriptor.inputRegisterDescriptor;
|
||||
|
||||
output.emplace_back(
|
||||
TargetGpioPinDescriptorAndStatePair{
|
||||
pinDescriptor,
|
||||
TargetGpioPinState{
|
||||
(readGpioReg(stateRegisterDescriptor) & padDescriptor.registerMask) != 0
|
||||
? TargetGpioPinState::State::HIGH
|
||||
: TargetGpioPinState::State::LOW,
|
||||
TargetGpioPadDescriptorAndStatePair{
|
||||
*padDescriptor,
|
||||
TargetGpioPadState{
|
||||
(readGpioReg(stateRegisterDescriptor) & gpioPadDescriptor.registerMask) != 0
|
||||
? TargetGpioPadState::State::HIGH
|
||||
: TargetGpioPadState::State::LOW,
|
||||
ddrValue
|
||||
}
|
||||
}
|
||||
@@ -613,39 +614,38 @@ namespace Targets::Microchip::Avr8
|
||||
return output;
|
||||
}
|
||||
|
||||
void Avr8::setGpioPinState(const TargetPinDescriptor& pinDescriptor, const TargetGpioPinState& state) {
|
||||
using DataDirection = TargetGpioPinState::DataDirection;
|
||||
using GpioState = TargetGpioPinState::State;
|
||||
void Avr8::setGpioPadState(const TargetPadDescriptor& padDescriptor, const TargetGpioPadState& state) {
|
||||
using DataDirection = TargetGpioPadState::DataDirection;
|
||||
using GpioState = TargetGpioPadState::State;
|
||||
|
||||
const auto padDescriptorIt = this->gpioPadDescriptorsByPadName.find(pinDescriptor.padName);
|
||||
|
||||
if (padDescriptorIt == this->gpioPadDescriptorsByPadName.end()) {
|
||||
const auto gpioPadDescriptorIt = this->gpioPadDescriptorsByPadId.find(padDescriptor.id);
|
||||
if (gpioPadDescriptorIt == this->gpioPadDescriptorsByPadId.end()) {
|
||||
throw Exception{"Unknown pad"};
|
||||
}
|
||||
|
||||
const auto& padDescriptor = padDescriptorIt->second;
|
||||
const auto& gpioPadDescriptor = gpioPadDescriptorIt->second;
|
||||
|
||||
const auto currentDdrValue = this->readRegister(padDescriptor.dataDirectionRegisterDescriptor).at(0);
|
||||
const auto currentDdrValue = this->readRegister(gpioPadDescriptor.dataDirectionRegisterDescriptor).at(0);
|
||||
this->writeRegister(
|
||||
padDescriptor.dataDirectionRegisterDescriptor,
|
||||
gpioPadDescriptor.dataDirectionRegisterDescriptor,
|
||||
{
|
||||
static_cast<unsigned char>(
|
||||
state.direction == DataDirection::OUTPUT
|
||||
? (currentDdrValue | padDescriptor.registerMask)
|
||||
: (currentDdrValue & ~(padDescriptor.registerMask))
|
||||
? (currentDdrValue | gpioPadDescriptor.registerMask)
|
||||
: (currentDdrValue & ~(gpioPadDescriptor.registerMask))
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
if (state.direction == DataDirection::OUTPUT) {
|
||||
const auto currentOutputValue = this->readRegister(padDescriptor.outputRegisterDescriptor).at(0);
|
||||
const auto currentOutputValue = this->readRegister(gpioPadDescriptor.outputRegisterDescriptor).at(0);
|
||||
this->writeRegister(
|
||||
padDescriptor.outputRegisterDescriptor,
|
||||
gpioPadDescriptor.outputRegisterDescriptor,
|
||||
{
|
||||
static_cast<unsigned char>(
|
||||
state.value == GpioState::HIGH
|
||||
? (currentOutputValue | padDescriptor.registerMask)
|
||||
: (currentOutputValue & ~(padDescriptor.registerMask))
|
||||
? (currentOutputValue | gpioPadDescriptor.registerMask)
|
||||
: (currentOutputValue & ~(gpioPadDescriptor.registerMask))
|
||||
)
|
||||
}
|
||||
);
|
||||
@@ -679,22 +679,22 @@ namespace Targets::Microchip::Avr8
|
||||
return this->activeProgrammingSession.has_value();
|
||||
}
|
||||
|
||||
std::map<std::string, GpioPadDescriptor> Avr8::generateGpioPadDescriptorMapping(
|
||||
std::map<TargetPadId, GpioPadDescriptor> Avr8::generateGpioPadDescriptorMapping(
|
||||
const std::vector<TargetPeripheralDescriptor>& portPeripheralDescriptors
|
||||
) {
|
||||
auto output = std::map<std::string, GpioPadDescriptor>{};
|
||||
auto output = std::map<TargetPadId, GpioPadDescriptor>{};
|
||||
|
||||
for (const auto& peripheralDescriptor : portPeripheralDescriptors) {
|
||||
if (peripheralDescriptor.registerGroupDescriptorsByKey.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const auto& signalDescriptor : peripheralDescriptor.signalDescriptors) {
|
||||
if (!signalDescriptor.index.has_value()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (output.contains(signalDescriptor.padName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (peripheralDescriptor.registerGroupDescriptorsByKey.empty()) {
|
||||
if (output.contains(signalDescriptor.padId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -712,8 +712,9 @@ namespace Targets::Microchip::Avr8
|
||||
// From a register layout perspective, there are two types of GPIO port modules on AVR8 targets.
|
||||
if (portRegisterGroup.registerDescriptorsByKey.contains("outset")) {
|
||||
output.emplace(
|
||||
signalDescriptor.padName,
|
||||
signalDescriptor.padId,
|
||||
GpioPadDescriptor{
|
||||
signalDescriptor.padKey,
|
||||
registerMask,
|
||||
portRegisterGroup.getRegisterDescriptor("dir"),
|
||||
portRegisterGroup.getRegisterDescriptor("in"),
|
||||
@@ -752,8 +753,9 @@ namespace Targets::Microchip::Avr8
|
||||
|
||||
if (ddrDescriptor.has_value() && inputDescriptor.has_value() && outputDescriptor.has_value()) {
|
||||
output.emplace(
|
||||
signalDescriptor.padName,
|
||||
signalDescriptor.padId,
|
||||
GpioPadDescriptor{
|
||||
signalDescriptor.padKey,
|
||||
registerMask,
|
||||
ddrDescriptor->get(),
|
||||
inputDescriptor->get(),
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "src/Targets/TargetPhysicalInterface.hpp"
|
||||
#include "src/Targets/TargetRegisterDescriptor.hpp"
|
||||
#include "src/Targets/TargetBitFieldDescriptor.hpp"
|
||||
#include "src/Targets/TargetPadDescriptor.hpp"
|
||||
#include "src/Targets/TargetBreakpoint.hpp"
|
||||
|
||||
#include "TargetDescriptionFile.hpp"
|
||||
@@ -104,8 +105,8 @@ namespace Targets::Microchip::Avr8
|
||||
TargetStackPointer getStackPointer() override;
|
||||
void setStackPointer(TargetStackPointer stackPointer) override;
|
||||
|
||||
TargetGpioPinDescriptorAndStatePairs getGpioPinStates(const TargetPinoutDescriptor& pinoutDescriptor) override;
|
||||
void setGpioPinState(const TargetPinDescriptor& pinDescriptor, const TargetGpioPinState& state) override;
|
||||
TargetGpioPadDescriptorAndStatePairs getGpioPadStates(const TargetPadDescriptors& padDescriptors) override;
|
||||
void setGpioPadState(const TargetPadDescriptor& padDescriptor, const TargetGpioPadState& state) override;
|
||||
|
||||
void enableProgrammingMode() override;
|
||||
|
||||
@@ -136,7 +137,7 @@ namespace Targets::Microchip::Avr8
|
||||
std::set<TargetPhysicalInterface> physicalInterfaces;
|
||||
|
||||
std::vector<TargetPeripheralDescriptor> gpioPortPeripheralDescriptors;
|
||||
std::map<std::string, GpioPadDescriptor> gpioPadDescriptorsByPadName;
|
||||
std::map<TargetPadId, GpioPadDescriptor> gpioPadDescriptorsByPadId;
|
||||
|
||||
/**
|
||||
* The stack pointer register on AVR8 targets can take several forms:
|
||||
@@ -163,7 +164,7 @@ namespace Targets::Microchip::Avr8
|
||||
|
||||
std::optional<ProgrammingSession> activeProgrammingSession = std::nullopt;
|
||||
|
||||
static std::map<std::string, GpioPadDescriptor> generateGpioPadDescriptorMapping(
|
||||
static std::map<TargetPadId, GpioPadDescriptor> generateGpioPadDescriptorMapping(
|
||||
const std::vector<TargetPeripheralDescriptor>& portPeripheralDescriptors
|
||||
);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Targets/TargetPadDescriptor.hpp"
|
||||
#include "src/Targets/TargetRegisterDescriptor.hpp"
|
||||
|
||||
namespace Targets::Microchip::Avr8
|
||||
@@ -13,6 +14,8 @@ namespace Targets::Microchip::Avr8
|
||||
*/
|
||||
struct GpioPadDescriptor
|
||||
{
|
||||
const TargetPadId padId;
|
||||
const std::string padKey;
|
||||
std::uint8_t registerMask;
|
||||
|
||||
const TargetRegisterDescriptor& dataDirectionRegisterDescriptor;
|
||||
@@ -20,12 +23,15 @@ namespace Targets::Microchip::Avr8
|
||||
const TargetRegisterDescriptor& outputRegisterDescriptor;
|
||||
|
||||
GpioPadDescriptor(
|
||||
const std::string& padKey,
|
||||
std::uint8_t registerMask,
|
||||
const TargetRegisterDescriptor& dataDirectionRegisterDescriptor,
|
||||
const TargetRegisterDescriptor& inputRegisterDescriptor,
|
||||
const TargetRegisterDescriptor& outputRegisterDescriptor
|
||||
)
|
||||
: registerMask(registerMask)
|
||||
: padId(TargetPadDescriptor::generateId(padKey))
|
||||
, padKey(padKey)
|
||||
, registerMask(registerMask)
|
||||
, dataDirectionRegisterDescriptor(dataDirectionRegisterDescriptor)
|
||||
, inputRegisterDescriptor(inputRegisterDescriptor)
|
||||
, outputRegisterDescriptor(outputRegisterDescriptor)
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace Targets::RiscV
|
||||
this->targetDescriptionFile.getVendorName(),
|
||||
this->targetDescriptionFile.targetAddressSpaceDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetPeripheralDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetPadDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetPinoutDescriptorsByKey(),
|
||||
this->targetDescriptionFile.targetVariantDescriptors(),
|
||||
{} // TODO: populate this
|
||||
@@ -356,11 +357,11 @@ namespace Targets::RiscV
|
||||
});
|
||||
}
|
||||
|
||||
TargetGpioPinDescriptorAndStatePairs RiscV::getGpioPinStates(const TargetPinoutDescriptor& pinoutDescriptor) {
|
||||
TargetGpioPadDescriptorAndStatePairs RiscV::getGpioPadStates(const TargetPadDescriptors& padDescriptors) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void RiscV::setGpioPinState(const TargetPinDescriptor& pinDescriptor, const TargetGpioPinState& state) {
|
||||
void RiscV::setGpioPadState(const TargetPadDescriptor& padDescriptor, const TargetGpioPadState& state) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -85,10 +85,8 @@ namespace Targets::RiscV
|
||||
TargetStackPointer getStackPointer() override;
|
||||
void setStackPointer(TargetStackPointer stackPointer) override;
|
||||
|
||||
TargetGpioPinDescriptorAndStatePairs getGpioPinStates(
|
||||
const TargetPinoutDescriptor& pinoutDescriptor
|
||||
) override;
|
||||
void setGpioPinState(const TargetPinDescriptor& pinDescriptor, const TargetGpioPinState& state) override;
|
||||
TargetGpioPadDescriptorAndStatePairs getGpioPadStates(const TargetPadDescriptors& padDescriptors) override;
|
||||
void setGpioPadState(const TargetPadDescriptor& padDescriptor, const TargetGpioPadState& state) override;
|
||||
|
||||
void enableProgrammingMode() override;
|
||||
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
#include "TargetRegisterDescriptor.hpp"
|
||||
#include "TargetMemory.hpp"
|
||||
#include "TargetBreakpoint.hpp"
|
||||
#include "TargetPinoutDescriptor.hpp"
|
||||
#include "TargetPinDescriptor.hpp"
|
||||
#include "TargetGpioPinState.hpp"
|
||||
#include "TargetPadDescriptor.hpp"
|
||||
#include "TargetGpioPadState.hpp"
|
||||
|
||||
#include "src/DebugToolDrivers/DebugTool.hpp"
|
||||
|
||||
@@ -266,23 +265,19 @@ namespace Targets
|
||||
virtual void setStackPointer(TargetStackPointer stackPointer) = 0;
|
||||
|
||||
/**
|
||||
* Should get the current state of each GPIO pin on the target
|
||||
*
|
||||
* @param pinoutDescriptor
|
||||
* Should get the current state of the given GPIO pads.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
virtual TargetGpioPinDescriptorAndStatePairs getGpioPinStates(
|
||||
const TargetPinoutDescriptor& pinoutDescriptor
|
||||
) = 0;
|
||||
virtual TargetGpioPadDescriptorAndStatePairs getGpioPadStates(const TargetPadDescriptors& padDescriptors) = 0;
|
||||
|
||||
/**
|
||||
* Should update the pin state for the given GPIO pin, with the given state.
|
||||
* Should update the state for the given GPIO pad, with the given state.
|
||||
*
|
||||
* @param pinDescriptor
|
||||
* @param padDescriptor
|
||||
* @param state
|
||||
*/
|
||||
virtual void setGpioPinState(const TargetPinDescriptor& pinDescriptor, const TargetGpioPinState& state) = 0;
|
||||
virtual void setGpioPadState(const TargetPadDescriptor& padDescriptor, const TargetGpioPadState& state) = 0;
|
||||
|
||||
/**
|
||||
* Should prepare the target for programming.
|
||||
|
||||
20
src/Targets/TargetDescription/Pad.hpp
Normal file
20
src/Targets/TargetDescription/Pad.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Targets::TargetDescription
|
||||
{
|
||||
struct Pad
|
||||
{
|
||||
std::string key;
|
||||
std::string name;
|
||||
|
||||
Pad(
|
||||
const std::string& key,
|
||||
const std::string& name
|
||||
)
|
||||
: key(key)
|
||||
, name(name)
|
||||
{}
|
||||
};
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
namespace Targets::TargetDescription
|
||||
{
|
||||
struct Pin
|
||||
{
|
||||
std::string position;
|
||||
std::string pad;
|
||||
std::optional<std::string> padKey;
|
||||
|
||||
Pin(
|
||||
const std::string& position,
|
||||
const std::string& pad
|
||||
const std::optional<std::string>& padKey
|
||||
)
|
||||
: position(position)
|
||||
, pad(pad)
|
||||
, padKey(padKey)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,20 +8,20 @@ namespace Targets::TargetDescription
|
||||
{
|
||||
struct Signal
|
||||
{
|
||||
std::string padId;
|
||||
std::string padKey;
|
||||
std::optional<std::uint16_t> index;
|
||||
std::optional<std::string> function;
|
||||
std::optional<std::string> group;
|
||||
std::optional<std::string> field;
|
||||
|
||||
Signal(
|
||||
const std::string& padId,
|
||||
const std::string& padKey,
|
||||
const std::optional<std::uint16_t>& index,
|
||||
const std::optional<std::string>& function,
|
||||
const std::optional<std::string>& group,
|
||||
const std::optional<std::string>& field
|
||||
)
|
||||
: padId(padId)
|
||||
: padKey(padKey)
|
||||
, index(index)
|
||||
, function(function)
|
||||
, group(group)
|
||||
|
||||
@@ -219,6 +219,22 @@ namespace Targets::TargetDescription
|
||||
return peripheral->get();
|
||||
}
|
||||
|
||||
std::set<const Peripheral*> TargetDescriptionFile::getModulePeripherals(const std::string& moduleKey) const {
|
||||
auto output = std::set<const Peripheral*>{};
|
||||
|
||||
for (const auto& [peripheralKey, peripheral] : this->peripheralsByKey) {
|
||||
if (peripheral.moduleKey == moduleKey) {
|
||||
output.insert(&peripheral);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::set<const Peripheral*> TargetDescriptionFile::getGpioPeripherals() const {
|
||||
return this->getModulePeripherals("gpio_port");
|
||||
}
|
||||
|
||||
std::optional<TargetMemorySegmentDescriptor> TargetDescriptionFile::tryGetTargetMemorySegmentDescriptor(
|
||||
std::string_view addressSpaceKey,
|
||||
std::string_view segmentKey
|
||||
@@ -305,6 +321,20 @@ namespace Targets::TargetDescription
|
||||
return output;
|
||||
}
|
||||
|
||||
std::map<std::string, TargetPadDescriptor> TargetDescriptionFile::targetPadDescriptorsByKey() const {
|
||||
auto output = std::map<std::string, TargetPadDescriptor>{};
|
||||
|
||||
const auto gpioPadKeys = this->getGpioPadKeys();
|
||||
for (const auto& [key, pad] : this->padsByKey) {
|
||||
output.emplace(
|
||||
key,
|
||||
TargetDescriptionFile::targetPadDescriptorFromPad(pad, gpioPadKeys)
|
||||
);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::map<std::string, TargetPinoutDescriptor> TargetDescriptionFile::targetPinoutDescriptorsByKey() const {
|
||||
auto output = std::map<std::string, TargetPinoutDescriptor>{};
|
||||
|
||||
@@ -421,6 +451,15 @@ namespace Targets::TargetDescription
|
||||
this->peripheralsByKey.emplace(peripheral.key, std::move(peripheral));
|
||||
}
|
||||
|
||||
for (
|
||||
auto element = deviceElement.firstChildElement("pads").firstChildElement("pad");
|
||||
!element.isNull();
|
||||
element = element.nextSiblingElement("pad")
|
||||
) {
|
||||
auto pad = TargetDescriptionFile::padFromXml(element);
|
||||
this->padsByKey.emplace(pad.key, std::move(pad));
|
||||
}
|
||||
|
||||
for (
|
||||
auto element = deviceElement.firstChildElement("pinouts").firstChildElement("pinout");
|
||||
!element.isNull();
|
||||
@@ -461,6 +500,17 @@ namespace Targets::TargetDescription
|
||||
return attribute->get();
|
||||
}
|
||||
|
||||
std::set<std::string> TargetDescriptionFile::getGpioPadKeys() const {
|
||||
auto output = std::set<std::string>{};
|
||||
for (const auto* peripheral : this->getGpioPeripherals()) {
|
||||
for (const auto& signal : peripheral->sigs) {
|
||||
output.insert(signal.padKey);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::optional<std::string> TargetDescriptionFile::tryGetAttribute(
|
||||
const QDomElement& element,
|
||||
const QString& attributeName
|
||||
@@ -806,7 +856,7 @@ namespace Targets::TargetDescription
|
||||
const auto index = TargetDescriptionFile::tryGetAttribute(xmlElement, "index");
|
||||
|
||||
return {
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "pad-id"),
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "pad-key"),
|
||||
index.has_value() ? std::optional{StringService::toUint64(*index)} : std::nullopt,
|
||||
TargetDescriptionFile::tryGetAttribute(xmlElement, "function"),
|
||||
TargetDescriptionFile::tryGetAttribute(xmlElement, "group"),
|
||||
@@ -814,6 +864,13 @@ namespace Targets::TargetDescription
|
||||
};
|
||||
}
|
||||
|
||||
Pad TargetDescriptionFile::padFromXml(const QDomElement& xmlElement) {
|
||||
return {
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "key"),
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "name")
|
||||
};
|
||||
}
|
||||
|
||||
Pinout TargetDescriptionFile::pinoutFromXml(const QDomElement& xmlElement) {
|
||||
static const auto typesByName = BiMap<std::string, TargetPinoutType>{
|
||||
{"soic", TargetPinoutType::SOIC},
|
||||
@@ -857,15 +914,14 @@ namespace Targets::TargetDescription
|
||||
Pin TargetDescriptionFile::pinFromXml(const QDomElement& xmlElement) {
|
||||
return {
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "position"),
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "pad")
|
||||
TargetDescriptionFile::tryGetAttribute(xmlElement, "pad-key")
|
||||
};
|
||||
}
|
||||
|
||||
Variant TargetDescriptionFile::variantFromXml(const QDomElement& xmlElement) {
|
||||
return {
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "name"),
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "pinout-key"),
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "package")
|
||||
TargetDescriptionFile::getAttribute(xmlElement, "pinout-key")
|
||||
};
|
||||
}
|
||||
|
||||
@@ -954,7 +1010,7 @@ namespace Targets::TargetDescription
|
||||
const Signal& signal
|
||||
) {
|
||||
return {
|
||||
signal.padId,
|
||||
signal.padKey,
|
||||
signal.index
|
||||
};
|
||||
}
|
||||
@@ -1075,6 +1131,41 @@ namespace Targets::TargetDescription
|
||||
};
|
||||
}
|
||||
|
||||
TargetPadDescriptor TargetDescriptionFile::targetPadDescriptorFromPad(
|
||||
const Pad& pad,
|
||||
const std::set<std::string>& gpioPadKeys
|
||||
) {
|
||||
static const auto resolvePadType = [&gpioPadKeys] (const Pad& pad) -> TargetPadType {
|
||||
if (gpioPadKeys.contains(pad.key)) {
|
||||
return TargetPadType::GPIO;
|
||||
}
|
||||
|
||||
const auto padNameLower = StringService::asciiToLower(pad.name);
|
||||
|
||||
if (
|
||||
padNameLower.find("vcc") == 0
|
||||
|| padNameLower.find("avcc") == 0
|
||||
|| padNameLower.find("aref") == 0
|
||||
|| padNameLower.find("avdd") == 0
|
||||
|| padNameLower.find("vdd") == 0
|
||||
) {
|
||||
return TargetPadType::VCC;
|
||||
}
|
||||
|
||||
if (padNameLower.find("gnd") == 0 || padNameLower.find("agnd") == 0) {
|
||||
return TargetPadType::GND;
|
||||
}
|
||||
|
||||
return TargetPadType::OTHER;
|
||||
};
|
||||
|
||||
return {
|
||||
pad.key,
|
||||
pad.name,
|
||||
resolvePadType(pad)
|
||||
};
|
||||
}
|
||||
|
||||
TargetPinoutDescriptor TargetDescriptionFile::targetPinoutDescriptorFromPinout(const Pinout& pinout) {
|
||||
auto output = TargetPinoutDescriptor{
|
||||
pinout.key,
|
||||
@@ -1091,30 +1182,9 @@ namespace Targets::TargetDescription
|
||||
}
|
||||
|
||||
TargetPinDescriptor TargetDescriptionFile::targetPinDescriptorFromPin(const Pin& pin) {
|
||||
static const auto resolvePinType = [] (const std::string& pad) -> TargetPinType {
|
||||
const auto padLower = StringService::asciiToLower(pad);
|
||||
|
||||
if (
|
||||
padLower.find("vcc") == 0
|
||||
|| padLower.find("avcc") == 0
|
||||
|| padLower.find("aref") == 0
|
||||
|| padLower.find("avdd") == 0
|
||||
|| padLower.find("vdd") == 0
|
||||
) {
|
||||
return TargetPinType::VCC;
|
||||
}
|
||||
|
||||
if (padLower.find("gnd") == 0) {
|
||||
return TargetPinType::GND;
|
||||
}
|
||||
|
||||
return TargetPinType::OTHER;
|
||||
};
|
||||
|
||||
return {
|
||||
pin.pad,
|
||||
pin.position,
|
||||
resolvePinType(pin.pad)
|
||||
pin.padKey
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "PropertyGroup.hpp"
|
||||
#include "AddressSpace.hpp"
|
||||
@@ -19,6 +20,7 @@
|
||||
#include "RegisterGroupReference.hpp"
|
||||
#include "Peripheral.hpp"
|
||||
#include "RegisterGroupInstance.hpp"
|
||||
#include "Pad.hpp"
|
||||
#include "Signal.hpp"
|
||||
#include "Pinout.hpp"
|
||||
#include "Pin.hpp"
|
||||
@@ -129,6 +131,9 @@ namespace Targets::TargetDescription
|
||||
std::string_view key
|
||||
) const;
|
||||
[[nodiscard]] const Peripheral& getPeripheral(std::string_view key) const;
|
||||
[[nodiscard]] std::set<const Peripheral*> getModulePeripherals(const std::string& moduleKey) const;
|
||||
[[nodiscard]] std::set<const Peripheral*> getGpioPeripherals() const;
|
||||
|
||||
|
||||
[[nodiscard]] std::optional<TargetMemorySegmentDescriptor> tryGetTargetMemorySegmentDescriptor(
|
||||
std::string_view addressSpaceKey,
|
||||
@@ -146,6 +151,7 @@ namespace Targets::TargetDescription
|
||||
|
||||
[[nodiscard]] std::map<std::string, TargetAddressSpaceDescriptor> targetAddressSpaceDescriptorsByKey() const;
|
||||
[[nodiscard]] std::map<std::string, TargetPeripheralDescriptor> targetPeripheralDescriptorsByKey() const;
|
||||
[[nodiscard]] std::map<std::string, TargetPadDescriptor> targetPadDescriptorsByKey() const;
|
||||
[[nodiscard]] std::map<std::string, TargetPinoutDescriptor> targetPinoutDescriptorsByKey() const;
|
||||
[[nodiscard]] std::vector<TargetVariantDescriptor> targetVariantDescriptors() const;
|
||||
[[nodiscard]] std::vector<TargetPeripheralDescriptor> gpioPortPeripheralDescriptors() const;
|
||||
@@ -157,6 +163,7 @@ namespace Targets::TargetDescription
|
||||
std::vector<PhysicalInterface> physicalInterfaces;
|
||||
std::map<std::string, Module, std::less<void>> modulesByKey;
|
||||
std::map<std::string, Peripheral, std::less<void>> peripheralsByKey;
|
||||
std::map<std::string, Pad, std::less<void>> padsByKey;
|
||||
std::map<std::string, Pinout, std::less<void>> pinoutsByKey;
|
||||
std::vector<Variant> variants;
|
||||
|
||||
@@ -177,6 +184,8 @@ namespace Targets::TargetDescription
|
||||
) const;
|
||||
const std::string& getDeviceAttribute(const std::string& attributeName) const;
|
||||
|
||||
[[nodiscard]] std::set<std::string> getGpioPadKeys() const;
|
||||
|
||||
static std::optional<std::string> tryGetAttribute(const QDomElement& element, const QString& attributeName);
|
||||
static std::string getAttribute(const QDomElement& element, const QString& attributeName);
|
||||
|
||||
@@ -194,6 +203,7 @@ namespace Targets::TargetDescription
|
||||
static Peripheral peripheralFromXml(const QDomElement& xmlElement);
|
||||
static RegisterGroupInstance registerGroupInstanceFromXml(const QDomElement& xmlElement);
|
||||
static Signal signalFromXml(const QDomElement& xmlElement);
|
||||
static Pad padFromXml(const QDomElement& xmlElement);
|
||||
static Pinout pinoutFromXml(const QDomElement& xmlElement);
|
||||
static Pin pinFromXml(const QDomElement& xmlElement);
|
||||
static Variant variantFromXml(const QDomElement& xmlElement);
|
||||
@@ -236,6 +246,11 @@ namespace Targets::TargetDescription
|
||||
|
||||
static TargetBitFieldDescriptor targetBitFieldDescriptorFromBitField(const BitField& bitField);
|
||||
|
||||
static TargetPadDescriptor targetPadDescriptorFromPad(
|
||||
const Pad& pad,
|
||||
const std::set<std::string>& gpioPadKeys
|
||||
);
|
||||
|
||||
static TargetPinoutDescriptor targetPinoutDescriptorFromPinout(const Pinout& pinout);
|
||||
static TargetPinDescriptor targetPinDescriptorFromPin(const Pin& pin);
|
||||
|
||||
|
||||
@@ -8,16 +8,13 @@ namespace Targets::TargetDescription
|
||||
{
|
||||
std::string name;
|
||||
std::string pinoutKey;
|
||||
std::string package;
|
||||
|
||||
Variant(
|
||||
const std::string& name,
|
||||
const std::string& pinoutKey,
|
||||
const std::string& package
|
||||
const std::string& pinoutKey
|
||||
)
|
||||
: name(name)
|
||||
, pinoutKey(pinoutKey)
|
||||
, package(package)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Targets
|
||||
const std::string& vendorName,
|
||||
std::map<std::string, TargetAddressSpaceDescriptor>&& addressSpaceDescriptorsByKey,
|
||||
std::map<std::string, TargetPeripheralDescriptor>&& peripheralDescriptorsByKey,
|
||||
std::map<std::string, TargetPadDescriptor>&& padDescriptorsByKey,
|
||||
std::map<std::string, TargetPinoutDescriptor>&& pinoutDescriptorsByKey,
|
||||
std::vector<TargetVariantDescriptor>&& variantDescriptors,
|
||||
const BreakpointResources& breakpointResources
|
||||
@@ -23,6 +24,7 @@ namespace Targets
|
||||
, vendorName(vendorName)
|
||||
, addressSpaceDescriptorsByKey(std::move(addressSpaceDescriptorsByKey))
|
||||
, peripheralDescriptorsByKey(std::move(peripheralDescriptorsByKey))
|
||||
, padDescriptorsByKey(std::move(padDescriptorsByKey))
|
||||
, pinoutDescriptorsByKey(std::move(pinoutDescriptorsByKey))
|
||||
, variantDescriptors(std::move(variantDescriptors))
|
||||
, breakpointResources(breakpointResources)
|
||||
@@ -92,6 +94,30 @@ namespace Targets
|
||||
return descriptor->get();
|
||||
}
|
||||
|
||||
std::optional<
|
||||
std::reference_wrapper<const TargetPadDescriptor>
|
||||
> TargetDescriptor::tryGetPadDescriptor(const std::string& key) const {
|
||||
const auto descriptorIt = this->padDescriptorsByKey.find(key);
|
||||
|
||||
if (descriptorIt == this->padDescriptorsByKey.end()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::cref(descriptorIt->second);
|
||||
}
|
||||
|
||||
const TargetPadDescriptor& TargetDescriptor::getPadDescriptor(const std::string& key) const {
|
||||
const auto descriptor = this->tryGetPadDescriptor(key);
|
||||
if (!descriptor.has_value()) {
|
||||
throw Exceptions::InternalFatalErrorException{
|
||||
"Failed to get pad descriptor \"" + std::string{key}
|
||||
+ "\" from target descriptor - descriptor not found"
|
||||
};
|
||||
}
|
||||
|
||||
return descriptor->get();
|
||||
}
|
||||
|
||||
std::optional<
|
||||
std::reference_wrapper<const TargetPinoutDescriptor>
|
||||
> TargetDescriptor::tryGetPinoutDescriptor(const std::string& key) const {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "TargetMemory.hpp"
|
||||
#include "TargetAddressSpaceDescriptor.hpp"
|
||||
#include "TargetPeripheralDescriptor.hpp"
|
||||
#include "TargetPadDescriptor.hpp"
|
||||
#include "TargetPinoutDescriptor.hpp"
|
||||
#include "TargetVariantDescriptor.hpp"
|
||||
#include "TargetBreakpoint.hpp"
|
||||
@@ -25,6 +26,7 @@ namespace Targets
|
||||
std::string vendorName;
|
||||
std::map<std::string, TargetAddressSpaceDescriptor> addressSpaceDescriptorsByKey;
|
||||
std::map<std::string, TargetPeripheralDescriptor> peripheralDescriptorsByKey;
|
||||
std::map<std::string, TargetPadDescriptor> padDescriptorsByKey;
|
||||
std::map<std::string, TargetPinoutDescriptor> pinoutDescriptorsByKey;
|
||||
std::vector<TargetVariantDescriptor> variantDescriptors;
|
||||
BreakpointResources breakpointResources;
|
||||
@@ -36,6 +38,7 @@ namespace Targets
|
||||
const std::string& vendorName,
|
||||
std::map<std::string, TargetAddressSpaceDescriptor>&& addressSpaceDescriptorsByKey,
|
||||
std::map<std::string, TargetPeripheralDescriptor>&& peripheralDescriptorsByKey,
|
||||
std::map<std::string, TargetPadDescriptor>&& padDescriptorsByKey,
|
||||
std::map<std::string, TargetPinoutDescriptor>&& pinoutDescriptorsByKey,
|
||||
std::vector<TargetVariantDescriptor>&& variantDescriptors,
|
||||
const BreakpointResources& breakpointResources
|
||||
@@ -71,6 +74,12 @@ namespace Targets
|
||||
|
||||
const TargetPeripheralDescriptor& getPeripheralDescriptor(const std::string& key) const;
|
||||
|
||||
std::optional<std::reference_wrapper<const TargetPadDescriptor>> tryGetPadDescriptor(
|
||||
const std::string& key
|
||||
) const;
|
||||
|
||||
const TargetPadDescriptor& getPadDescriptor(const std::string& key) const;
|
||||
|
||||
std::optional<std::reference_wrapper<const TargetPinoutDescriptor>> tryGetPinoutDescriptor(
|
||||
const std::string& key
|
||||
) const;
|
||||
|
||||
50
src/Targets/TargetGpioPadState.hpp
Normal file
50
src/Targets/TargetGpioPadState.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <QMetaType>
|
||||
|
||||
#include "TargetPadDescriptor.hpp"
|
||||
|
||||
#include "src/Helpers/Pair.hpp"
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
struct TargetGpioPadState
|
||||
{
|
||||
enum class State: std::uint8_t
|
||||
{
|
||||
HIGH,
|
||||
LOW,
|
||||
};
|
||||
|
||||
enum class DataDirection: std::uint8_t
|
||||
{
|
||||
INPUT,
|
||||
OUTPUT,
|
||||
};
|
||||
|
||||
State value;
|
||||
DataDirection direction;
|
||||
|
||||
TargetGpioPadState(
|
||||
State value,
|
||||
DataDirection direction
|
||||
)
|
||||
: value(value)
|
||||
, direction(direction)
|
||||
{}
|
||||
|
||||
bool operator == (const TargetGpioPadState& other) const {
|
||||
return this->value == other.value && this->direction == other.direction;
|
||||
}
|
||||
|
||||
bool operator != (const TargetGpioPadState& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
using TargetGpioPadDescriptorAndStatePair = Pair<const TargetPadDescriptor&, TargetGpioPadState>;
|
||||
using TargetGpioPadDescriptorAndStatePairs = std::vector<TargetGpioPadDescriptorAndStatePair>;
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Targets::TargetGpioPadState)
|
||||
@@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <QMetaType>
|
||||
|
||||
#include "TargetPinDescriptor.hpp"
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
struct TargetGpioPinState
|
||||
{
|
||||
enum class State: std::uint8_t
|
||||
{
|
||||
HIGH,
|
||||
LOW,
|
||||
};
|
||||
|
||||
enum class DataDirection: std::uint8_t
|
||||
{
|
||||
INPUT,
|
||||
OUTPUT,
|
||||
};
|
||||
|
||||
State value;
|
||||
DataDirection direction;
|
||||
|
||||
TargetGpioPinState(
|
||||
State value,
|
||||
DataDirection direction
|
||||
)
|
||||
: value(value)
|
||||
, direction(direction)
|
||||
{}
|
||||
};
|
||||
|
||||
using TargetGpioPinDescriptorAndStatePair = Pair<const TargetPinDescriptor&, TargetGpioPinState>;
|
||||
using TargetGpioPinDescriptorAndStatePairs = std::vector<TargetGpioPinDescriptorAndStatePair>;
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Targets::TargetGpioPinState)
|
||||
29
src/Targets/TargetPadDescriptor.cpp
Normal file
29
src/Targets/TargetPadDescriptor.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "TargetPadDescriptor.hpp"
|
||||
|
||||
#include "src/Services/StringService.hpp"
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
TargetPadDescriptor::TargetPadDescriptor(
|
||||
const std::string& key,
|
||||
const std::string& name,
|
||||
TargetPadType type
|
||||
)
|
||||
: id(TargetPadDescriptor::generateId(key))
|
||||
, key(key)
|
||||
, name(name)
|
||||
, type(type)
|
||||
{}
|
||||
|
||||
bool TargetPadDescriptor::operator == (const TargetPadDescriptor& other) const {
|
||||
return this->id == other.id;
|
||||
}
|
||||
|
||||
bool TargetPadDescriptor::operator != (const TargetPadDescriptor& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
TargetPadId TargetPadDescriptor::generateId(const std::string& padKey) {
|
||||
return Services::StringService::generateUniqueInteger(padKey);
|
||||
}
|
||||
}
|
||||
45
src/Targets/TargetPadDescriptor.hpp
Normal file
45
src/Targets/TargetPadDescriptor.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
enum class TargetPadType: std::uint8_t
|
||||
{
|
||||
GPIO,
|
||||
GND,
|
||||
VCC,
|
||||
OTHER,
|
||||
};
|
||||
|
||||
using TargetPadId = std::size_t;
|
||||
|
||||
struct TargetPadDescriptor
|
||||
{
|
||||
public:
|
||||
const TargetPadId id;
|
||||
const std::string key;
|
||||
std::string name;
|
||||
TargetPadType type = TargetPadType::OTHER;
|
||||
|
||||
TargetPadDescriptor(
|
||||
const std::string& key,
|
||||
const std::string& name,
|
||||
TargetPadType type
|
||||
);
|
||||
|
||||
TargetPadDescriptor(const TargetPadDescriptor& other) = delete;
|
||||
TargetPadDescriptor& operator = (const TargetPadDescriptor& other) = delete;
|
||||
|
||||
TargetPadDescriptor(TargetPadDescriptor&& other) noexcept = default;
|
||||
|
||||
bool operator == (const TargetPadDescriptor& other) const;
|
||||
bool operator != (const TargetPadDescriptor& other) const;
|
||||
|
||||
static TargetPadId generateId(const std::string& padKey);
|
||||
};
|
||||
|
||||
using TargetPadDescriptors = std::vector<TargetPadDescriptor*>;
|
||||
}
|
||||
@@ -3,16 +3,17 @@
|
||||
namespace Targets
|
||||
{
|
||||
TargetPeripheralSignalDescriptor::TargetPeripheralSignalDescriptor(
|
||||
const std::string& padName,
|
||||
const std::string& padKey,
|
||||
const std::optional<std::uint16_t>& index
|
||||
)
|
||||
: padName(padName)
|
||||
: padId(TargetPadDescriptor::generateId(padKey))
|
||||
, padKey(padKey)
|
||||
, index(index)
|
||||
{}
|
||||
|
||||
TargetPeripheralSignalDescriptor TargetPeripheralSignalDescriptor::clone() const {
|
||||
return {
|
||||
this->padName,
|
||||
this->padKey,
|
||||
this->index
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,16 +4,19 @@
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
#include "TargetPadDescriptor.hpp"
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
struct TargetPeripheralSignalDescriptor
|
||||
{
|
||||
public:
|
||||
std::string padName;
|
||||
const TargetPadId padId;
|
||||
const std::string padKey;
|
||||
std::optional<std::uint16_t> index;
|
||||
|
||||
TargetPeripheralSignalDescriptor(
|
||||
const std::string& padName,
|
||||
const std::string& padKey,
|
||||
const std::optional<std::uint16_t>& index
|
||||
);
|
||||
|
||||
@@ -21,7 +24,6 @@ namespace Targets
|
||||
TargetPeripheralSignalDescriptor& operator = (const TargetPeripheralSignalDescriptor& other) = delete;
|
||||
|
||||
TargetPeripheralSignalDescriptor(TargetPeripheralSignalDescriptor&& other) noexcept = default;
|
||||
TargetPeripheralSignalDescriptor& operator = (TargetPeripheralSignalDescriptor&& other) = default;
|
||||
|
||||
[[nodiscard]] TargetPeripheralSignalDescriptor clone() const;
|
||||
};
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#include "TargetPinDescriptor.hpp"
|
||||
|
||||
#include "src/Services/StringService.hpp"
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
TargetPinDescriptor::TargetPinDescriptor(
|
||||
const std::string& padName,
|
||||
const std::string& position,
|
||||
TargetPinType type
|
||||
const std::optional<std::string>& padKey
|
||||
)
|
||||
: padName(padName)
|
||||
, position(position)
|
||||
, type(type)
|
||||
: position(position)
|
||||
, numericPosition(Services::StringService::toUint16(this->position, 10))
|
||||
, padKey(padKey)
|
||||
{}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,20 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
namespace Targets
|
||||
{
|
||||
enum class TargetPinType: std::uint8_t
|
||||
{
|
||||
GPIO,
|
||||
GND,
|
||||
VCC,
|
||||
OTHER,
|
||||
};
|
||||
|
||||
struct TargetPinDescriptor
|
||||
{
|
||||
public:
|
||||
std::string padName;
|
||||
std::string position;
|
||||
TargetPinType type = TargetPinType::OTHER;
|
||||
std::uint16_t numericPosition;
|
||||
std::optional<std::string> padKey;
|
||||
|
||||
TargetPinDescriptor(
|
||||
const std::string& padName,
|
||||
const std::string& position,
|
||||
TargetPinType type
|
||||
const std::optional<std::string>& padKey
|
||||
);
|
||||
|
||||
TargetPinDescriptor(const TargetPinDescriptor& other) = delete;
|
||||
|
||||
Reference in New Issue
Block a user