CHG: Small steps, the waiting time between frames was unclear. At least now the tags answers to a readbyte command after the setup phase.

This commit is contained in:
iceman1001
2016-09-12 09:19:49 +02:00
parent 76471e5d17
commit 111c6934d4
3 changed files with 120 additions and 150 deletions
+114 -136
View File
File diff suppressed because it is too large Load Diff
+4 -8
View File
@@ -351,8 +351,7 @@ void StartCountUS() {
uint32_t RAMFUNC GetCountUS(){
//return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV / 15) * 10);
// By suggestion from PwPiwi, http://www.proxmark.org/forum/viewtopic.php?pid=17548#p17548
//return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV * 2) / 3);
return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV << 1) / 3);
return (AT91C_BASE_TC1->TC_CV * 0x8000) + ((AT91C_BASE_TC0->TC_CV * 2) / 3);
}
void ResetUSClock(void) {
//enable clock of timer and software trigger
@@ -363,12 +362,9 @@ void ResetUSClock(void) {
// attempt at high resolution microsecond timer
// beware: timer counts in 21.3uS increments (1024/48Mhz)
void SpinDelayCountUs(uint32_t us) {
us += GetCountUS();
us -= 6;
for(;;)
if ( GetCountUS() >= us ) return;
if (us < 8) return;
us += GetCountUS();
while ( GetCountUS() < us ){}
}
// static uint32_t GlobalUsCounter = 0;
+2 -6
View File
@@ -415,22 +415,18 @@ int CmdLegicRFRead(const char *Cmd) {
clearCommandBuffer();
SendCommand(&c);
UsbCommand resp;
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
uint8_t isOK = resp.arg[0] & 0xFF;
uint16_t len = resp.arg[1] & 0x3FF;
if ( isOK ) {
PrintAndLog("OK : %d", isOK);
PrintAndLog("use 'hf legic decode' or");
PrintAndLog("'data hexsamples %d' to view results", len);
}
} else {
PrintAndLog("command execution time out");
return 1;
}
//uint8_t got[12000];
//GetFromBigBuf(got,sizeof(got),0);
//WaitForResponse(CMD_ACK,NULL);
return 0;
}