mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 15:26:13 +08:00
Less fantasy in the LogTrace usages regarding timestamps
This commit is contained in:
parent
37ae102e38
commit
be42995f8a
|
@ -156,12 +156,24 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
|
|||
tracing = false; // don't trace any more
|
||||
return false;
|
||||
}
|
||||
if (timestamp_end - timestamp_start > 0x7FFF) {
|
||||
Dbprintf("Error in LogTrace: duration too long for UINT16: 0x%08x", timestamp_end - timestamp_start);
|
||||
return false; // duration too long, must be max 15 bits
|
||||
|
||||
uint32_t duration;
|
||||
if (timestamp_end > timestamp_start) {
|
||||
duration = timestamp_end - timestamp_start;
|
||||
} else {
|
||||
duration = (UINT32_MAX - timestamp_start) + timestamp_end;
|
||||
}
|
||||
|
||||
if (duration > 0x7FFF) {
|
||||
if (DBGLEVEL >= 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("Forcing duration = 0");
|
||||
}
|
||||
duration = 0;
|
||||
}
|
||||
|
||||
hdr->timestamp = timestamp_start;
|
||||
hdr->duration = timestamp_end - timestamp_start;
|
||||
hdr->duration = duration;
|
||||
hdr->data_len = iLen;
|
||||
hdr->isResponse = !readerToTag;
|
||||
traceLen += TRACELOG_HDR_LEN;
|
||||
|
|
|
@ -1238,7 +1238,7 @@ void SimulateHitag2(bool tag_mem_supplied, uint8_t *data) {
|
|||
// Check if frame was captured
|
||||
if (rxlen > 4) {
|
||||
|
||||
LogTrace(rx, nbytes(rxlen), response, 0, NULL, true);
|
||||
LogTrace(rx, nbytes(rxlen), response, response, NULL, true);
|
||||
|
||||
// Process the incoming frame (rx) and prepare the outgoing frame (tx)
|
||||
hitag2_handle_reader_command(rx, rxlen, tx, &txlen);
|
||||
|
|
|
@ -1039,7 +1039,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
|||
// Check if frame was captured
|
||||
if (rxlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(rx, nbytes(rxlen), response, 0, NULL, true);
|
||||
LogTrace(rx, nbytes(rxlen), response, response, NULL, true);
|
||||
|
||||
// Disable timer 1 with external trigger to avoid triggers during our own modulation
|
||||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS;
|
||||
|
@ -1281,7 +1281,7 @@ void ReadHitagS(hitag_function htf, hitag_data *htd) {
|
|||
// Check if frame was captured and store it
|
||||
if (rxlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(rx, nbytes(rxlen), response, 0, NULL, false);
|
||||
LogTrace(rx, nbytes(rxlen), response, response, NULL, false);
|
||||
}
|
||||
|
||||
// By default reset the transmission buffer
|
||||
|
@ -1410,7 +1410,7 @@ void ReadHitagS(hitag_function htf, hitag_data *htd) {
|
|||
// Add transmitted frame to total count
|
||||
if (txlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(tx, nbytes(txlen), HITAG_T_WAIT_2, 0, NULL, true);
|
||||
LogTrace(tx, nbytes(txlen), HITAG_T_WAIT_2, HITAG_T_WAIT_2, NULL, true);
|
||||
}
|
||||
|
||||
hitagS_receive_frame(rx, &rxlen, &response);
|
||||
|
@ -1538,7 +1538,7 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page) {
|
|||
// Check if frame was captured and store it
|
||||
if (rxlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(rx, nbytes(rxlen), response, 0, NULL, false);
|
||||
LogTrace(rx, nbytes(rxlen), response, response, NULL, false);
|
||||
}
|
||||
|
||||
//check for valid input
|
||||
|
@ -1625,7 +1625,7 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page) {
|
|||
// Add transmitted frame to total count
|
||||
if (txlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(tx, nbytes(txlen), HITAG_T_WAIT_2, 0, NULL, true);
|
||||
LogTrace(tx, nbytes(txlen), HITAG_T_WAIT_2, HITAG_T_WAIT_2, NULL, true);
|
||||
}
|
||||
|
||||
hitagS_receive_frame(rx, &rxlen, &response);
|
||||
|
@ -1732,7 +1732,7 @@ void check_challenges(bool file_given, uint8_t *data) {
|
|||
// Check if frame was captured and store it
|
||||
if (rxlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(rx, nbytes(rxlen), response, 0, NULL, false);
|
||||
LogTrace(rx, nbytes(rxlen), response, response, NULL, false);
|
||||
}
|
||||
|
||||
uint8_t *tx = txbuf;
|
||||
|
@ -1864,7 +1864,7 @@ void check_challenges(bool file_given, uint8_t *data) {
|
|||
// Add transmitted frame to total count
|
||||
if (txlen > 0) {
|
||||
// frame_count++;
|
||||
LogTrace(tx, nbytes(txlen), HITAG_T_WAIT_2, 0, NULL, true);
|
||||
LogTrace(tx, nbytes(txlen), HITAG_T_WAIT_2, HITAG_T_WAIT_2, NULL, true);
|
||||
}
|
||||
|
||||
hitagS_receive_frame(rx, &rxlen, &response);
|
||||
|
|
|
@ -1152,7 +1152,7 @@ static void CodeAndTransmit14443bAsReader(const uint8_t *cmd, int len) {
|
|||
|
||||
if (g_trigger) LED_A_ON();
|
||||
|
||||
LogTrace(cmd, len, time_start, GetCountSspClk() - time_start, NULL, true);
|
||||
LogTrace(cmd, len, time_start, GetCountSspClk(), NULL, true);
|
||||
}
|
||||
|
||||
/* Sends an APDU to the tag
|
||||
|
|
|
@ -431,7 +431,7 @@ static int GetIso15693AnswerFromTag(uint8_t *received, int *elapsed) {
|
|||
getNext = !getNext;
|
||||
}
|
||||
}
|
||||
time_stop = GetCountSspClk() - time_0 ;
|
||||
time_stop = GetCountSspClk();
|
||||
int len = DemodAnswer(received, buf, counter);
|
||||
LogTrace(received, len, time_0 << 4, time_stop << 4, NULL, false);
|
||||
BigBuf_free();
|
||||
|
@ -478,7 +478,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *received, int *samples, int *elap
|
|||
}
|
||||
}
|
||||
|
||||
time_stop = GetCountSspClk() - time_0;
|
||||
time_stop = GetCountSspClk();
|
||||
int k = DemodAnswer(received, buf, counter);
|
||||
LogTrace(received, k, time_0 << 4, time_stop << 4, NULL, false);
|
||||
return k;
|
||||
|
@ -522,7 +522,7 @@ void AcquireRawAdcSamplesIso15693(void) {
|
|||
}
|
||||
|
||||
|
||||
LogTrace(cmd, CMD_ID_RESP, time_start << 4, (GetCountSspClk() - time_start) << 4, NULL, true);
|
||||
LogTrace(cmd, CMD_ID_RESP, time_start << 4, GetCountSspClk() << 4, NULL, true);
|
||||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||
|
||||
|
@ -723,7 +723,7 @@ static int SendDataTag(uint8_t *send, int sendlen, bool init, int speed, uint8_t
|
|||
uint32_t time_start = GetCountSspClk();
|
||||
|
||||
TransmitTo15693Tag(ToSend, ToSendMax, &t_samples, &wait);
|
||||
LogTrace(send, sendlen, time_start << 4, (GetCountSspClk() - time_start) << 4, NULL, true);
|
||||
LogTrace(send, sendlen, time_start << 4, GetCountSspClk() << 4, NULL, true);
|
||||
|
||||
// Now wait for a response
|
||||
if (outdata != NULL) {
|
||||
|
@ -825,7 +825,7 @@ void ReaderIso15693(uint32_t parameter) {
|
|||
uint8_t cmd[CMD_ID_RESP] = {0};
|
||||
BuildIdentifyRequest(cmd);
|
||||
TransmitTo15693Tag(ToSend, ToSendMax, &tsamples, &wait);
|
||||
LogTrace(cmd, CMD_ID_RESP, time_start << 4, (GetCountSspClk() - time_start) << 4, NULL, true);
|
||||
LogTrace(cmd, CMD_ID_RESP, time_start << 4, GetCountSspClk() << 4, NULL, true);
|
||||
|
||||
// Now wait for a response
|
||||
answerLen1 = GetIso15693AnswerFromTag(answer1, &elapsed) ;
|
||||
|
@ -906,7 +906,7 @@ void SimTagIso15693(uint32_t parameter, uint8_t *uid) {
|
|||
|
||||
time_start = GetCountSspClk();
|
||||
TransmitTo15693Reader(ToSend, ToSendMax, &tsamples, &wait);
|
||||
LogTrace(cmd, CMD_INV_RESP, time_start << 4, (GetCountSspClk() - time_start) << 4, NULL, true);
|
||||
LogTrace(cmd, CMD_INV_RESP, time_start << 4, GetCountSspClk() << 4, NULL, true);
|
||||
|
||||
if (DBGLEVEL >= DBG_EXTENDED) {
|
||||
Dbprintf("[+] %d octets read from reader command: %x %x %x %x %x %x %x %x", ans,
|
||||
|
|
Loading…
Reference in a new issue