]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
Add generic CRC calculation code
[proxmark3-svn] / armsrc / appmain.c
index c83400da2d243084661c234516fe0b4cc24c0cd4..81ef407a04d3e94f5caafe94e34143a9d2fabe10 100644 (file)
@@ -267,6 +267,7 @@ void SendVersion(void)
        DbpString(temp);\r
 }\r
 \r
+#ifdef WITH_LF\r
 // samy's sniff and repeat routine\r
 void SamyRun()\r
 {\r
@@ -377,7 +378,7 @@ void SamyRun()
                }\r
        }\r
 }\r
-\r
+#endif\r
 \r
 /*\r
 OBJECTIVE\r
@@ -533,61 +534,92 @@ void UsbPacketReceived(BYTE *packet, int len)
        UsbCommand *c = (UsbCommand *)packet;\r
 \r
        switch(c->cmd) {\r
+#ifdef WITH_LF\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:\r
                        AcquireRawAdcSamples125k(c->ext1);\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_LF\r
                case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K:\r
                        ModThenAcquireRawAdcSamples125k(c->ext1,c->ext2,c->ext3,c->d.asBytes);\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_ISO15693\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693:\r
                        AcquireRawAdcSamplesIso15693();\r
                        break;\r
+#endif\r
 \r
                case CMD_BUFF_CLEAR:\r
                        BufferClear();\r
                        break;\r
 \r
+#ifdef WITH_ISO15693\r
                case CMD_READER_ISO_15693:\r
                        ReaderIso15693(c->ext1);\r
                        break;\r
+#endif\r
+\r
+               case CMD_READER_LEGIC_RF:\r
+                       LegicRfReader();\r
+                       break;\r
 \r
+#ifdef WITH_ISO15693\r
                case CMD_SIMTAG_ISO_15693:\r
                        SimTagIso15693(c->ext1);\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_ISO14443b\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443:\r
                        AcquireRawAdcSamplesIso14443(c->ext1);\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_ISO14443b\r
                case CMD_READ_SRI512_TAG:\r
                        ReadSRI512Iso14443(c->ext1);\r
                        break;\r
+               case CMD_READ_SRIX4K_TAG:
+                       ReadSRIX4KIso14443(c->ext1);
+                       break;
+#endif\r
 \r
+#ifdef WITH_ISO14443a\r
                case CMD_READER_ISO_14443a:\r
                        ReaderIso14443a(c->ext1);\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_ISO14443b\r
                case CMD_SNOOP_ISO_14443:\r
                        SnoopIso14443();\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_ISO14443a\r
                case CMD_SNOOP_ISO_14443a:\r
                        SnoopIso14443a();\r
                        break;\r
+#endif\r
 \r
                case CMD_SIMULATE_TAG_HF_LISTEN:\r
                        SimulateTagHfListen();\r
                        break;\r
 \r
+#ifdef WITH_ISO14443b\r
                case CMD_SIMULATE_TAG_ISO_14443:\r
                        SimulateIso14443Tag();\r
                        break;\r
+#endif\r
                \r
+#ifdef WITH_ISO14443a\r
                case CMD_SIMULATE_TAG_ISO_14443a:\r
                        SimulateIso14443aTag(c->ext1, c->ext2);  // ## Simulate iso14443a tag - pass tag type & UID\r
                        break;\r
+#endif\r
 \r
                case CMD_SIMULATE_TAG_LEGIC_RF:\r
                        LegicRfSimulate();\r
@@ -601,13 +633,17 @@ void UsbPacketReceived(BYTE *packet, int len)
                        ListenReaderField(c->ext1);\r
                        break;\r
 \r
+#ifdef WITH_LF\r
                case CMD_HID_DEMOD_FSK:\r
                        CmdHIDdemodFSK(0, 0, 0, 1);                             // Demodulate HID tag\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_LF\r
                case CMD_HID_SIM_TAG:\r
                        CmdHIDsimTAG(c->ext1, c->ext2, 1);                                      // Simulate HID tag by ID\r
                        break;\r
+#endif\r
 \r
                case CMD_FPGA_MAJOR_MODE_OFF:           // ## FPGA Control\r
                        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
@@ -615,13 +651,17 @@ void UsbPacketReceived(BYTE *packet, int len)
                        LED_D_OFF(); // LED D indicates field ON or OFF\r
                        break;\r
 \r
+#ifdef WITH_LF\r
                case CMD_READ_TI_TYPE:\r
                        ReadTItag();\r
                        break;\r
+#endif\r
 \r
+#ifdef WITH_LF\r
                case CMD_WRITE_TI_TYPE:\r
                        WriteTItag(c->ext1,c->ext2,c->ext3);\r
                        break;\r
+#endif\r
 \r
                case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K: {\r
                        UsbCommand n;\r
@@ -635,36 +675,48 @@ void UsbPacketReceived(BYTE *packet, int len)
                        UsbSendPacket((BYTE *)&n, sizeof(n));\r
                        break;\r
                }\r
+\r
                case CMD_DOWNLOADED_SIM_SAMPLES_125K: {\r
                        BYTE *b = (BYTE *)BigBuf;\r
                        memcpy(b+c->ext1, c->d.asBytes, 48);\r
                        break;\r
                }\r
+\r
+#ifdef WITH_LF\r
                case CMD_SIMULATE_TAG_125K:\r
                        LED_A_ON();\r
                        SimulateTagLowFrequency(c->ext1, 1);\r
                        LED_A_OFF();\r
                        break;\r
+#endif\r
+\r
                case CMD_READ_MEM:\r
                        ReadMem(c->ext1);\r
                        break;\r
+\r
                case CMD_SET_LF_DIVISOR:\r
                        FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->ext1);\r
                        break;\r
+\r
                case CMD_SET_ADC_MUX:\r
                        switch(c->ext1) {\r
-                       case 0: SetAdcMuxFor(GPIO_MUXSEL_LOPKD); break;\r
-                       case 1: SetAdcMuxFor(GPIO_MUXSEL_LORAW); break;\r
-                       case 2: SetAdcMuxFor(GPIO_MUXSEL_HIPKD); break;\r
-                       case 3: SetAdcMuxFor(GPIO_MUXSEL_HIRAW); break;\r
+                               case 0: SetAdcMuxFor(GPIO_MUXSEL_LOPKD); break;\r
+                               case 1: SetAdcMuxFor(GPIO_MUXSEL_LORAW); break;\r
+                               case 2: SetAdcMuxFor(GPIO_MUXSEL_HIPKD); break;\r
+                               case 3: SetAdcMuxFor(GPIO_MUXSEL_HIRAW); break;\r
                        }\r
                        break;\r
+\r
                case CMD_VERSION:\r
                        SendVersion();\r
                        break;\r
+\r
+#ifdef WITH_LF\r
                case CMD_LF_SIMULATE_BIDIR:\r
                        SimulateTagLowFrequencyBidir(c->ext1, c->ext2);\r
                        break;\r
+#endif\r
+\r
 #ifdef WITH_LCD\r
                case CMD_LCD_RESET:\r
                        LCDReset();\r
@@ -684,6 +736,7 @@ void UsbPacketReceived(BYTE *packet, int len)
                                // We're going to reset, and the bootrom will take control.\r
                        }\r
                        break;\r
+\r
                case CMD_START_FLASH:\r
                        if(common_area.flags.bootrom_present) {\r
                                common_area.command = COMMON_AREA_COMMAND_ENTER_FLASH_MODE;\r
@@ -773,7 +826,9 @@ void  __attribute__((noreturn)) AppMain(void)
                UsbPoll(FALSE);\r
                WDT_HIT();\r
 \r
+#ifdef WITH_LF\r
                if (BUTTON_HELD(1000) > 0)\r
                        SamyRun();\r
+#endif\r
        }\r
 }\r
Impressum, Datenschutz