2021-11-22 23:05:46 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "src/DebugToolDrivers/DebugTool.hpp"
|
|
|
|
|
#include "src/DebugToolDrivers/USB/UsbDevice.hpp"
|
|
|
|
|
#include "src/DebugToolDrivers/USB/HID/HidInterface.hpp"
|
2022-03-16 17:38:58 +00:00
|
|
|
|
2021-11-22 23:05:46 +00:00
|
|
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp"
|
|
|
|
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/EdbgInterface.hpp"
|
2022-03-16 17:38:58 +00:00
|
|
|
|
|
|
|
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/EdbgTargetPowerManagementInterface.hpp"
|
|
|
|
|
|
2021-11-22 23:05:46 +00:00
|
|
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.hpp"
|
|
|
|
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrames.hpp"
|
|
|
|
|
|
|
|
|
|
namespace Bloom::DebugToolDrivers
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The Xplained Pro is an evaluation board featuring an on-board debugger. The debugger is EDBG-based.
|
|
|
|
|
*
|
|
|
|
|
* Because the on-board debugger is EDBG-based, we can employ the same AVR8 driver implementation as we do with
|
|
|
|
|
* other EDBG-based debuggers. See the EdbgAvr8Interface class for more.
|
|
|
|
|
*
|
|
|
|
|
* USB Setup:
|
|
|
|
|
* Vendor ID: 0x03eb (1003)
|
|
|
|
|
* Product ID: 0x2111 (8465)
|
|
|
|
|
*/
|
|
|
|
|
class XplainedPro: public DebugTool, public Usb::UsbDevice
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static const std::uint16_t USB_VENDOR_ID = 1003;
|
|
|
|
|
static const std::uint16_t USB_PRODUCT_ID = 8465;
|
|
|
|
|
|
2022-10-01 16:50:57 +01:00
|
|
|
XplainedPro();
|
2021-11-22 23:05:46 +00:00
|
|
|
|
|
|
|
|
void init() override;
|
|
|
|
|
|
|
|
|
|
void close() override;
|
|
|
|
|
|
2022-03-16 17:38:58 +00:00
|
|
|
DebugToolDrivers::TargetInterfaces::TargetPowerManagementInterface* getTargetPowerManagementInterface() override {
|
|
|
|
|
return this->targetPowerManagementInterface.get();
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 13:14:03 +00:00
|
|
|
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
|
2021-11-22 23:05:46 +00:00
|
|
|
return this->edbgAvr8Interface.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getName() override {
|
|
|
|
|
return "Xplained Pro";
|
2022-10-01 16:50:57 +01:00
|
|
|
}
|
2021-11-22 23:05:46 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Retrieves the device serial number via the Discovery Protocol.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
std::string getSerialNumber() override;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Starts a session with the EDBG-based tool using the Housekeeping protocol.
|
|
|
|
|
*/
|
|
|
|
|
void startSession();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ends the active session with the debug tool.
|
|
|
|
|
*/
|
|
|
|
|
void endSession();
|
|
|
|
|
|
|
|
|
|
private:
|
2022-10-01 16:50:57 +01:00
|
|
|
std::unique_ptr<Protocols::CmsisDap::Edbg::EdbgInterface> edbgInterface = nullptr;
|
2021-11-22 23:05:46 +00:00
|
|
|
std::unique_ptr<Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface> edbgAvr8Interface = nullptr;
|
|
|
|
|
|
2022-03-16 17:38:58 +00:00
|
|
|
std::unique_ptr<
|
|
|
|
|
Protocols::CmsisDap::Edbg::EdbgTargetPowerManagementInterface
|
|
|
|
|
> targetPowerManagementInterface = nullptr;
|
|
|
|
|
|
2021-11-22 23:05:46 +00:00
|
|
|
bool sessionStarted = false;
|
|
|
|
|
};
|
|
|
|
|
}
|