]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/hitagS.c
Legic Tag Simulator (#666)
[proxmark3-svn] / armsrc / hitagS.c
index 99565f1b39b9dccd5faefc6f963a3937c2995ed2..f6ba0c6bf8186060e7c724d503b01f497fe9feef 100644 (file)
@@ -12,7 +12,6 @@
 //-----------------------------------------------------------------------------
 
 
-#include <stdio.h>
 #include <stdlib.h>
 #include "proxmark3.h"
 #include "apps.h"
@@ -211,7 +210,7 @@ static void hitag_send_bit(int bit) {
                                ;
                        LOW(GPIO_SSC_DOUT);
                        while (AT91C_BASE_TC0->TC_CV < T0 * 32)
-                               ;;
+                               ;
                }
                LED_A_OFF();
                break;
@@ -946,7 +945,6 @@ void SimulateHitagSTag(bool tag_mem_supplied, byte_t* data) {
        int i, j;
        byte_t rx[HITAG_FRAME_LEN];
        size_t rxlen = 0;
-//bool bQuitTraceFull = false;
        bQuiet = false;
        byte_t txbuf[HITAG_FRAME_LEN];
        byte_t* tx = txbuf;
@@ -954,7 +952,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, byte_t* data) {
        BigBuf_free();
 
 // Clean up trace and prepare it for storing frames
-       set_tracing(TRUE);
+       set_tracing(true);
        clear_trace();
 
        DbpString("Starting HitagS simulation");
@@ -986,46 +984,45 @@ void SimulateHitagSTag(bool tag_mem_supplied, byte_t* data) {
                tag.max_page=0;
        //con1
        tag.auth=0;
-       if((tag.pages[1][2]&0x80)==1)
+       if (tag.pages[1][2]&0x80)
                tag.auth=1;
        tag.LCON=0;
-       if((tag.pages[1][2]&0x2)==1)
+       if (tag.pages[1][2]&0x2)
                tag.LCON=1;
        tag.LKP=0;
-       if((tag.pages[1][2]&0x1)==1)
+       if (tag.pages[1][2]&0x1)
                tag.LKP=1;
        //con2
        //0=read write 1=read only
        tag.LCK7=0;
-       if((tag.pages[1][1]&0x80)==1)
+       if (tag.pages[1][1]&0x80)
                tag.LCK7=1;
        tag.LCK6=0;
-       if((tag.pages[1][1]&0x40)==1)
+       if (tag.pages[1][1]&0x40)
                tag.LCK6=1;
        tag.LCK5=0;
-       if((tag.pages[1][1]&0x20)==1)
+       if (tag.pages[1][1]&0x20)
                tag.LCK5=1;
        tag.LCK4=0;
-       if((tag.pages[1][1]&0x10)==1)
+       if (tag.pages[1][1]&0x10)
                tag.LCK4=1;
        tag.LCK3=0;
-       if((tag.pages[1][1]&0x8)==1)
+       if (tag.pages[1][1]&0x8)
                tag.LCK3=1;
        tag.LCK2=0;
-       if((tag.pages[1][1]&0x4)==1)
+       if (tag.pages[1][1]&0x4)
                tag.LCK2=1;
        tag.LCK1=0;
-       if((tag.pages[1][1]&0x2)==1)
+       if (tag.pages[1][1]&0x2)
                tag.LCK1=1;
        tag.LCK0=0;
-       if((tag.pages[1][1]&0x1)==1)
+       if (tag.pages[1][1]&0x1)
                tag.LCK0=1;
 
 // Set up simulator mode, frequency divisor which will drive the FPGA
 // and analog mux selection.
        FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
-       FpgaWriteConfWord(
-       FPGA_MAJOR_MODE_LF_EDGE_DETECT | FPGA_LF_EDGE_DETECT_READER_FIELD);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT);
        FpgaSendCommand(FPGA_CMD_SET_DIVISOR, 95); //125Khz
        SetAdcMuxFor(GPIO_MUXSEL_LOPKD);
        RELAY_OFF();
@@ -1218,7 +1215,7 @@ void ReadHitagS(hitag_function htf, hitag_data* htd) {
        bSuccessful = false;
 
 // Clean up trace and prepare it for storing frames
-       set_tracing(TRUE);
+       set_tracing(true);
        clear_trace();
 
        bQuiet = false;
@@ -1562,7 +1559,7 @@ void WritePageHitagS(hitag_function htf, hitag_data* htd,int page_) {
        tag.tstate = NO_OP;
 
 // Clean up trace and prepare it for storing frames
-       set_tracing(TRUE);
+       set_tracing(true);
        clear_trace();
 
        bQuiet = false;
@@ -1849,7 +1846,7 @@ void check_challenges(bool file_given, byte_t* data) {
        bSuccessful = false;
 
 // Clean up trace and prepare it for storing frames
-       set_tracing(TRUE);
+       set_tracing(true);
        clear_trace();
 
        bQuiet = false;
Impressum, Datenschutz