From d2a8cca233fc1b3cae4ec137ad71555ca1be3cb8 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 19 Aug 2026 11:41:30 +0200 Subject: [PATCH] Add pm5 capabilities --- armsrc/appmain.c | 12 ++++++++++++ client/src/cmdparser.c | 24 ++++++++++++++++++++++++ client/src/cmdparser.h | 4 ++++ include/pm3_cmd.h | 8 +++++++- 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index c6d03b6c7..a37642b38 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -634,6 +634,18 @@ static void SendCapabilities(void) { capabilities.is_rdv4 = false; #endif +#ifdef PM5 + capabilities.is_pm5 = true; + capabilities.is_pm5_std_ant = true; + capabilities.hw_available_fpga_flash = true; + capabilities.hw_available_i2c_eeprom = true; +#else + capabilities.is_pm5 = false; + capabilities.is_pm5_std_ant = false; + capabilities.hw_available_fpga_flash = false; + capabilities.hw_available_i2c_eeprom = false; +#endif + #ifdef WITH_FLASH capabilities.compiled_with_flash = true; capabilities.hw_available_flash = FlashInit(); diff --git a/client/src/cmdparser.c b/client/src/cmdparser.c index 76c28118a..2341d44ae 100644 --- a/client/src/cmdparser.c +++ b/client/src/cmdparser.c @@ -122,6 +122,30 @@ bool IfPm3FpcUsartFromUsb(void) { return IfPm3FpcUsartHostFromUsb() || IfPm3FpcUsartDevFromUsb(); } +bool IfPm5(void) { + if (IfPm3Present() == false) + return false; + return g_pm3_capabilities.is_pm5; +} + +bool IfPm5StdAnt(void) { + if (IfPm3Present() == false) + return false; + return g_pm3_capabilities.is_pm5_std_ant; +} + +bool IfFpgaFlash(void) { + if (IfPm3Present() == false) + return false; + return g_pm3_capabilities.hw_available_fpga_flash; +} + +bool IfI2cEeprom(void) { + if (IfPm3Present() == false) + return false; + return g_pm3_capabilities.hw_available_i2c_eeprom; +} + bool IfPm3Lf(void) { if (IfPm3Present() == false) return false; diff --git a/client/src/cmdparser.h b/client/src/cmdparser.h index 4bfe71394..1e3fde01c 100644 --- a/client/src/cmdparser.h +++ b/client/src/cmdparser.h @@ -41,6 +41,10 @@ bool IfPm3FpcUsartHost(void); bool IfPm3FpcUsartHostFromUsb(void); bool IfPm3FpcUsartDevFromUsb(void); bool IfPm3FpcUsartFromUsb(void); +bool IfPm5(void); +bool IfPm5StdAnt(void); +bool IfFpgaFlash(void); +bool IfI2cEeprom(void); bool IfPm3Lf(void); bool IfPm3Hitag(void); bool IfPm3EM4x50(void); diff --git a/include/pm3_cmd.h b/include/pm3_cmd.h index c18be6ca9..cbd25a3b0 100644 --- a/include/pm3_cmd.h +++ b/include/pm3_cmd.h @@ -243,8 +243,14 @@ typedef struct { bool hw_available_flash : 1; bool hw_available_smartcard : 1; bool is_rdv4 : 1; + + // pm5 + bool hw_available_fpga_flash : 1; + bool hw_available_i2c_eeprom : 1; + bool is_pm5 : 1; + bool is_pm5_std_ant : 1; } PACKED capabilities_t; -#define CAPABILITIES_VERSION 7 +#define CAPABILITIES_VERSION 8 extern capabilities_t g_pm3_capabilities; typedef struct {