mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-13 18:17:25 -07:00
change: re-added trace log
This commit is contained in:
parent
ff5b046903
commit
0d0b651246
2 changed files with 26 additions and 3 deletions
|
@ -151,6 +151,9 @@ static void tx_frame(uint32_t frame, uint8_t len) {
|
|||
last_frame_end += RWD_FRAME_WAIT;
|
||||
while(GET_TICKS < last_frame_end) { };
|
||||
|
||||
// backup ts for trace log
|
||||
uint32_t last_frame_start = last_frame_end;
|
||||
|
||||
// transmit frame, MSB first
|
||||
for(uint8_t i = 0; i < len; ++i) {
|
||||
bool bit = (frame >> i) & 0x01;
|
||||
|
@ -163,6 +166,10 @@ static void tx_frame(uint32_t frame, uint8_t len) {
|
|||
last_frame_end += RWD_TIME_PAUSE;
|
||||
while(GET_TICKS < last_frame_end) { };
|
||||
HIGH(GPIO_SSC_DOUT);
|
||||
|
||||
// log
|
||||
uint8_t cmdbytes[] = {len, BYTEx(frame, 0), BYTEx(frame, 1), BYTEx(frame, 2)};
|
||||
LogTrace(cmdbytes, sizeof(cmdbytes), last_frame_start, last_frame_end, NULL, true);
|
||||
}
|
||||
|
||||
static uint32_t rx_frame(uint8_t len) {
|
||||
|
@ -174,6 +181,9 @@ static uint32_t rx_frame(uint8_t len) {
|
|||
last_frame_end += TAG_FRAME_WAIT;
|
||||
while(GET_TICKS < last_frame_end) { };
|
||||
|
||||
// backup ts for trace log
|
||||
uint32_t last_frame_start = last_frame_end;
|
||||
|
||||
uint32_t frame = 0;
|
||||
for(uint8_t i = 0; i < len; i++) {
|
||||
frame |= (rx_bit() ^ legic_prng_get_bit()) << i;
|
||||
|
@ -184,6 +194,10 @@ static uint32_t rx_frame(uint8_t len) {
|
|||
while(GET_TICKS < last_frame_end) { };
|
||||
}
|
||||
|
||||
// log
|
||||
uint8_t cmdbytes[] = {len, BYTEx(frame, 0), BYTEx(frame, 1)};
|
||||
LogTrace(cmdbytes, sizeof(cmdbytes), last_frame_start, last_frame_end, NULL, false);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
@ -197,6 +211,9 @@ static bool rx_ack() {
|
|||
last_frame_end += TAG_FRAME_WAIT;
|
||||
while(GET_TICKS < last_frame_end) { };
|
||||
|
||||
// backup ts for trace log
|
||||
uint32_t last_frame_start = last_frame_end;
|
||||
|
||||
uint32_t ack = 0;
|
||||
for(uint8_t i = 0; i < TAG_WRITE_TIMEOUT; ++i) {
|
||||
// sample bit
|
||||
|
@ -213,6 +230,10 @@ static bool rx_ack() {
|
|||
}
|
||||
}
|
||||
|
||||
// log
|
||||
uint8_t cmdbytes[] = {1, BYTEx(ack, 0)};
|
||||
LogTrace(cmdbytes, sizeof(cmdbytes), last_frame_start, last_frame_end, NULL, false);
|
||||
|
||||
return ack;
|
||||
}
|
||||
|
||||
|
@ -293,6 +314,8 @@ static uint32_t setup_phase_reader(uint8_t iv) {
|
|||
last_frame_end = GET_TICKS;
|
||||
|
||||
// Switch on carrier and let the card charge for 5ms.
|
||||
last_frame_end += 7500;
|
||||
|
||||
// Use the time to calibrate the treshhold.
|
||||
input_threshold = 8; // heuristically determined
|
||||
do {
|
||||
|
@ -300,7 +323,7 @@ static uint32_t setup_phase_reader(uint8_t iv) {
|
|||
if(sample > input_threshold) {
|
||||
input_threshold = sample;
|
||||
}
|
||||
} while(GET_TICKS < last_frame_end + 7500);
|
||||
} while(GET_TICKS < last_frame_end);
|
||||
|
||||
// Set threshold to noise floor * 2
|
||||
input_threshold <<= 1;
|
||||
|
|
|
@ -518,9 +518,9 @@ int CmdTraceList(const char *Cmd) {
|
|||
if ( protocol == ISO_14443A || protocol == PROTO_MIFARE)
|
||||
PrintAndLogEx(NORMAL, "iso14443a - All times are in carrier periods (1/13.56Mhz)");
|
||||
if ( protocol == ICLASS )
|
||||
PrintAndLogEx(NORMAL, "iClass - Timings are not as accurate");
|
||||
PrintAndLogEx(NORMAL, "iClass - Timings are not as accurate");
|
||||
if ( protocol == LEGIC )
|
||||
PrintAndLogEx(NORMAL, "LEGIC - Timings are in ticks (1us == 1.5ticks)");
|
||||
PrintAndLogEx(NORMAL, "LEGIC - Timings are in ticks (1us == 1.5ticks)");
|
||||
if ( protocol == ISO_15693 )
|
||||
PrintAndLogEx(NORMAL, "ISO15693 - Timings are not as accurate");
|
||||
if ( protocol == FELICA )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue