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

@@ -51,6 +51,7 @@ namespace TargetController
using Commands::GetTargetProgramCounter;
using Commands::EnableProgrammingMode;
using Commands::DisableProgrammingMode;
using Commands::InvokeTargetPassthroughCommand;
using Responses::Response;
using Responses::AtomicSessionId;
@@ -60,6 +61,7 @@ namespace TargetController
using Responses::TargetStackPointer;
using Responses::TargetProgramCounter;
using Responses::ProgramBreakpoint;
using Responses::TargetPassthroughResponse;
TargetControllerComponent::TargetControllerComponent(
const ProjectConfig& projectConfig,
@@ -262,6 +264,10 @@ namespace TargetController
std::bind(&TargetControllerComponent::handleDisableProgrammingMode, this, std::placeholders::_1)
);
this->registerCommandHandler<InvokeTargetPassthroughCommand>(
std::bind(&TargetControllerComponent::handleTargetPassthroughCommand, this, std::placeholders::_1)
);
// Register event handlers
this->eventListener->registerCallbackForEventType<Events::ShutdownTargetController>(
std::bind(&TargetControllerComponent::onShutdownTargetControllerEvent, this, std::placeholders::_1)
@@ -1173,4 +1179,10 @@ namespace TargetController
return std::make_unique<Response>();
}
std::unique_ptr<TargetPassthroughResponse> TargetControllerComponent::handleTargetPassthroughCommand(
InvokeTargetPassthroughCommand& command
) {
return std::make_unique<TargetPassthroughResponse>(this->target->invokePassthroughCommand(command.command));
}
}