New TargetPowerManagementInterface class, for debug tools that support target power management functions

This commit is contained in:
Nav
2022-03-16 17:06:57 +00:00
parent 14bdfbf89a
commit a3911cebf5
2 changed files with 50 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include "TargetInterfaces/TargetPowerManagementInterface.hpp"
#include "TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp"
#include "TargetInterfaces/Microchip/AVR/AvrIspInterface.hpp"
@@ -40,6 +42,21 @@ namespace Bloom
virtual std::string getSerialNumber() = 0;
/**
* All debug tools that support target power management functions must provide an implementation of the
* TargetPowerManagementInterface class, via this function.
*
* For debug tools that cannot manage target power, a nullptr should be returned.
*
* Note: the caller of this function will not manage the lifetime of the returned TargetPowerManagementInterface
* instance.
*
* @return
*/
virtual DebugToolDrivers::TargetInterfaces::TargetPowerManagementInterface* getTargetPowerManagementInterface() {
return nullptr;
}
/**
* All debug tools that support debugging operations on AVR8 targets must provide an implementation of
* the Avr8DebugInterface class, via this function.

View File

@@ -0,0 +1,33 @@
#pragma once
#include <cstdint>
namespace Bloom::DebugToolDrivers::TargetInterfaces
{
/**
* Some debug tools provide target power management functions. Those that do should expose an implementation of
* this interface via DebugTool::getTargetPowerManagementInterface();
*/
class TargetPowerManagementInterface
{
public:
TargetPowerManagementInterface() = default;
virtual ~TargetPowerManagementInterface() = default;
TargetPowerManagementInterface(const TargetPowerManagementInterface& other) = default;
TargetPowerManagementInterface(TargetPowerManagementInterface&& other) = default;
TargetPowerManagementInterface& operator = (const TargetPowerManagementInterface& other) = default;
TargetPowerManagementInterface& operator = (TargetPowerManagementInterface&& other) = default;
/**
* Should enable the target power if currently disabled.
*/
virtual void enableTargetPower() = 0;
/**
* Should disable the target power if currently enabled.
*/
virtual void disableTargetPower() = 0;
};
}