remove some debugstatments, use hdr.frame instead

This commit is contained in:
iceman1001 2020-07-13 12:20:12 +02:00
commit 27c4d994ac
2 changed files with 10 additions and 14 deletions

View file

@ -164,7 +164,7 @@ uint32_t BigBuf_get_traceLen(void) {
**/ **/
bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag) { bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag) {
if (tracing == false) { if (tracing == false) {
if (DBGLEVEL >= DBG_DEBUG) { Dbprintf("trace is turned off"); } Dbprintf("trace is turned off");
return false; return false;
} }
@ -175,8 +175,7 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
// Return when trace is full // Return when trace is full
if (TRACELOG_HDR_LEN + iLen + num_paritybytes >= BigBuf_max_traceLen() - trace_len) { if (TRACELOG_HDR_LEN + iLen + num_paritybytes >= BigBuf_max_traceLen() - trace_len) {
tracing = false; // don't trace any more tracing = false;
if (DBGLEVEL >= DBG_DEBUG) { Dbprintf("trace is full"); }
return false; return false;
} }
@ -188,27 +187,24 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
} }
if (duration > 0x7FFF) { if (duration > 0x7FFF) {
if (DBGLEVEL >= DBG_DEBUG) { if (DBGLEVEL >= DBG_ERROR) { //DBG_DEBUG
Dbprintf("Error in LogTrace: duration too long for 15 bits encoding: 0x%08x start:0x%08x end:0x%08x", duration, timestamp_start, timestamp_end); Dbprintf("Error in LogTrace: duration too long for 15 bits encoding: 0x%08x start: 0x%08x end: 0x%08x", duration, timestamp_start, timestamp_end);
// Dbprintf("Forcing duration = 0");
} }
duration /= 32; duration /= 32;
// duration >>= 5;
// duration = 0; // duration = 0;
} }
hdr->timestamp = timestamp_start; hdr->timestamp = timestamp_start;
hdr->duration = duration; hdr->duration = duration & 0x7FFF;
hdr->data_len = iLen; hdr->data_len = iLen;
hdr->isResponse = !readerToTag; hdr->isResponse = !readerToTag;
trace_len += TRACELOG_HDR_LEN; trace_len += TRACELOG_HDR_LEN;
// data bytes // data bytes
if (btBytes != NULL && iLen != 0) { if (btBytes != NULL && iLen != 0) {
memcpy(trace + trace_len, btBytes, iLen); memcpy(hdr->frame, btBytes, iLen);
trace_len += iLen;
} }
trace_len += iLen;
// parity bytes // parity bytes
if (num_paritybytes != 0) { if (num_paritybytes != 0) {
@ -217,8 +213,8 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
} else { } else {
memset(trace + trace_len, 0x00, num_paritybytes); memset(trace + trace_len, 0x00, num_paritybytes);
} }
trace_len += num_paritybytes;
} }
trace_len += num_paritybytes;
return true; return true;
} }

View file

@ -19,7 +19,7 @@
#define MAX_MIFARE_FRAME_SIZE 18 // biggest Mifare frame is answer to a read (one block = 16 Bytes) + 2 Bytes CRC #define MAX_MIFARE_FRAME_SIZE 18 // biggest Mifare frame is answer to a read (one block = 16 Bytes) + 2 Bytes CRC
#define MAX_MIFARE_PARITY_SIZE 3 // need 18 parity bits for the 18 Byte above. 3 Bytes are enough to store these #define MAX_MIFARE_PARITY_SIZE 3 // need 18 parity bits for the 18 Byte above. 3 Bytes are enough to store these
#define CARD_MEMORY_SIZE 4096 #define CARD_MEMORY_SIZE 4096
#define DMA_BUFFER_SIZE 256 //128 (how big is the dma?!? #define DMA_BUFFER_SIZE 128
uint8_t *BigBuf_get_addr(void); uint8_t *BigBuf_get_addr(void);
uint32_t BigBuf_get_size(void); uint32_t BigBuf_get_size(void);