]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
mifare usb update
[proxmark3-svn] / armsrc / appmain.c
index e86cad8c35ca9227edf72e1f3218fcf49c1b2800..11047b1cbdc75820e41ef104c1b3ab7447da05bd 100644 (file)
@@ -69,8 +69,8 @@ void DbpString(char *str)
 \r
        UsbCommand c;\r
        c.cmd = CMD_DEBUG_PRINT_STRING;\r
-       c.ext1 = strlen(str);\r
-       memcpy(c.d.asBytes, str, c.ext1);\r
+       c.arg[0] = strlen(str);\r
+       memcpy(c.d.asBytes, str, c.arg[0]);\r
 \r
        UsbSendPacket((BYTE *)&c, sizeof(c));\r
        // TODO fix USB so stupid things like this aren't req'd\r
@@ -85,9 +85,9 @@ void DbpIntegers(int x1, int x2, int x3)
 \r
        UsbCommand c;\r
        c.cmd = CMD_DEBUG_PRINT_INTEGERS;\r
-       c.ext1 = x1;\r
-       c.ext2 = x2;\r
-       c.ext3 = x3;\r
+       c.arg[0] = x1;\r
+       c.arg[1] = x2;\r
+       c.arg[2] = x3;\r
 \r
        UsbSendPacket((BYTE *)&c, sizeof(c));\r
        // XXX\r
@@ -176,9 +176,9 @@ void MeasureAntennaTuning(void)
        vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10;\r
 \r
        c.cmd = CMD_MEASURED_ANTENNA_TUNING;\r
-       c.ext1 = (vLf125 << 0) | (vLf134 << 16);\r
-       c.ext2 = vHf;\r
-       c.ext3 = peakf | (peakv << 16);\r
+       c.arg[0] = (vLf125 << 0) | (vLf134 << 16);\r
+       c.arg[1] = vHf;\r
+       c.arg[2] = peakf | (peakv << 16);\r
        UsbSendPacket((BYTE *)&c, sizeof(c));\r
 }\r
 \r
@@ -267,7 +267,7 @@ void SendVersion(void)
        DbpString(temp);\r
 }\r
 \r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
 // samy's sniff and repeat routine\r
 void SamyRun()\r
 {\r
@@ -534,15 +534,15 @@ void UsbPacketReceived(BYTE *packet, int len)
        UsbCommand *c = (UsbCommand *)packet;\r
 \r
        switch(c->cmd) {\r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:\r
-                       AcquireRawAdcSamples125k(c->ext1);\r
+                       AcquireRawAdcSamples125k(c->arg[0]);\r
                        break;\r
 #endif\r
 \r
-#ifdef DWITH_LF\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
+                       ModThenAcquireRawAdcSamples125k(c->arg[0],c->arg[1],c->arg[2],c->d.asBytes);\r
                        break;\r
 #endif\r
 \r
@@ -558,7 +558,7 @@ void UsbPacketReceived(BYTE *packet, int len)
 \r
 #ifdef WITH_ISO15693\r
                case CMD_READER_ISO_15693:\r
-                       ReaderIso15693(c->ext1);\r
+                       ReaderIso15693(c->arg[0]);\r
                        break;\r
 #endif\r
 \r
@@ -568,28 +568,37 @@ void UsbPacketReceived(BYTE *packet, int len)
 \r
 #ifdef WITH_ISO15693\r
                case CMD_SIMTAG_ISO_15693:\r
-                       SimTagIso15693(c->ext1);\r
+                       SimTagIso15693(c->arg[0]);\r
                        break;\r
 #endif\r
 \r
 #ifdef WITH_ISO14443b\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443:\r
-                       AcquireRawAdcSamplesIso14443(c->ext1);\r
+                       AcquireRawAdcSamplesIso14443(c->arg[0]);\r
                        break;\r
 #endif\r
 \r
 #ifdef WITH_ISO14443b\r
                case CMD_READ_SRI512_TAG:\r
-                       ReadSRI512Iso14443(c->ext1);\r
+                       ReadSRI512Iso14443(c->arg[0]);\r
                        break;\r
+               case CMD_READ_SRIX4K_TAG:\r
+                       ReadSRIX4KIso14443(c->arg[0]);\r
+                       break;\r
 #endif\r
 \r
 #ifdef WITH_ISO14443a\r
                case CMD_READER_ISO_14443a:\r
-                       ReaderIso14443a(c->ext1);\r
+                       ReaderIso14443a(c->arg[0]);\r
                        break;\r
 #endif\r
 \r
+#ifdef WITH_ISO14443a\r
+               case CMD_READER_MIFARE:\r
+                       ReaderMifare(c->arg[0]);\r
+                       break;\r
+#endif\r
+      \r
 #ifdef WITH_ISO14443b\r
                case CMD_SNOOP_ISO_14443:\r
                        SnoopIso14443();\r
@@ -614,31 +623,27 @@ void UsbPacketReceived(BYTE *packet, int len)
                \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
+                       SimulateIso14443aTag(c->arg[0], c->arg[1]);  // ## Simulate iso14443a tag - pass tag type & UID\r
                        break;\r
 #endif\r
 \r
-               case CMD_SIMULATE_TAG_LEGIC_RF:\r
-                       LegicRfSimulate();\r
-                       break;\r
-\r
                case CMD_MEASURE_ANTENNA_TUNING:\r
                        MeasureAntennaTuning();\r
                        break;\r
 \r
                case CMD_LISTEN_READER_FIELD:\r
-                       ListenReaderField(c->ext1);\r
+                       ListenReaderField(c->arg[0]);\r
                        break;\r
 \r
-#ifdef DWITH_LF\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 DWITH_LF\r
+#ifdef WITH_LF\r
                case CMD_HID_SIM_TAG:\r
-                       CmdHIDsimTAG(c->ext1, c->ext2, 1);                                      // Simulate HID tag by ID\r
+                       CmdHIDsimTAG(c->arg[0], c->arg[1], 1);                                  // Simulate HID tag by ID\r
                        break;\r
 #endif\r
 \r
@@ -648,15 +653,15 @@ void UsbPacketReceived(BYTE *packet, int len)
                        LED_D_OFF(); // LED D indicates field ON or OFF\r
                        break;\r
 \r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
                case CMD_READ_TI_TYPE:\r
                        ReadTItag();\r
                        break;\r
 #endif\r
 \r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
                case CMD_WRITE_TI_TYPE:\r
-                       WriteTItag(c->ext1,c->ext2,c->ext3);\r
+                       WriteTItag(c->arg[0],c->arg[1],c->arg[2]);\r
                        break;\r
 #endif\r
 \r
@@ -667,36 +672,36 @@ void UsbPacketReceived(BYTE *packet, int len)
                        } else {\r
                                n.cmd = CMD_DOWNLOADED_RAW_BITS_TI_TYPE;\r
                        }\r
-                       n.ext1 = c->ext1;\r
-                       memcpy(n.d.asDwords, BigBuf+c->ext1, 12*sizeof(DWORD));\r
+                       n.arg[0] = c->arg[0];\r
+                       memcpy(n.d.asDwords, BigBuf+c->arg[0], 12*sizeof(DWORD));\r
                        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
+                       memcpy(b+c->arg[0], c->d.asBytes, 48);\r
                        break;\r
                }\r
 \r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
                case CMD_SIMULATE_TAG_125K:\r
                        LED_A_ON();\r
