mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
Use GetTickCountDelta everywhere
This commit is contained in:
parent
86ee0658cf
commit
522297896c
3 changed files with 28 additions and 23 deletions
|
@ -105,8 +105,8 @@ void ReadLastTagFromFlash() {
|
||||||
}
|
}
|
||||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||||
|
|
||||||
uint32_t end_time;
|
uint32_t start_time = GetTickCount();
|
||||||
uint32_t start_time = end_time = GetTickCount();
|
uint32_t delta_time = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < len; i += size) {
|
for (size_t i = 0; i < len; i += size) {
|
||||||
len = MIN((len - i), size);
|
len = MIN((len - i), size);
|
||||||
|
@ -121,7 +121,7 @@ void ReadLastTagFromFlash() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end_time = GetTickCount();
|
delta_time = GetTickCountDelta(start_time);
|
||||||
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
DbprintfEx(FLAG_NEWLINE, "%s[IN]%s %s%dms%s for TAG_FLASH_READ", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
DbprintfEx(FLAG_NEWLINE, "%s[IN]%s %s%dms%s for TAG_FLASH_READ", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||||
|
@ -155,8 +155,8 @@ void WriteTagToFlash(uint8_t index, size_t size) {
|
||||||
Flash_WriteEnable();
|
Flash_WriteEnable();
|
||||||
Flash_Erase4k(0, 0);
|
Flash_Erase4k(0, 0);
|
||||||
|
|
||||||
uint32_t end_time;
|
uint32_t start_time = GetTickCount();
|
||||||
uint32_t start_time = end_time = GetTickCount();
|
uint32_t delta_time = 0;
|
||||||
|
|
||||||
while (bytes_remaining > 0) {
|
while (bytes_remaining > 0) {
|
||||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||||
|
@ -184,7 +184,7 @@ void WriteTagToFlash(uint8_t index, size_t size) {
|
||||||
LED_C_INV();
|
LED_C_INV();
|
||||||
LED_D_INV();
|
LED_D_INV();
|
||||||
}
|
}
|
||||||
end_time = GetTickCount();
|
delta_time = GetTickCountDelta(start_time);
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "[OK] TAG WRITTEN TO FLASH ! [0-to offset %u]", bytes_sent);
|
DbprintfEx(FLAG_NEWLINE, "[OK] TAG WRITTEN TO FLASH ! [0-to offset %u]", bytes_sent);
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
@ -393,8 +393,8 @@ failtag:
|
||||||
cjSetCursRight();
|
cjSetCursRight();
|
||||||
DbprintfEx(FLAG_NEWLINE, "--------+--------------------+-------");
|
DbprintfEx(FLAG_NEWLINE, "--------+--------------------+-------");
|
||||||
|
|
||||||
uint32_t end_time;
|
uint32_t start_time = GetTickCount();
|
||||||
uint32_t start_time = end_time = GetTickCount();
|
uint32_t delta_time = 0;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// WE SHOULD FIND A WAY TO GET UID TO AVOID THIS "TESTRUN"
|
// WE SHOULD FIND A WAY TO GET UID TO AVOID THIS "TESTRUN"
|
||||||
|
@ -736,7 +736,7 @@ failtag:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end_time = GetTickCount();
|
delta_time = GetTickCountDelta(start_time);
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "%s>>%s Time for VIGIK break :%s%dms%s", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
DbprintfEx(FLAG_NEWLINE, "%s>>%s Time for VIGIK break :%s%dms%s", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||||
|
|
|
@ -382,23 +382,22 @@ void printConnSpeed(void) {
|
||||||
|
|
||||||
#define CONN_SPEED_TEST_MIN_TIME 500 // in milliseconds
|
#define CONN_SPEED_TEST_MIN_TIME 500 // in milliseconds
|
||||||
uint8_t *test_data = BigBuf_get_addr();
|
uint8_t *test_data = BigBuf_get_addr();
|
||||||
uint32_t end_time;
|
uint32_t start_time = GetTickCount();
|
||||||
|
uint32_t delta_time = 0;
|
||||||
uint32_t start_time = end_time = GetTickCount();
|
|
||||||
uint32_t bytes_transferred = 0;
|
uint32_t bytes_transferred = 0;
|
||||||
|
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
|
|
||||||
while (end_time < start_time + CONN_SPEED_TEST_MIN_TIME) {
|
while (delta_time < CONN_SPEED_TEST_MIN_TIME) {
|
||||||
reply_ng(CMD_DOWNLOADED_BIGBUF, PM3_SUCCESS, test_data, PM3_CMD_DATA_SIZE);
|
reply_ng(CMD_DOWNLOADED_BIGBUF, PM3_SUCCESS, test_data, PM3_CMD_DATA_SIZE);
|
||||||
end_time = GetTickCount();
|
|
||||||
bytes_transferred += PM3_CMD_DATA_SIZE;
|
bytes_transferred += PM3_CMD_DATA_SIZE;
|
||||||
|
delta_time = GetTickCountDelta(start_time);
|
||||||
}
|
}
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
|
|
||||||
Dbprintf(" Time elapsed............%dms", end_time - start_time);
|
Dbprintf(" Time elapsed............%dms", delta_time);
|
||||||
Dbprintf(" Bytes transferred.......%d", bytes_transferred);
|
Dbprintf(" Bytes transferred.......%d", bytes_transferred);
|
||||||
Dbprintf(" Transfer Speed PM3 -> Client = " _YELLOW_("%d") " bytes/s", 1000 * bytes_transferred / (end_time - start_time));
|
Dbprintf(" Transfer Speed PM3 -> Client = " _YELLOW_("%d") " bytes/s", 1000 * bytes_transferred / delta_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ void CodeIso14443aAsReaderPar(const uint8_t *cmd, uint16_t len, const uint8_t *p
|
||||||
int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par) {
|
int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
|
|
||||||
uint32_t timer = 0, vtime;
|
uint32_t timer = 0;
|
||||||
int analogCnt = 0;
|
int analogCnt = 0;
|
||||||
int analogAVG = 0;
|
int analogAVG = 0;
|
||||||
|
|
||||||
|
@ -1662,11 +1662,17 @@ int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par) {
|
||||||
AT91C_BASE_ADC->ADC_CR = AT91C_ADC_START;
|
AT91C_BASE_ADC->ADC_CR = AT91C_ADC_START;
|
||||||
if (analogCnt >= 32) {
|
if (analogCnt >= 32) {
|
||||||
if ((MAX_ADC_HF_VOLTAGE_RDV40 * (analogAVG / analogCnt) >> 10) < MF_MINFIELDV) {
|
if ((MAX_ADC_HF_VOLTAGE_RDV40 * (analogAVG / analogCnt) >> 10) < MF_MINFIELDV) {
|
||||||
vtime = GetTickCount();
|
if (timer == 0) {
|
||||||
if (!timer) timer = vtime;
|
timer = GetTickCount();
|
||||||
// 50ms no field --> card to idle state
|
} else {
|
||||||
if (vtime - timer > 50) return 2;
|
// 50ms no field --> card to idle state
|
||||||
} else if (timer) timer = 0;
|
if (GetTickCountDelta(timer) > 50) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
timer = 0;
|
||||||
|
}
|
||||||
analogCnt = 0;
|
analogCnt = 0;
|
||||||
analogAVG = 0;
|
analogAVG = 0;
|
||||||
}
|
}
|
||||||
|
@ -2041,7 +2047,7 @@ static int GetATQA(uint8_t *resp, uint8_t *resp_par) {
|
||||||
ReaderTransmitBitsPar(wupa, 7, NULL, NULL);
|
ReaderTransmitBitsPar(wupa, 7, NULL, NULL);
|
||||||
// Receive the ATQA
|
// Receive the ATQA
|
||||||
len = ReaderReceive(resp, resp_par);
|
len = ReaderReceive(resp, resp_par);
|
||||||
} while (len == 0 && GetTickCount() <= start_time + WUPA_RETRY_TIMEOUT);
|
} while (len == 0 && GetTickCountDelta(start_time) <= WUPA_RETRY_TIMEOUT);
|
||||||
|
|
||||||
iso14a_set_timeout(save_iso14a_timeout);
|
iso14a_set_timeout(save_iso14a_timeout);
|
||||||
return len;
|
return len;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue