Target driver passthrough commands

Added `pm` commands to manage the program mode of WCH targets
This commit is contained in:
Nav
2024-12-15 17:32:58 +00:00
parent 1392cda74f
commit 40859201e4
16 changed files with 243 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ namespace Services
using TargetController::Commands::EnableProgrammingMode;
using TargetController::Commands::DisableProgrammingMode;
using TargetController::Commands::Shutdown;
using TargetController::Commands::InvokeTargetPassthroughCommand;
using Targets::TargetDescriptor;
using Targets::TargetState;
@@ -345,6 +346,16 @@ namespace Services
);
}
std::optional<Targets::PassthroughResponse> TargetControllerService::invokeTargetPassthroughCommand(
Targets::PassthroughCommand&& command
) const {
return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<InvokeTargetPassthroughCommand>(std::move(command)),
this->defaultTimeout,
this->activeAtomicSessionId
)->response;
}
TargetControllerService::AtomicSession TargetControllerService::makeAtomicSession() {
return AtomicSession{*this};
}

View File

@@ -20,6 +20,8 @@
#include "src/Targets/TargetGpioPadState.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Targets/TargetBreakpoint.hpp"
#include "src/Targets/PassthroughCommand.hpp"
#include "src/Targets/PassthroughResponse.hpp"
#include "src/Exceptions/Exception.hpp"
@@ -266,6 +268,10 @@ namespace Services
*/
void shutdown() const;
std::optional<Targets::PassthroughResponse> invokeTargetPassthroughCommand(
Targets::PassthroughCommand&& command
) const;
/**
* Starts a new atomic session with the TC, via an TargetControllerService::AtomicSession RAII object.
* The session will end when the object is destroyed.