]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/util.c
Generic tracing pt.3 : reworking how iso14443b-traces are stored in ARM-memory
[proxmark3-svn] / armsrc / util.c
index cce9bed80a471e403c7eef1ee78096f5abcf024d..38f417507f5dbfeede74d9ae1c772b399e9b7d55 100644 (file)
@@ -13,6 +13,9 @@
 #include "string.h"
 #include "apps.h"
 
+uint8_t *trace = (uint8_t *) BigBuf+TRACE_OFFSET;
+int traceLen = 0;
+int tracing = TRUE;
 
 
 void print_result(char *name, uint8_t *buf, size_t len) {
@@ -427,6 +430,22 @@ uint32_t RAMFUNC GetCountSspClk(){
                return tmp_count;
        }
 }
+void iso14a_clear_trace() {
+       clear_trace();
+}
+
+void iso14a_set_tracing(bool enable) {
+       set_tracing(enable);
+}
+
+void clear_trace() {
+       memset(trace, 0x44, TRACE_SIZE);
+       traceLen = 0;
+}
+
+void set_tracing(bool enable) {
+       tracing = enable;
+}
 
 /**
   This is a function to store traces. All protocols can use this generic tracer-function.
@@ -447,7 +466,6 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
                tracing = FALSE;        // don't trace any more
                return FALSE;
        }
-
        // Traceformat:
        // 32 bits timestamp (little endian)
        // 16 bits duration (little endian)
@@ -486,6 +504,11 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
        }
        traceLen += num_paritybytes;
 
+       if(traceLen +4 < TRACE_SIZE)
+       {       //If it hadn't been cleared, for whatever reason..
+               memset(trace+traceLen,0x44, 4);
+       }
+
        return TRUE;
 }
 
Impressum, Datenschutz