]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
fix 'hf iclass reader' and 'hf iclass readblk'
[proxmark3-svn] / armsrc / appmain.c
index cdc784c089fa2f6e13d684cb3e03d68438e9bdd0..56da54341caba404d55b85db1d4ce8d9e576a748 100644 (file)
 #include "legicrfsim.h"
 #include "hitag2.h"
 #include "hitagS.h"
+#include "iclass.h"
+#include "iso14443b.h"
 #include "iso15693.h"
 #include "lfsampling.h"
 #include "BigBuf.h"
+#include "mifarecmd.h"
 #include "mifareutil.h"
+#include "mifaresim.h"
 #include "pcf7931.h"
 #include "i2c.h"
+#include "hfsnoop.h"
+#include "fpgaloader.h"
 #ifdef WITH_LCD
  #include "LCD.h"
 #endif
@@ -241,7 +247,7 @@ void MeasureAntennaTuningHfOnly(int *vHf)
        // Let the FPGA drive the high-frequency antenna around 13.56 MHz.
        LED_A_ON();
        FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
-       FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER);
        SpinDelay(20);
        *vHf = AvgAdc_Voltage_HF();
        LED_A_OFF();
@@ -283,7 +289,7 @@ void MeasureAntennaTuningHf(void)
 
        // Let the FPGA drive the high-frequency antenna around 13.56 MHz.
        FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
-       FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER);
 
        for (;;) {
                SpinDelay(500);
@@ -992,7 +998,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
        switch(c->cmd) {
 #ifdef WITH_LF
                case CMD_SET_LF_SAMPLING_CONFIG:
-                       setSamplingConfig((sample_config *) c->d.asBytes);
+                       setSamplingConfig(c->d.asBytes);
                        break;
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:
                        cmd_send(CMD_ACK,SampleLF(c->arg[0], c->arg[1]),0,0,0,0);
@@ -1084,6 +1090,9 @@ void UsbPacketReceived(uint8_t *packet, int len)
                case CMD_EM4X_WRITE_WORD:
                        EM4xWriteWord(c->arg[0], c->arg[1], c->arg[2]);
                        break;
+               case CMD_EM4X_PROTECT:
+                       EM4xProtect(c->arg[0], c->arg[1], c->arg[2]);
+                       break;
                case CMD_AWID_DEMOD_FSK: // Set realtime AWID demodulation
                        CmdAWIDdemodFSK(c->arg[0], 0, 0, 1);
                        break;
@@ -1151,9 +1160,14 @@ void UsbPacketReceived(uint8_t *packet, int len)
                case CMD_READER_ISO_15693:
                        ReaderIso15693(c->arg[0]);
                        break;
+
                case CMD_SIMTAG_ISO_15693:
                        SimTagIso15693(c->arg[0], c->d.asBytes);
                        break;
+
+               case CMD_CSETUID_ISO_15693:
+                       SetTag15693Uid(c->d.asBytes);
+                       break;
 #endif
 
 #ifdef WITH_LEGICRF
@@ -1230,6 +1244,9 @@ void UsbPacketReceived(uint8_t *packet, int len)
                case CMD_MIFARE_WRITEBL:
                        MifareWriteBlock(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
                        break;
+               case CMD_MIFARE_PERSONALIZE_UID:
+                       MifarePersonalizeUID(c->arg[0], c->arg[1], c->d.asBytes);
+                       break;
                //case CMD_MIFAREU_WRITEBL_COMPAT:
                        //MifareUWriteBlockCompat(c->arg[0], c->d.asBytes);
                        //break;
@@ -1246,7 +1263,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        MifareChkKeys(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
                        break;
                case CMD_SIMULATE_MIFARE_CARD:
-                       Mifare1ksim(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
+                       MifareSim(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
                        break;
                
                // emulator
@@ -1307,14 +1324,14 @@ void UsbPacketReceived(uint8_t *packet, int len)
                case CMD_ICLASS_WRITEBLOCK:
                        iClass_WriteBlock(c->arg[0], c->d.asBytes);
                        break;
-               case CMD_ICLASS_READCHECK:  // auth step 1
-                       iClass_ReadCheck(c->arg[0], c->arg[1]);
-                       break;
                case CMD_ICLASS_READBLOCK:
                        iClass_ReadBlk(c->arg[0]);
                        break;
-               case CMD_ICLASS_AUTHENTICATION: //check
-                       iClass_Authentication(c->d.asBytes);
+               case CMD_ICLASS_CHECK:
+                       iClass_Check(c->d.asBytes);
+                       break;
+               case CMD_ICLASS_READCHECK:
+                       iClass_Readcheck(c->arg[0], c->arg[1]);
                        break;
                case CMD_ICLASS_DUMP:
                        iClass_Dump(c->arg[0], c->arg[1]);
@@ -1323,11 +1340,16 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        iClass_Clone(c->arg[0], c->arg[1], c->d.asBytes);
                        break;
 #endif
+
 #ifdef WITH_HFSNOOP
                case CMD_HF_SNIFFER:
                        HfSnoop(c->arg[0], c->arg[1]);
                        break;
+               case CMD_HF_PLOT:
+                       HfPlot();
+                       break;
 #endif
+
 #ifdef WITH_SMARTCARD
                case CMD_SMART_ATR: {
                        SmartCardAtr();
@@ -1377,7 +1399,6 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        break;
 
                case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K:
-
                        LED_B_ON();
                        uint8_t *BigBuf = BigBuf_get_addr();
                        for(size_t i=0; i<c->arg[1]; i += USB_CMD_DATA_SIZE) {
@@ -1484,11 +1505,8 @@ void  __attribute__((noreturn)) AppMain(void)
        }
        common_area.flags.osimage_present = 1;
 
-       LED_D_OFF();
-       LED_C_OFF();
-       LED_B_OFF();
-       LED_A_OFF();
-
+       LEDsoff();
+       
        // Init USB device
        usb_enable();
 
Impressum, Datenschutz