From f47e4ed115176d76ee4caaf6246d344300818126 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 24 Aug 2023 18:22:50 +0200 Subject: [PATCH] Move hardcoded value where it belongs Keep FPGA parameters together in the same place --- client/src/cmdhw.c | 3 ++- common_fpga/fpga.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index ec3ab4867..1b2cd5459 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -27,6 +27,7 @@ #include "comms.h" #include "usart_defs.h" #include "ui.h" +#include "fpga.h" #include "cmdhw.h" #include "cmddata.h" #include "commonutil.h" @@ -1392,7 +1393,7 @@ void pm3_version(bool verbose, bool oneliner) { } } PrintAndLogEx(NORMAL, payload->versionstr); - if (strstr(payload->versionstr, "2s30vq100") == NULL) { + if (strstr(payload->versionstr, FPGA_TYPE) == NULL) { PrintAndLogEx(NORMAL, " FPGA firmware... %s", _RED_("chip mismatch")); } diff --git a/common_fpga/fpga.h b/common_fpga/fpga.h index b7e017d68..35143ec6f 100644 --- a/common_fpga/fpga.h +++ b/common_fpga/fpga.h @@ -23,9 +23,11 @@ #define FPGA_BITSTREAM_FIXED_HEADER_SIZE sizeof(bitparse_fixed_header) #define FPGA_INTERLEAVE_SIZE 288 #if defined XC3 -#define FPGA_CONFIG_SIZE 72864L // our current fpga_[lh]f.bit files are 72742 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE +#define FPGA_TYPE "3s100evq100" +#define FPGA_CONFIG_SIZE 72864L // FPGA .bit file rounded up to next multiple of FPGA_INTERLEAVE_SIZE #else -#define FPGA_CONFIG_SIZE 42336L // our current fpga_[lh]f.bit files are 42175 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE +#define FPGA_TYPE "2s30vq100" +#define FPGA_CONFIG_SIZE 42336L // FPGA .bit file rounded up to next multiple of FPGA_INTERLEAVE_SIZE #endif #define FPGA_RING_BUFFER_BYTES (1024 * 30) #define FPGA_TRACE_SIZE 3072