2021-04-07 23:31:59 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
2022-10-02 15:29:17 +01:00
|
|
|
#include <string>
|
2021-04-07 23:31:59 +01:00
|
|
|
|
2022-10-02 15:29:17 +01:00
|
|
|
#include "src/DebugToolDrivers/Microchip/EdbgDevice.hpp"
|
2021-04-07 23:31:59 +01:00
|
|
|
|
2023-11-18 23:50:08 +00:00
|
|
|
namespace DebugToolDrivers::Microchip
|
2021-04-07 23:31:59 +01:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The MPLAB Snap device is a hybrid device - that is, it can present itself as an "MPLAB Snap ICD" device, as well
|
2022-10-02 15:29:17 +01:00
|
|
|
* as an EDBG (Embedded Debugger) device. The device switches between these two modes via firmware configuration.
|
|
|
|
|
* It appears that it can only interface with AVR targets using the EDBG firmware, which, apparently, is why it is
|
|
|
|
|
* known to be in "AVR mode" when it presents itself as an EDBG device.
|
2021-04-07 23:31:59 +01:00
|
|
|
*
|
|
|
|
|
* This debug tool driver currently only supports the device when in AVR mode. Because the device uses different
|
2022-10-02 15:29:17 +01:00
|
|
|
* USB vendor and product IDs depending on the mode, it is trivial to determine which is which. In fact, Bloom will
|
|
|
|
|
* not even recognise the device if it's not in AVR mode.
|
2021-04-07 23:31:59 +01:00
|
|
|
*
|
2022-10-02 15:29:17 +01:00
|
|
|
* USB (when in AVR/EDBG mode):
|
2021-04-07 23:31:59 +01:00
|
|
|
* Vendor ID: 0x03eb (1003)
|
|
|
|
|
* Product ID: 0x2180 (8576)
|
|
|
|
|
*/
|
2022-10-02 15:29:17 +01:00
|
|
|
class MplabSnap: public EdbgDevice
|
2021-04-07 23:31:59 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2022-10-02 15:29:17 +01:00
|
|
|
static const inline std::uint16_t USB_VENDOR_ID = 0x03eb;
|
|
|
|
|
static const inline std::uint16_t USB_PRODUCT_ID = 0x2180;
|
|
|
|
|
static const inline std::uint8_t CMSIS_HID_INTERFACE_NUMBER = 0;
|
2021-04-07 23:31:59 +01:00
|
|
|
|
2023-05-07 16:44:15 +01:00
|
|
|
static const inline std::uint16_t NON_EDBG_USB_VENDOR_ID = 0x04d8;
|
|
|
|
|
static const inline std::uint16_t NON_EDBG_USB_PRODUCT_ID = 0x9018;
|
|
|
|
|
static const inline std::uint16_t NON_EDBG_USB_PRODUCT_ID_ALTERNATIVE = 0x9017;
|
|
|
|
|
|
2022-10-01 16:50:57 +01:00
|
|
|
MplabSnap();
|
2021-04-07 23:31:59 +01:00
|
|
|
|
|
|
|
|
std::string getName() override {
|
|
|
|
|
return "MPLAB Snap";
|
2022-10-01 16:50:57 +01:00
|
|
|
}
|
2023-05-07 16:44:15 +01:00
|
|
|
|
|
|
|
|
void init() override;
|
2023-05-21 21:08:25 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void configureAvr8Interface() override;
|
2021-04-07 23:31:59 +01:00
|
|
|
};
|
|
|
|
|
}
|