fix: WITH_LF WITH_LEGICRF WITH_ISO14443a

This commit is contained in:
douniwan5788 2024-08-26 01:45:02 +08:00
commit c1fdb2e78c
3 changed files with 26 additions and 15 deletions

View file

@ -20,12 +20,21 @@ PLATFORM=PM3RDV4
#PLATFORM=PM3GENERIC #PLATFORM=PM3GENERIC
#PLATFORM_SIZE=256 #PLATFORM_SIZE=256
#STANDALONE= #STANDALONE=
#SKIP_HITAG=1
#SKIP_FELICA=1
#SKIP_HFPLOT=1
#SKIP_NFCBARCODE=1
#SKIP_ZX8211=1
#SKIP_LF=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: # To accelerate repetitive compilations:
# Install package "ccache" -> Debian/Ubuntu: /usr/lib/ccache, Fedora/CentOS/RHEL: /usr/lib64/ccache # Install package "ccache" -> Debian/Ubuntu: /usr/lib/ccache, Fedora/CentOS/RHEL: /usr/lib64/ccache

View file

@ -162,7 +162,7 @@ uint16_t SumAdc(uint8_t ch, uint8_t NbSamples) {
a += ReadAdc(ch); a += ReadAdc(ch);
return (a + (NbSamples >> 1) - 1); return (a + (NbSamples >> 1) - 1);
} }
#ifdef WITH_LF
static void MeasureAntennaTuning(void) { static void MeasureAntennaTuning(void) {
uint32_t peak = 0; 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)); reply_ng(CMD_MEASURE_ANTENNA_TUNING, PM3_SUCCESS, (uint8_t *)&payload, sizeof(payload));
LEDsoff(); LEDsoff();
} }
#endif
// Measure HF in milliVolt // Measure HF in milliVolt
static uint16_t MeasureAntennaTuningHfData(void) { static uint16_t MeasureAntennaTuningHfData(void) {
@ -1610,7 +1610,9 @@ static void PacketReceived(PacketCommandNG *packet) {
struct p *payload = (struct p *) packet->data.asBytes; struct p *payload = (struct p *) packet->data.asBytes;
FpgaDownloadAndGo(FPGA_BITSTREAM_HF); FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
FpgaSendCommand(FPGA_CMD_SET_EDGE_DETECT_THRESHOLD, (payload->threshold & 0x3f) | ((payload->threshold_high & 0x3f) << 6)); FpgaSendCommand(FPGA_CMD_SET_EDGE_DETECT_THRESHOLD, (payload->threshold & 0x3f) | ((payload->threshold_high & 0x3f) << 6));
#ifdef WITH_LEGICRF
LegicRfSetThreshold((uint32_t)payload->legic_threshold); LegicRfSetThreshold((uint32_t)payload->legic_threshold);
#endif
break; break;
} }
case CMD_HF_ISO14443A_SNIFF: { case CMD_HF_ISO14443A_SNIFF: {
@ -2301,10 +2303,12 @@ static void PacketReceived(PacketCommandNG *packet) {
BigBuf_free(); BigBuf_free();
break; break;
} }
#ifdef WITH_LF
case CMD_MEASURE_ANTENNA_TUNING: { case CMD_MEASURE_ANTENNA_TUNING: {
MeasureAntennaTuning(); MeasureAntennaTuning();
break; break;
} }
#endif
case CMD_MEASURE_ANTENNA_TUNING_HF: { case CMD_MEASURE_ANTENNA_TUNING_HF: {
if (packet->length != 1) if (packet->length != 1)
reply_ng(CMD_MEASURE_ANTENNA_TUNING_HF, PM3_EINVARG, NULL, 0); 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); 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 // Trigger a finish downloading signal with an ACK frame
// iceman, when did sending samplingconfig array got attached here?!?
// arg0 = status of download transfer // arg0 = status of download transfer
// arg1 = RFU reply_mix(CMD_ACK, 1, 0, 0, 0, 0);
// arg2 = tracelen?
// asbytes = samplingconfig array
reply_mix(CMD_ACK, 1, 0, BigBuf_get_traceLen(), getSamplingConfig(), sizeof(sample_config));
LED_B_OFF(); LED_B_OFF();
break; break;
} }
@ -2818,11 +2818,13 @@ static void PacketReceived(PacketCommandNG *packet) {
break; break;
} }
#endif #endif
#ifdef WITH_LF
case CMD_LF_SET_DIVISOR: { case CMD_LF_SET_DIVISOR: {
FpgaDownloadAndGo(FPGA_BITSTREAM_LF); FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, packet->data.asBytes[0]); FpgaSendCommand(FPGA_CMD_SET_DIVISOR, packet->data.asBytes[0]);
break; break;
} }
#endif
case CMD_SET_ADC_MUX: { case CMD_SET_ADC_MUX: {
switch (packet->data.asBytes[0]) { switch (packet->data.asBytes[0]) {
case 0: case 0:

View file

@ -1468,12 +1468,12 @@ static command_t CommandTable[] = {
{"ping", CmdPing, IfPm3Present, "Test if the Proxmark3 is responsive"}, {"ping", CmdPing, IfPm3Present, "Test if the Proxmark3 is responsive"},
{"readmem", CmdReadmem, IfPm3Present, "Read from MCU flash"}, {"readmem", CmdReadmem, IfPm3Present, "Read from MCU flash"},
{"reset", CmdReset, IfPm3Present, "Reset the device"}, {"reset", CmdReset, IfPm3Present, "Reset the device"},
{"setlfdivisor", CmdSetDivisor, IfPm3Present, "Drive LF antenna at 12MHz / (divisor + 1)"}, {"setlfdivisor", CmdSetDivisor, IfPm3Lf, "Drive LF antenna at 12MHz / (divisor + 1)"},
{"sethfthresh", CmdSetHFThreshold, IfPm3Present, "Set thresholds in HF/14a mode"}, {"sethfthresh", CmdSetHFThreshold, IfPm3Iso14443a, "Set thresholds in HF/14a mode"},
{"setmux", CmdSetMux, IfPm3Present, "Set the ADC mux to a specific value"}, {"setmux", CmdSetMux, IfPm3Present, "Set the ADC mux to a specific value"},
{"standalone", CmdStandalone, IfPm3Present, "Start installed standalone mode on device"}, {"standalone", CmdStandalone, IfPm3Present, "Start installed standalone mode on device"},
{"tia", CmdTia, IfPm3Present, "Trigger a Timing Interval Acquisition to re-adjust the RealTimeCounter divider"}, {"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} {NULL, NULL, NULL, NULL}
}; };