Device: Allow skipping of device state refreshing on call to open

This commit is contained in:
Max Brombach
2026-11-03 11:20:04 -05:00
committed by Kyle Schwarz
parent dffb0bcefb
commit 645549193d
21 changed files with 124 additions and 166 deletions
@@ -31,7 +31,7 @@ public:
return true;
}
bool finalize() override;
bool flash(const FWRepo& repo, const icsneo::Device::OpenStatusHandler& handler) override;
bool flash(const FWRepo& repo, const StatusHandler& handler) override;
bool open() override {
return true;
@@ -42,8 +42,8 @@ public:
}
bool authenticate();
bool sendSoftware(const std::vector<uint8_t>& bin, const icsneo::Device::OpenStatusHandler& handler);
bool sendSoftware(const std::vector<IEF::Sector>& sectors, uint32_t blockSize, const icsneo::Device::OpenStatusHandler& handler);
bool sendSoftware(const std::vector<uint8_t>& bin, const StatusHandler& handler);
bool sendSoftware(const std::vector<IEF::Sector>& sectors, uint32_t blockSize, const StatusHandler& handler);
bool validateFirmware(const DeviceAppVersion& chipSrcVer);
bool validateComponent();
@@ -74,12 +74,12 @@ private:
const bool doAuthChecks;
const bool encrypted;
using StatusHandler = std::function<void(double progress)>;
bool sendCommand(Update command, const StatusHandler& handler, uint32_t offset = 0,
using CommandStatusHandler = std::function<void(double progress)>;
bool sendCommand(Update command, const CommandStatusHandler& handler, uint32_t offset = 0,
const std::vector<uint8_t>& args = {}, std::chrono::milliseconds timeout = std::chrono::milliseconds(3000)) {
return sendCommand(command, offset, static_cast<uint32_t>(args.size()), handler, timeout, args);
}
bool sendCommand(Update command, uint32_t offset, uint32_t length, const StatusHandler& handler,
bool sendCommand(Update command, uint32_t offset, uint32_t length, const CommandStatusHandler& handler,
std::chrono::milliseconds timeout = std::chrono::milliseconds(3000), std::vector<uint8_t> args = {});
};
@@ -5,6 +5,7 @@
#include "icsneo/device/extensions/bootloader/chip.h"
#include "icsneo/device/device.h"
#include "icsneo/device/extensions/bootloader/api.h"
#include <cstdint>
@@ -29,7 +30,7 @@ public:
virtual bool enterApplication() = 0;
virtual bool hasFinalizationStep() const = 0;
virtual bool finalize() = 0;
virtual bool flash(const FWRepo& repo, const icsneo::Device::OpenStatusHandler& handler) = 0;
virtual bool flash(const FWRepo& repo, const StatusHandler& handler) = 0;
virtual bool open() = 0;
virtual bool close() = 0;
@@ -69,7 +69,7 @@ protected:
Response& sendRequest(const Request& request, std::chrono::milliseconds timeout = std::chrono::milliseconds(2000));
bool sendRequestNoResponse();
icsneo::Device::OpenStatusHandler logger; // Progress updates, set in flash()
StatusHandler statusHandler; // Progress updates, set in flash()
Response lastResponse; // Last response received from sendRequest
bool supportsZynqBinaryFlasher = false; // Dictates how messages are formatted, this gets set in initialize()
@@ -92,7 +92,7 @@ public:
bool enterApplication() override;
bool finalize() override;
bool flash(const FWRepo& fw, const icsneo::Device::OpenStatusHandler& handler) override;
bool flash(const FWRepo& fw, const StatusHandler& handler) override;
bool open() override;
bool close() override;
@@ -22,7 +22,7 @@ private:
public:
RADMultiChipCommunication(icsneo::Device& dev, const ChipInfo& chipToFlash, bool auth, uint8_t slot = UINT8_MAX);
bool flash(const FWRepo& fw, const icsneo::Device::OpenStatusHandler& handler) override;
bool flash(const FWRepo& fw, const StatusHandler& handler) override;
bool open() override;
bool close() override;
bool enterApplication() override;
@@ -79,7 +79,7 @@ public:
RADPeriphCommunication(icsneo::Device& dev, const ChipInfo& chipToFlash);
~RADPeriphCommunication();
bool flash(const FWRepo& fw, const icsneo::Device::OpenStatusHandler& handler) override;
bool flash(const FWRepo& fw, const StatusHandler& handler) override;
bool open() override;
bool close() override;
bool enterApplication() override;
@@ -23,7 +23,7 @@ class REDCommunication : public REDCommunicationBase {
public:
REDCommunication(icsneo::Device& dev, const ChipInfo& chip, bool auth, bool encryptWithDeviceKey = true);
bool enterApplication() override { return sendCommand(uint8_t(Command::EnterApplication)); }
bool flash(const FWRepo& fw, const icsneo::Device::OpenStatusHandler& handler) override;
bool flash(const FWRepo& fw, const StatusHandler& handler) override;
bool open() override;
private:
@@ -27,7 +27,7 @@ public:
using REDCommunicationBase::REDCommunicationBase;
bool enterApplication() override { return false; }
bool flash(const FWRepo& fw, const icsneo::Device::OpenStatusHandler& handler) override;
bool flash(const FWRepo& fw, const StatusHandler& handler) override;
private:
/**
* Core flasher commands are tunneled through a RED request using CoreFlasherCommand,