]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/lfops.c
CHG: "hf mf hardnested" - less printing
[proxmark3-svn] / armsrc / lfops.c
index 5931c76af9554010cdac19df4b6cea333edeae9c..bbd848ce0f46f3e338934c1c39a7cd0afe108040 100644 (file)
@@ -395,32 +395,32 @@ void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc)
 void SimulateTagLowFrequency(int period, int gap, int ledcontrol)
 {
        int i = 0;
-       uint8_t *tab = BigBuf_get_addr();
-
-       StartTicks();
+       uint8_t *buf = BigBuf_get_addr();
 
        FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT | FPGA_LF_EDGE_DETECT_READER_FIELD);
+       //FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT);
 
        AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT | GPIO_SSC_CLK;
+       //AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT;
        AT91C_BASE_PIOA->PIO_OER = GPIO_SSC_DOUT;
        AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK;
 
+       StartTicks();
+
        for(;;) {
                WDT_HIT();
 
                if (ledcontrol) LED_D_ON();
                                
-               //wait until SSC_CLK goes HIGH
+               // wait until SSC_CLK goes HIGH
+               // used as a simple detection of a reader field?
                while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) {
                        WDT_HIT();
-                       if ( usb_poll_validate_length() || BUTTON_PRESS() ) {
-                               FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
-                               LED_D_OFF();
-                               return;                         
-                       }
+                       if ( usb_poll_validate_length() || BUTTON_PRESS() )
+                               goto OUT;
                }
                
-               if(tab[i])
+               if(buf[i])
                        OPEN_COIL();
                else
                        SHORT_COIL();
@@ -430,11 +430,8 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol)
                //wait until SSC_CLK goes LOW
                while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK) {
                        WDT_HIT();
-                       if ( usb_poll_validate_length() || BUTTON_PRESS() ) {
-                               FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
-                               LED_D_OFF();
-                               return;                         
-                       }
+                       if ( usb_poll_validate_length() || BUTTON_PRESS() )
+                               goto OUT;
                }
 
                i++;
@@ -447,7 +444,12 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol)
                        }
                }
        }
+OUT: 
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        StopTicks();
+       LED_D_OFF();
+       DbpString("Simulation stopped");
+       return; 
 }
 
 #define DEBUG_FRAME_CONTENTS 1
Impressum, Datenschutz