-                       SimulateTagLowFrequency(c->ext1, 1);\r
+                       SimulateTagLowFrequency(c->arg[0], 1);\r
                        LED_A_OFF();\r
                        break;\r
 #endif\r
 \r
                case CMD_READ_MEM:\r
-                       ReadMem(c->ext1);\r
+                       ReadMem(c->arg[0]);\r
                        break;\r
 \r
                case CMD_SET_LF_DIVISOR:\r
-                       FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->ext1);\r
+                       FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->arg[0]);\r
                        break;\r
 \r
                case CMD_SET_ADC_MUX:\r
-                       switch(c->ext1) {\r
+                       switch(c->arg[0]) {\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
@@ -708,9 +713,9 @@ void UsbPacketReceived(BYTE *packet, int len)
                        SendVersion();\r
                        break;\r
 \r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
                case CMD_LF_SIMULATE_BIDIR:\r
-                       SimulateTagLowFrequencyBidir(c->ext1, c->ext2);\r
+                       SimulateTagLowFrequencyBidir(c->arg[0], c->arg[1]);\r
                        break;\r
 #endif\r
 \r
@@ -719,7 +724,7 @@ void UsbPacketReceived(BYTE *packet, int len)
                        LCDReset();\r
                        break;\r
                case CMD_LCD:\r
-                       LCDSend(c->ext1);\r
+                       LCDSend(c->arg[0]);\r
                        break;\r
 #endif\r
                case CMD_SETUP_WRITE:\r
@@ -746,8 +751,8 @@ void UsbPacketReceived(BYTE *packet, int len)
                case CMD_DEVICE_INFO: {\r
                        UsbCommand c;\r
                        c.cmd = CMD_DEVICE_INFO;\r
-                       c.ext1 = DEVICE_INFO_FLAG_OSIMAGE_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_OS;\r
-                       if(common_area.flags.bootrom_present) c.ext1 |= DEVICE_INFO_FLAG_BOOTROM_PRESENT;\r
+                       c.arg[0] = DEVICE_INFO_FLAG_OSIMAGE_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_OS;\r
+                       if(common_area.flags.bootrom_present) c.arg[0] |= DEVICE_INFO_FLAG_BOOTROM_PRESENT;\r
                        UsbSendPacket((BYTE*)&c, sizeof(c));\r
                }\r
                        break;\r
@@ -823,7 +828,7 @@ void  __attribute__((noreturn)) AppMain(void)
                UsbPoll(FALSE);\r
                WDT_HIT();\r
 \r
-#ifdef DWITH_LF\r
+#ifdef WITH_LF\r
                if (BUTTON_HELD(1000) > 0)\r
                        SamyRun();\r
 #endif\r
Impressum, Datenschutz