From c1fdb2e78c4775d54533102c0cfb82c0f998d52b Mon Sep 17 00:00:00 2001 From: douniwan5788 Date: Mon, 26 Aug 2024 01:45:02 +0800 Subject: [PATCH] fix: WITH_LF WITH_LEGICRF WITH_ISO14443a --- Makefile.platform.sample | 19 ++++++++++++++----- armsrc/appmain.c | 16 +++++++++------- client/src/cmdhw.c | 6 +++--- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Makefile.platform.sample b/Makefile.platform.sample index 018d450d2..2661a0720 100644 --- a/Makefile.platform.sample +++ b/Makefile.platform.sample @@ -20,12 +20,21 @@ PLATFORM=PM3RDV4 #PLATFORM=PM3GENERIC #PLATFORM_SIZE=256 #STANDALONE= -#SKIP_HITAG=1 -#SKIP_FELICA=1 -#SKIP_HFPLOT=1 -#SKIP_NFCBARCODE=1 -#SKIP_ZX8211=1 #SKIP_LF=1 +#SKIP_HITAG=1 +#SKIP_EM4x50=1 +#SKIP_EM4x70=1 +#SKIP_ZX8211=1 +#SKIP_HF=1 +#SKIP_ISO15693=1 +#SKIP_LEGICRF=1 +#SKIP_ISO14443b=1 +#SKIP_ISO14443a=1 +#SKIP_ICLASS=1 +#SKIP_FELICA=1 +#SKIP_NFCBARCODE=1 +#SKIP_HFSNIFF=1 +#SKIP_HFPLOT=1 # To accelerate repetitive compilations: # Install package "ccache" -> Debian/Ubuntu: /usr/lib/ccache, Fedora/CentOS/RHEL: /usr/lib64/ccache diff --git a/armsrc/appmain.c b/armsrc/appmain.c index a50fa7a56..99b719a6f 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -162,7 +162,7 @@ uint16_t SumAdc(uint8_t ch, uint8_t NbSamples) { a += ReadAdc(ch); return (a + (NbSamples >> 1) - 1); } - +#ifdef WITH_LF static void MeasureAntennaTuning(void) { uint32_t peak = 0; @@ -236,7 +236,7 @@ static void MeasureAntennaTuning(void) { reply_ng(CMD_MEASURE_ANTENNA_TUNING, PM3_SUCCESS, (uint8_t *)&payload, sizeof(payload)); LEDsoff(); } - +#endif // Measure HF in milliVolt static uint16_t MeasureAntennaTuningHfData(void) { @@ -1610,7 +1610,9 @@ static void PacketReceived(PacketCommandNG *packet) { struct p *payload = (struct p *) packet->data.asBytes; FpgaDownloadAndGo(FPGA_BITSTREAM_HF); FpgaSendCommand(FPGA_CMD_SET_EDGE_DETECT_THRESHOLD, (payload->threshold & 0x3f) | ((payload->threshold_high & 0x3f) << 6)); +#ifdef WITH_LEGICRF LegicRfSetThreshold((uint32_t)payload->legic_threshold); +#endif break; } case CMD_HF_ISO14443A_SNIFF: { @@ -2301,10 +2303,12 @@ static void PacketReceived(PacketCommandNG *packet) { BigBuf_free(); break; } +#ifdef WITH_LF case CMD_MEASURE_ANTENNA_TUNING: { MeasureAntennaTuning(); break; } +#endif case CMD_MEASURE_ANTENNA_TUNING_HF: { if (packet->length != 1) reply_ng(CMD_MEASURE_ANTENNA_TUNING_HF, PM3_EINVARG, NULL, 0); @@ -2394,12 +2398,8 @@ static void PacketReceived(PacketCommandNG *packet) { Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", i, i + len, len, result); } // Trigger a finish downloading signal with an ACK frame - // iceman, when did sending samplingconfig array got attached here?!? // arg0 = status of download transfer - // arg1 = RFU - // arg2 = tracelen? - // asbytes = samplingconfig array - reply_mix(CMD_ACK, 1, 0, BigBuf_get_traceLen(), getSamplingConfig(), sizeof(sample_config)); + reply_mix(CMD_ACK, 1, 0, 0, 0, 0); LED_B_OFF(); break; } @@ -2818,11 +2818,13 @@ static void PacketReceived(PacketCommandNG *packet) { break; } #endif +#ifdef WITH_LF case CMD_LF_SET_DIVISOR: { FpgaDownloadAndGo(FPGA_BITSTREAM_LF); FpgaSendCommand(FPGA_CMD_SET_DIVISOR, packet->data.asBytes[0]); break; } +#endif case CMD_SET_ADC_MUX: { switch (packet->data.asBytes[0]) { case 0: diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index a270d2f1b..6b4118d02 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -1468,12 +1468,12 @@ static command_t CommandTable[] = { {"ping", CmdPing, IfPm3Present, "Test if the Proxmark3 is responsive"}, {"readmem", CmdReadmem, IfPm3Present, "Read from MCU flash"}, {"reset", CmdReset, IfPm3Present, "Reset the device"}, - {"setlfdivisor", CmdSetDivisor, IfPm3Present, "Drive LF antenna at 12MHz / (divisor + 1)"}, - {"sethfthresh", CmdSetHFThreshold, IfPm3Present, "Set thresholds in HF/14a mode"}, + {"setlfdivisor", CmdSetDivisor, IfPm3Lf, "Drive LF antenna at 12MHz / (divisor + 1)"}, + {"sethfthresh", CmdSetHFThreshold, IfPm3Iso14443a, "Set thresholds in HF/14a mode"}, {"setmux", CmdSetMux, IfPm3Present, "Set the ADC mux to a specific value"}, {"standalone", CmdStandalone, IfPm3Present, "Start installed standalone mode on device"}, {"tia", CmdTia, IfPm3Present, "Trigger a Timing Interval Acquisition to re-adjust the RealTimeCounter divider"}, - {"tune", CmdTune, IfPm3Present, "Measure tuning of device antenna"}, + {"tune", CmdTune, IfPm3Lf, "Measure tuning of device antenna"}, {NULL, NULL, NULL, NULL} };