This commit is contained in:
iceman1001 2019-04-28 11:08:41 +02:00
commit ab6870c573
8 changed files with 67 additions and 67 deletions

View file

@ -96,10 +96,10 @@ void BigBuf_free_keep_EM(void) {
} }
void BigBuf_print_status(void) { void BigBuf_print_status(void) {
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Memory")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Memory"));
Dbprintf(" BIGBUF_SIZE.............%d", BIGBUF_SIZE); Dbprintf(" BIGBUF_SIZE.............%d", BIGBUF_SIZE);
Dbprintf(" Available memory........%d", BigBuf_hi); Dbprintf(" Available memory........%d", BigBuf_hi);
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Tracing")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Tracing"));
Dbprintf(" tracing ................%d", tracing); Dbprintf(" tracing ................%d", tracing);
Dbprintf(" traceLen ...............%d", traceLen); Dbprintf(" traceLen ...............%d", traceLen);
} }

View file

@ -124,7 +124,7 @@ void ReadLastTagFromFlash() {
end_time = GetTickCount(); end_time = GetTickCount();
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|FLAG_ANSI, "%s[IN]%s %s%dms%s for TAG_FLASH_READ", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s[IN]%s %s%dms%s for TAG_FLASH_READ", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
FlashStop(); FlashStop();
SpinOff(0); SpinOff(0);
@ -188,7 +188,7 @@ void WriteTagToFlash(uint8_t index, size_t size) {
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();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[IN]%s %s%dms%s for TAG_FLASH_WRITE", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s[IN]%s %s%dms%s for TAG_FLASH_WRITE", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
FlashStop(); FlashStop();
SpinOff(0); SpinOff(0);
@ -329,8 +329,8 @@ void RunMod() {
// banner: // banner:
vtsend_reset(NULL); vtsend_reset(NULL);
DbprintfEx(FLAG_NEWLINE, "\r\n%s", clearTerm); DbprintfEx(FLAG_NEWLINE, "\r\n%s", clearTerm);
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s%s%s", _CYAN_, sub_banner, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s%s%s", _CYAN_, sub_banner, _WHITE_);
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s C.J.B's MifareFastPwn Started\r\n", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>%s C.J.B's MifareFastPwn Started\r\n", _RED_, _WHITE_);
currline = 20; currline = 20;
curlline = 20; curlline = 20;
@ -370,16 +370,16 @@ failtag:
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
vtsend_cursor_position_restore(NULL); vtsend_cursor_position_restore(NULL);
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "\t\t\t%s[ GOT a Tag ! ]%s", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "\t\t\t%s[ GOT a Tag ! ]%s", _GREEN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE, "\t\t\t `---> Breaking keys ---->"); DbprintfEx(FLAG_NEWLINE, "\t\t\t `---> Breaking keys ---->");
cjSetCursRight(); cjSetCursRight();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "\t%sGOT TAG :%s %08x%s", _RED_, _CYAN_, cjcuid, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "\t%sGOT TAG :%s %08x%s", _RED_, _CYAN_, cjcuid, _WHITE_);
if (cjcuid == 0) { if (cjcuid == 0) {
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s BUG: 0000_CJCUID! Retrying...", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>%s BUG: 0000_CJCUID! Retrying...", _RED_, _WHITE_);
SpinErr(0, 100, 8); SpinErr(0, 100, 8);
goto failtag; goto failtag;
} }
@ -452,19 +452,19 @@ failtag:
// COMMON SCHEME 1 : INFINITRON/HEXACT // COMMON SCHEME 1 : INFINITRON/HEXACT
case 0x484558414354: case 0x484558414354:
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%sDetected: %s INFI_HEXACT_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%sDetected: %s INFI_HEXACT_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
; ;
// Type 0 / A first // Type 0 / A first
uint16_t t = 0; uint16_t t = 0;
@ -597,19 +597,19 @@ failtag:
case 0x8829da9daf76: case 0x8829da9daf76:
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%sDetected :%sURMET_CAPTIVE_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%sDetected :%sURMET_CAPTIVE_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
// emlClearMem(); // emlClearMem();
@ -639,19 +639,19 @@ failtag:
case 0x424c41524f4e: case 0x424c41524f4e:
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s Detected :%sNORALSY_VIGIK_TAG %s", _ORANGE_, _CYAN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s Detected :%sNORALSY_VIGIK_TAG %s", _ORANGE_, _CYAN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
t = 0; t = 0;
for (uint16_t s = 0; s < sectorsCnt; s++) { for (uint16_t s = 0; s < sectorsCnt; s++) {
@ -692,7 +692,7 @@ failtag:
if (!allKeysFound) { if (!allKeysFound) {
cjSetCursLeft(); cjSetCursLeft();
cjTabulize(); cjTabulize();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[ FAIL ]%s\r\n->did not found all the keys :'(", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s[ FAIL ]%s\r\n->did not found all the keys :'(", _RED_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
SpinErr(1, 100, 8); SpinErr(1, 100, 8);
SpinOff(100); SpinOff(100);
@ -711,25 +711,25 @@ failtag:
} }
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _YELLOW_, _WHITE_, _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _YELLOW_, _WHITE_, _GREEN_, _WHITE_);
/* filling TAG to emulator */ /* filling TAG to emulator */
uint8_t filled = 0; uint8_t filled = 0;
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s Filling Emulator <- from A keys...", _YELLOW_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>%s Filling Emulator <- from A keys...", _YELLOW_, _WHITE_);
e_MifareECardLoad(sectorsCnt, 0, 0, &filled); e_MifareECardLoad(sectorsCnt, 0, 0, &filled);
if (filled != 1) { if (filled != 1) {
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _RED_, _ORANGE_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _RED_, _ORANGE_, _WHITE_);
/* no trace, no dbg */ /* no trace, no dbg */
e_MifareECardLoad(sectorsCnt, 1, 0, &filled); e_MifareECardLoad(sectorsCnt, 1, 0, &filled);
if (filled != 1) { if (filled != 1) {
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "FATAL:EML_FALLBACKFILL_B"); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "FATAL:EML_FALLBACKFILL_B");
SpinErr(2, 100, 8); SpinErr(2, 100, 8);
SpinOff(100); SpinOff(100);
return; return;
@ -739,7 +739,7 @@ failtag:
end_time = GetTickCount(); end_time = GetTickCount();
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s Time for VIGIK break :%s%dms%s", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>%s Time for VIGIK break :%s%dms%s", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
vtsend_cursor_position_save(NULL); vtsend_cursor_position_save(NULL);
vtsend_set_attribute(NULL, 1); vtsend_set_attribute(NULL, 1);
@ -758,10 +758,10 @@ readysim:
DbprintfEx(FLAG_NEWLINE, "-> We launch Emulation ->"); DbprintfEx(FLAG_NEWLINE, "-> We launch Emulation ->");
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s!> HOLD ON : %s When you'll click, simm will stop", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s!> HOLD ON : %s When you'll click, simm will stop", _RED_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "Then %s immediately %s we'll try to %s dump our emulator state%s \r\nin a %s chinese tag%s", _RED_, _WHITE_, _YELLOW_, _WHITE_, DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "Then %s immediately %s we'll try to %s dump our emulator state%s \r\nin a %s chinese tag%s", _RED_, _WHITE_, _YELLOW_, _WHITE_,
_CYAN_, _WHITE_); _CYAN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
cjSetCursLeft(); cjSetCursLeft();
@ -777,7 +777,7 @@ readysim:
LED_C_OFF(); LED_C_OFF();
SpinOff(50); SpinOff(50);
vtsend_cursor_position_restore(NULL); vtsend_cursor_position_restore(NULL);
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "[ SIMUL ENDED ]%s", _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "[ SIMUL ENDED ]%s", _GREEN_, _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE, "<- We're out of Emulation"); DbprintfEx(FLAG_NEWLINE, "<- We're out of Emulation");
@ -789,7 +789,7 @@ readysim:
saMifareMakeTag(); saMifareMakeTag();
cjSetCursLeft(); cjSetCursLeft();
vtsend_cursor_position_restore(NULL); vtsend_cursor_position_restore(NULL);
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[ CLONED? ]", _CYAN_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s[ CLONED? ]", _CYAN_);
DbprintfEx(FLAG_NEWLINE, "-> End Cloning."); DbprintfEx(FLAG_NEWLINE, "-> End Cloning.");
WDT_HIT(); WDT_HIT();
@ -799,7 +799,7 @@ readysim:
cjTabulize(); cjTabulize();
vtsend_set_attribute(NULL, 0); vtsend_set_attribute(NULL, 0);
vtsend_set_attribute(NULL, 7); vtsend_set_attribute(NULL, 7);
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "- [ LA FIN ] -\r\n%s`-> You can take shell back :) ...", _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "- [ LA FIN ] -\r\n%s`-> You can take shell back :) ...", _WHITE_);
cjSetCursLeft(); cjSetCursLeft();
vtsend_set_attribute(NULL, 0); vtsend_set_attribute(NULL, 0);
SpinErr(3, 100, 16); SpinErr(3, 100, 16);
@ -909,7 +909,7 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
// if (!iso14443a_fast_select_card(cjuid, 0)) { // if (!iso14443a_fast_select_card(cjuid, 0)) {
if (!iso14443a_select_card(cjuid, NULL, &cjcuid, true, 0, true)) { if (!iso14443a_select_card(cjuid, NULL, &cjcuid, true, 0, true)) {
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%sFATAL%s : E_MF_LOSTTAG", _RED_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%sFATAL%s : E_MF_LOSTTAG", _RED_, _WHITE_);
return -1; return -1;
} }
@ -968,7 +968,7 @@ void saMifareMakeTag(void) {
if (currfline > 53) { if (currfline > 53) {
currfline = 54; currfline = 54;
} }
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "Block :%02x %sOK%s", blockNum, _GREEN_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "Block :%02x %sOK%s", blockNum, _GREEN_, _WHITE_);
// DbprintfEx(FLAG_RAWPRINT,"FATAL:E_MF_CHINESECOOK_NORICE"); // DbprintfEx(FLAG_RAWPRINT,"FATAL:E_MF_CHINESECOOK_NORICE");
// cfail=1; // cfail=1;
// return; // return;
@ -977,15 +977,15 @@ void saMifareMakeTag(void) {
cjSetCursLeft(); cjSetCursLeft();
cjSetCursLeft(); cjSetCursLeft();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _RED_, _WHITE_, blockNum); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _RED_, _WHITE_, blockNum);
cjSetCursFRight(); cjSetCursFRight();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>%s STOP AT %02x", _RED_, _WHITE_, blockNum); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>%s STOP AT %02x", _RED_, _WHITE_, blockNum);
cfail++; cfail++;
break; break;
} }
cjSetCursFRight(); cjSetCursFRight();
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>> END <<<<<<<<%s", _YELLOW_, _WHITE_); DbprintfEx(FLAG_NEWLINE | FLAG_ANSI, "%s>>>>>>>> END <<<<<<<<%s", _YELLOW_, _WHITE_);
// break; // break;
/*if (cfail == 1) { /*if (cfail == 1) {
DbprintfEx(FLAG_RAWPRINT,"FATAL: E_MF_HARA_KIRI_\r\n"); DbprintfEx(FLAG_RAWPRINT,"FATAL: E_MF_HARA_KIRI_\r\n");

View file

@ -30,8 +30,8 @@ void RunMod() {
int button_pressed = BUTTON_HELD(1000); int button_pressed = BUTTON_HELD(1000);
Dbprintf("button %d", button_pressed); Dbprintf("button %d", button_pressed);
if ( button_pressed ) if (button_pressed)
break; break;
} }

View file

@ -371,7 +371,7 @@ void SendVersion(void) {
// measure the USB Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time. // measure the USB Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included. // Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included.
void printUSBSpeed(void) { void printUSBSpeed(void) {
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Transfer Speed")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Transfer Speed"));
Dbprintf(" Sending packets to client..."); Dbprintf(" Sending packets to client...");
#define USB_SPEED_TEST_MIN_TIME 1500 // in milliseconds #define USB_SPEED_TEST_MIN_TIME 1500 // in milliseconds
@ -412,12 +412,12 @@ void SendStatus(void) {
printT55xxConfig(); // LF T55XX Config printT55xxConfig(); // LF T55XX Config
#endif #endif
printUSBSpeed(); printUSBSpeed();
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Various")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Various"));
Dbprintf(" MF_DBGLEVEL.............%d", MF_DBGLEVEL); Dbprintf(" MF_DBGLEVEL.............%d", MF_DBGLEVEL);
Dbprintf(" ToSendMax...............%d", ToSendMax); Dbprintf(" ToSendMax...............%d", ToSendMax);
Dbprintf(" ToSendBit...............%d", ToSendBit); Dbprintf(" ToSendBit...............%d", ToSendBit);
Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE); Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE);
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Installed StandAlone Mode")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Installed StandAlone Mode"));
ModInfo(); ModInfo();
//DbpString("Running "); //DbpString("Running ");
@ -425,7 +425,7 @@ void SendStatus(void) {
//Dbprintf(" Is Device attached to FPC| %s", send_using_0 ? "Yes" : "No"); //Dbprintf(" Is Device attached to FPC| %s", send_using_0 ? "Yes" : "No");
//Dbprintf(" Is USB_reconnect value | %d", GetUSBreconnect() ); //Dbprintf(" Is USB_reconnect value | %d", GetUSBreconnect() );
//Dbprintf(" Is USB_configured value | %d", GetUSBconfigured() ); //Dbprintf(" Is USB_configured value | %d", GetUSBconfigured() );
reply_old(CMD_ACK, 1, 0, 0, 0, 0); reply_old(CMD_ACK, 1, 0, 0, 0, 0);
} }
@ -501,22 +501,22 @@ void ListenReaderField(int limit) {
} }
if (limit == HF_ONLY) { if (limit == HF_ONLY) {
hf_av = hf_max = AvgAdc(ADC_CHAN_HF);
// iceman, useless, since we are measuring readerfield, not our field. My tests shows a max of 20v from a reader. hf_av = hf_max = AvgAdc(ADC_CHAN_HF);
// RDV40 will hit the roof, try other ADC channel used in that hardware revision.
// iceman, useless, since we are measuring readerfield, not our field. My tests shows a max of 20v from a reader.
// RDV40 will hit the roof, try other ADC channel used in that hardware revision.
use_high = (((MAX_ADC_HF_VOLTAGE * hf_max) >> 10) > MAX_ADC_HF_VOLTAGE - 300); use_high = (((MAX_ADC_HF_VOLTAGE * hf_max) >> 10) > MAX_ADC_HF_VOLTAGE - 300);
if (use_high) { if (use_high) {
hf_av = hf_max = AvgAdc(ADC_CHAN_HF_RDV40); hf_av = hf_max = AvgAdc(ADC_CHAN_HF_RDV40);
} }
Dbprintf("HF 13.56MHz Baseline: %dmV", (MAX_ADC_HF_VOLTAGE * hf_av) >> 10); Dbprintf("HF 13.56MHz Baseline: %dmV", (MAX_ADC_HF_VOLTAGE * hf_av) >> 10);
hf_baseline = hf_av; hf_baseline = hf_av;
} }
for (;;) { for (;;) {
// Switch modes with button // Switch modes with button
if (BUTTON_PRESS()) { if (BUTTON_PRESS()) {
SpinDelay(500); SpinDelay(500);
@ -528,7 +528,7 @@ void ListenReaderField(int limit) {
case 2: case 2:
default: default:
DbpString("Stopped"); DbpString("Stopped");
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff(); LEDsoff();
return; return;
} }
@ -588,13 +588,13 @@ void ListenReaderField(int limit) {
display_max = lf_max; display_max = lf_max;
} }
} }
display_val = display_val * (4*LIGHT_LEVELS) / MAX(1,display_max); display_val = display_val * (4 * LIGHT_LEVELS) / MAX(1, display_max);
uint32_t duty_a = MIN(MAX(display_val, 0*LIGHT_LEVELS), 1*LIGHT_LEVELS) - 0*LIGHT_LEVELS; uint32_t duty_a = MIN(MAX(display_val, 0 * LIGHT_LEVELS), 1 * LIGHT_LEVELS) - 0 * LIGHT_LEVELS;
uint32_t duty_b = MIN(MAX(display_val, 1*LIGHT_LEVELS), 2*LIGHT_LEVELS) - 1*LIGHT_LEVELS; uint32_t duty_b = MIN(MAX(display_val, 1 * LIGHT_LEVELS), 2 * LIGHT_LEVELS) - 1 * LIGHT_LEVELS;
uint32_t duty_c = MIN(MAX(display_val, 2*LIGHT_LEVELS), 3*LIGHT_LEVELS) - 2*LIGHT_LEVELS; uint32_t duty_c = MIN(MAX(display_val, 2 * LIGHT_LEVELS), 3 * LIGHT_LEVELS) - 2 * LIGHT_LEVELS;
uint32_t duty_d = MIN(MAX(display_val, 3*LIGHT_LEVELS), 4*LIGHT_LEVELS) - 3*LIGHT_LEVELS; uint32_t duty_d = MIN(MAX(display_val, 3 * LIGHT_LEVELS), 4 * LIGHT_LEVELS) - 3 * LIGHT_LEVELS;
// LED A // LED A
if (duty_a == 0) { if (duty_a == 0) {
LED_A_OFF(); LED_A_OFF();
@ -607,7 +607,7 @@ void ListenReaderField(int limit) {
SpinDelay(LIGHT_LEVELS - duty_a); SpinDelay(LIGHT_LEVELS - duty_a);
} }
// LED B // LED B
if (duty_b == 0) { if (duty_b == 0) {
LED_B_OFF(); LED_B_OFF();
} else if (duty_b == LIGHT_LEVELS) { } else if (duty_b == LIGHT_LEVELS) {

View file

@ -517,7 +517,7 @@ void Flash_EraseChip(void) {
*/ */
void Flashmem_print_status(void) { void Flashmem_print_status(void) {
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Flash memory")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Flash memory"));
Dbprintf(" Baudrate................%dMHz", FLASHMEM_SPIBAUDRATE / 1000000); Dbprintf(" Baudrate................%dMHz", FLASHMEM_SPIBAUDRATE / 1000000);
if (!FlashInit()) { if (!FlashInit()) {

View file

@ -483,7 +483,7 @@ void SetAdcMuxFor(uint32_t whichGpio) {
} }
void Fpga_print_status(void) { void Fpga_print_status(void) {
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Currently loaded FPGA image")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("Currently loaded FPGA image"));
Dbprintf(" mode....................%s", fpga_version_information[downloaded_bitstream - 1]); Dbprintf(" mode....................%s", fpga_version_information[downloaded_bitstream - 1]);
} }

View file

@ -55,7 +55,7 @@ Default LF T55xx config is set to:
t55xx_config t_config = { 29 * 8, 17 * 8, 15 * 8, 47 * 8, 15 * 8 } ; t55xx_config t_config = { 29 * 8, 17 * 8, 15 * 8, 47 * 8, 15 * 8 } ;
void printT55xxConfig(void) { void printT55xxConfig(void) {
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("LF T55XX config")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("LF T55XX config"));
Dbprintf(" [a] startgap............%d*8 (%d)", t_config.start_gap / 8, t_config.start_gap); Dbprintf(" [a] startgap............%d*8 (%d)", t_config.start_gap / 8, t_config.start_gap);
Dbprintf(" [b] writegap............%d*8 (%d)", t_config.write_gap / 8, t_config.write_gap); Dbprintf(" [b] writegap............%d*8 (%d)", t_config.write_gap / 8, t_config.write_gap);
Dbprintf(" [c] write_0.............%d*8 (%d)", t_config.write_0 / 8, t_config.write_0); Dbprintf(" [c] write_0.............%d*8 (%d)", t_config.write_0 / 8, t_config.write_0);

View file

@ -19,7 +19,7 @@ Default LF config is set to:
sample_config config = { 1, 8, 1, 95, 0 } ; sample_config config = { 1, 8, 1, 95, 0 } ;
void printConfig() { void printConfig() {
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("LF Sampling config")); DbpStringEx(FLAG_LOG | FLAG_ANSI, _BLUE_("LF Sampling config"));
Dbprintf(" [q] divisor.............%d (%d KHz)", config.divisor, 12000 / (config.divisor + 1)); Dbprintf(" [q] divisor.............%d (%d KHz)", config.divisor, 12000 / (config.divisor + 1));
Dbprintf(" [b] bps.................%d", config.bits_per_sample); Dbprintf(" [b] bps.................%d", config.bits_per_sample);
Dbprintf(" [d] decimation..........%d", config.decimation); Dbprintf(" [d] decimation..........%d", config.decimation);