More tidying

This commit is contained in:
Nav
2022-05-01 19:02:04 +01:00
parent e6cd1faef1
commit 64de134a28
4 changed files with 23 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ namespace Bloom::TargetController::Commands
{ {
GENERIC, GENERIC,
GET_TARGET_CONTROLLER_STATE, GET_TARGET_CONTROLLER_STATE,
GET_TARGET_DESCRIPTOR,
STOP_TARGET_EXECUTION, STOP_TARGET_EXECUTION,
RESUME_TARGET_EXECUTION, RESUME_TARGET_EXECUTION,
RESET_TARGET, RESET_TARGET,
@@ -24,6 +25,5 @@ namespace Bloom::TargetController::Commands
SET_TARGET_PIN_STATE, SET_TARGET_PIN_STATE,
GET_TARGET_STACK_POINTER, GET_TARGET_STACK_POINTER,
GET_TARGET_PROGRAM_COUNTER, GET_TARGET_PROGRAM_COUNTER,
GET_TARGET_DESCRIPTOR,
}; };
} }

View File

@@ -8,12 +8,12 @@ namespace Bloom::TargetController::Responses
{ {
GENERIC, GENERIC,
ERROR, ERROR,
TARGET_DESCRIPTOR,
TARGET_REGISTERS_READ, TARGET_REGISTERS_READ,
TARGET_MEMORY_READ, TARGET_MEMORY_READ,
TARGET_STATE, TARGET_STATE,
TARGET_PIN_STATES, TARGET_PIN_STATES,
TARGET_STACK_POINTER, TARGET_STACK_POINTER,
TARGET_PROGRAM_COUNTER, TARGET_PROGRAM_COUNTER,
TARGET_DESCRIPTOR,
}; };
} }

View File

@@ -21,13 +21,8 @@
#include "Commands/GetTargetStackPointer.hpp" #include "Commands/GetTargetStackPointer.hpp"
#include "Commands/GetTargetProgramCounter.hpp" #include "Commands/GetTargetProgramCounter.hpp"
#include "src/Logger/Logger.hpp"
namespace Bloom::TargetController namespace Bloom::TargetController
{ {
using namespace Bloom::Targets;
using namespace Bloom::Exceptions;
using Commands::GetTargetDescriptor; using Commands::GetTargetDescriptor;
using Commands::GetTargetState; using Commands::GetTargetState;
using Commands::StopTargetExecution; using Commands::StopTargetExecution;
@@ -46,6 +41,22 @@ namespace Bloom::TargetController
using Commands::GetTargetStackPointer; using Commands::GetTargetStackPointer;
using Commands::GetTargetProgramCounter; using Commands::GetTargetProgramCounter;
using Targets::TargetDescriptor;
using Targets::TargetState;
using Targets::TargetRegisters;
using Targets::TargetRegisterDescriptors;
using Targets::TargetMemoryType;
using Targets::TargetMemoryAddressRange;
using Targets::TargetMemoryBuffer;
using Targets::TargetBreakpoint;
using Targets::TargetPinDescriptor;
using Targets::TargetPinState;
using Targets::TargetPinStateMappingType;
TargetControllerState TargetControllerConsole::getTargetControllerState() { TargetControllerState TargetControllerConsole::getTargetControllerState() {
return TargetControllerComponent::getState(); return TargetControllerComponent::getState();
} }
@@ -59,14 +70,14 @@ namespace Bloom::TargetController
} }
} }
Targets::TargetDescriptor TargetControllerConsole::getTargetDescriptor() { TargetDescriptor TargetControllerConsole::getTargetDescriptor() {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetDescriptor>(), std::make_unique<GetTargetDescriptor>(),
this->defaultTimeout this->defaultTimeout
)->targetDescriptor; )->targetDescriptor;
} }
Targets::TargetState TargetControllerConsole::getTargetState() { TargetState TargetControllerConsole::getTargetState() {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetState>(), std::make_unique<GetTargetState>(),
this->defaultTimeout this->defaultTimeout
@@ -124,7 +135,7 @@ namespace Bloom::TargetController
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, std::uint32_t startAddress,
std::uint32_t bytes, std::uint32_t bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges const std::set<TargetMemoryAddressRange>& excludedAddressRanges
) { ) {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<ReadTargetMemory>( std::make_unique<ReadTargetMemory>(
@@ -176,7 +187,7 @@ namespace Bloom::TargetController
); );
} }
Targets::TargetPinStateMappingType TargetControllerConsole::getPinStates(int variantId) { TargetPinStateMappingType TargetControllerConsole::getPinStates(int variantId) {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetPinStates>(variantId), std::make_unique<GetTargetPinStates>(variantId),
this->defaultTimeout this->defaultTimeout

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <chrono>
#include <optional> #include <optional>
#include "CommandManager.hpp" #include "CommandManager.hpp"