mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
textual - hw status on device side
This commit is contained in:
parent
1ff1fa7385
commit
a6712295c7
6 changed files with 80 additions and 69 deletions
|
@ -163,15 +163,31 @@ void BigBuf_free_keep_EM(void) {
|
|||
|
||||
void BigBuf_print_status(void) {
|
||||
DbpString(_CYAN_("Memory"));
|
||||
Dbprintf(" BigBuf_size.............%d", s_bigbuf_size);
|
||||
Dbprintf(" Available memory........%d", s_bigbuf_hi);
|
||||
Dbprintf(" BigBuf_size............. %d", s_bigbuf_size);
|
||||
Dbprintf(" Available memory........ %d", s_bigbuf_hi);
|
||||
DbpString(_CYAN_("Tracing"));
|
||||
Dbprintf(" tracing ................%d", tracing);
|
||||
Dbprintf(" traceLen ...............%d", trace_len);
|
||||
Dbprintf(" tracing ................ %d", tracing);
|
||||
Dbprintf(" traceLen ............... %d", trace_len);
|
||||
|
||||
Dbprintf(" dma8 memory.............%d", dma_8.buf - BigBuf_get_addr());
|
||||
Dbprintf(" dma16 memory............%d", (uint8_t *)dma_16.buf - BigBuf_get_addr());
|
||||
Dbprintf(" toSend memory...........%d", toSend.buf - BigBuf_get_addr());
|
||||
if (DBGLEVEL >= DBG_DEBUG) {
|
||||
DbpString(_CYAN_("Sending buffers"));
|
||||
|
||||
uint16_t d8 = 0;
|
||||
if (dma_8.buf)
|
||||
d8 = dma_8.buf - BigBuf_get_addr();
|
||||
|
||||
uint16_t d16 = 0;
|
||||
if (dma_16.buf)
|
||||
d16 = (uint8_t *)dma_16.buf - BigBuf_get_addr();
|
||||
|
||||
uint16_t ts = 0;
|
||||
if (toSend.buf)
|
||||
ts = toSend.buf - BigBuf_get_addr();
|
||||
|
||||
Dbprintf(" dma8 memory............. %u", d8);
|
||||
Dbprintf(" dma16 memory............ %u", d16);
|
||||
Dbprintf(" toSend memory........... %u", ts);
|
||||
}
|
||||
}
|
||||
|
||||
// return the maximum trace length (i.e. the unallocated size of BigBuf)
|
||||
|
|
|
@ -243,7 +243,7 @@ void print_stack_usage(void) {
|
|||
// pointer arithmetic is times 4. (two shifts to the left)
|
||||
for (uint32_t *p = &_stack_start; ; ++p) {
|
||||
if (*p != 0xdeadbeef) {
|
||||
Dbprintf(" Max stack usage.........%d / %d bytes", (&_stack_end - p) << 2, (&_stack_end - &_stack_start) << 2);
|
||||
Dbprintf(" Max stack usage......... %d / %d bytes", (&_stack_end - p) << 2, (&_stack_end - &_stack_start) << 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -337,22 +337,22 @@ static void print_debug_level(void) {
|
|||
char dbglvlstr[20] = {0};
|
||||
switch (DBGLEVEL) {
|
||||
case DBG_NONE:
|
||||
sprintf(dbglvlstr, "NONE");
|
||||
sprintf(dbglvlstr, "none");
|
||||
break;
|
||||
case DBG_ERROR:
|
||||
sprintf(dbglvlstr, "ERROR");
|
||||
sprintf(dbglvlstr, "error");
|
||||
break;
|
||||
case DBG_INFO:
|
||||
sprintf(dbglvlstr, "INFO");
|
||||
sprintf(dbglvlstr, "info");
|
||||
break;
|
||||
case DBG_DEBUG:
|
||||
sprintf(dbglvlstr, "DEBUG");
|
||||
sprintf(dbglvlstr, "debug");
|
||||
break;
|
||||
case DBG_EXTENDED:
|
||||
sprintf(dbglvlstr, "EXTENDED");
|
||||
sprintf(dbglvlstr, "extended");
|
||||
break;
|
||||
}
|
||||
Dbprintf(" DBGLEVEL................%d ( " _YELLOW_("%s")" )", DBGLEVEL, dbglvlstr);
|
||||
Dbprintf(" Debug log level......... %d ( " _YELLOW_("%s")" )", DBGLEVEL, dbglvlstr);
|
||||
}
|
||||
|
||||
// measure the Connection Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
|
||||
|
@ -376,9 +376,9 @@ static void printConnSpeed(void) {
|
|||
}
|
||||
LED_B_OFF();
|
||||
|
||||
Dbprintf(" Time elapsed............%dms", delta_time);
|
||||
Dbprintf(" Bytes transferred.......%d", bytes_transferred);
|
||||
Dbprintf(" Transfer Speed PM3 -> Client = " _YELLOW_("%d") " bytes/s", 1000 * bytes_transferred / delta_time);
|
||||
Dbprintf(" Time elapsed................... %dms", delta_time);
|
||||
Dbprintf(" Bytes transferred.............. %d", bytes_transferred);
|
||||
Dbprintf(" Transfer Speed PM3 -> Client... " _YELLOW_("%d") " bytes/s", 1000 * bytes_transferred / delta_time);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -407,11 +407,11 @@ static void SendStatus(void) {
|
|||
print_debug_level();
|
||||
|
||||
tosend_t *ts = get_tosend();
|
||||
Dbprintf(" ToSendMax...............%d", ts->max);
|
||||
Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE);
|
||||
Dbprintf(" ToSendMax............... %d", ts->max);
|
||||
Dbprintf(" ToSend BUFFERSIZE....... %d", TOSEND_BUFFER_SIZE);
|
||||
while ((AT91C_BASE_PMC->PMC_MCFR & AT91C_CKGR_MAINRDY) == 0); // Wait for MAINF value to become available...
|
||||
uint16_t mainf = AT91C_BASE_PMC->PMC_MCFR & AT91C_CKGR_MAINF; // Get # main clocks within 16 slow clocks
|
||||
Dbprintf(" Slow clock..............%d Hz", (16 * MAINCK) / mainf);
|
||||
Dbprintf(" Slow clock.............. %d Hz", (16 * MAINCK) / mainf);
|
||||
uint32_t delta_time = 0;
|
||||
uint32_t start_time = GetTickCount();
|
||||
#define SLCK_CHECK_MS 50
|
||||
|
@ -429,7 +429,7 @@ static void SendStatus(void) {
|
|||
#ifdef WITH_FLASH
|
||||
Flashmem_print_info();
|
||||
#endif
|
||||
|
||||
DbpString("");
|
||||
reply_ng(CMD_STATUS, PM3_SUCCESS, NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -1573,11 +1573,6 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
MifareGen3Freez();
|
||||
break;
|
||||
}
|
||||
// mifare sniffer
|
||||
// case CMD_HF_MIFARE_SNIFF: {
|
||||
// SniffMifare(packet->oldarg[0]);
|
||||
// break;
|
||||
// }
|
||||
case CMD_HF_MIFARE_PERSONALIZE_UID: {
|
||||
struct p {
|
||||
uint8_t keytype;
|
||||
|
@ -2294,7 +2289,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
// arg1 = length bytes to transfer
|
||||
// arg2 = RFU
|
||||
|
||||
if (!FlashInit()) {
|
||||
if (FlashInit() == false) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2302,7 +2297,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
size_t len = MIN((numofbytes - i), PM3_CMD_DATA_SIZE);
|
||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||
bool isok = Flash_ReadDataCont(startidx + i, mem, len);
|
||||
if (!isok)
|
||||
if (isok == false)
|
||||
Dbprintf("reading flash memory failed :: | bytes between %d - %d", i, len);
|
||||
|
||||
isok = reply_old(CMD_FLASHMEM_DOWNLOADED, i, len, 0, mem, len);
|
||||
|
|
|
@ -524,33 +524,33 @@ void Flash_EraseChip(void) {
|
|||
|
||||
void Flashmem_print_status(void) {
|
||||
DbpString(_CYAN_("Flash memory"));
|
||||
Dbprintf(" Baudrate................" _GREEN_("%d MHz"), FLASHMEM_SPIBAUDRATE / 1000000);
|
||||
Dbprintf(" Baudrate................ " _GREEN_("%d MHz"), FLASHMEM_SPIBAUDRATE / 1000000);
|
||||
|
||||
if (!FlashInit()) {
|
||||
DbpString(" Init...................." _RED_("FAILED"));
|
||||
DbpString(" Init.................... " _RED_("FAILED"));
|
||||
return;
|
||||
}
|
||||
DbpString(" Init...................." _GREEN_("OK"));
|
||||
DbpString(" Init.................... " _GREEN_("OK"));
|
||||
|
||||
uint8_t dev_id = Flash_ReadID();
|
||||
switch (dev_id) {
|
||||
case 0x11 :
|
||||
DbpString(" Memory size............." _YELLOW_("2 mbits / 256 kb"));
|
||||
DbpString(" Memory size............. " _YELLOW_("2 mbits / 256 kb"));
|
||||
break;
|
||||
case 0x10 :
|
||||
DbpString(" Memory size..... ......." _YELLOW_("1 mbits / 128 kb"));
|
||||
DbpString(" Memory size..... ....... " _YELLOW_("1 mbits / 128 kb"));
|
||||
break;
|
||||
case 0x05 :
|
||||
DbpString(" Memory size............." _YELLOW_("512 kbits / 64 kb"));
|
||||
DbpString(" Memory size............. " _YELLOW_("512 kbits / 64 kb"));
|
||||
break;
|
||||
default :
|
||||
DbpString(" Device ID..............." _YELLOW_(" --> Unknown <--"));
|
||||
DbpString(" Device ID............... " _YELLOW_(" --> Unknown <--"));
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t uid[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Flash_UniqueID(uid);
|
||||
Dbprintf(" Unique ID...............0x%02X%02X%02X%02X%02X%02X%02X%02X",
|
||||
Dbprintf(" Unique ID............... 0x%02X%02X%02X%02X%02X%02X%02X%02X",
|
||||
uid[7], uid[6], uid[5], uid[4],
|
||||
uid[3], uid[2], uid[1], uid[0]
|
||||
);
|
||||
|
@ -573,7 +573,7 @@ void Flashmem_print_info(void) {
|
|||
if (isok == 2) {
|
||||
num = ((keysum[1] << 8) | keysum[0]);
|
||||
if (num != 0xFFFF && num != 0x0)
|
||||
Dbprintf(" Mifare.................."_YELLOW_("%d")" keys", num);
|
||||
Dbprintf(" Mifare.................. "_YELLOW_("%d")" keys", num);
|
||||
}
|
||||
|
||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||
|
@ -581,7 +581,7 @@ void Flashmem_print_info(void) {
|
|||
if (isok == 2) {
|
||||
num = ((keysum[1] << 8) | keysum[0]);
|
||||
if (num != 0xFFFF && num != 0x0)
|
||||
Dbprintf(" T55x7..................."_YELLOW_("%d")" keys", num);
|
||||
Dbprintf(" T55x7................... "_YELLOW_("%d")" keys", num);
|
||||
}
|
||||
|
||||
Flash_CheckBusy(BUSY_TIMEOUT);
|
||||
|
@ -589,7 +589,7 @@ void Flashmem_print_info(void) {
|
|||
if (isok == 2) {
|
||||
num = ((keysum[1] << 8) | keysum[0]);
|
||||
if (num != 0xFFFF && num != 0x0)
|
||||
Dbprintf(" iClass.................."_YELLOW_("%d")" keys", num);
|
||||
Dbprintf(" iClass.................. "_YELLOW_("%d")" keys", num);
|
||||
}
|
||||
|
||||
FlashStop();
|
||||
|
|
|
@ -606,9 +606,9 @@ void I2C_print_status(void) {
|
|||
DbpString(_CYAN_("Smart card module (ISO 7816)"));
|
||||
uint8_t maj, min;
|
||||
if (I2C_get_version(&maj, &min) == PM3_SUCCESS)
|
||||
Dbprintf(" version................." _YELLOW_("v%x.%02d"), maj, min);
|
||||
Dbprintf(" version................. " _YELLOW_("v%x.%02d"), maj, min);
|
||||
else
|
||||
DbpString(" version................." _RED_("FAILED"));
|
||||
DbpString(" version................. " _RED_("FAILED"));
|
||||
}
|
||||
|
||||
int I2C_get_version(uint8_t *maj, uint8_t *min) {
|
||||
|
|
|
@ -135,30 +135,30 @@ static hf14a_config hf14aconfig = { 0, 0, 0, 0, 0 } ;
|
|||
|
||||
void printHf14aConfig(void) {
|
||||
DbpString(_CYAN_("HF 14a config"));
|
||||
Dbprintf(" [a] Anticol override....%s%s%s",
|
||||
(hf14aconfig.forceanticol == 0) ? _GREEN_("std") " : follow standard " : "",
|
||||
(hf14aconfig.forceanticol == 1) ? _RED_("force") " : always do anticol" : "",
|
||||
(hf14aconfig.forceanticol == 2) ? _RED_("skip") " : always skip anticol" : ""
|
||||
Dbprintf(" [a] Anticol override.... %s%s%s",
|
||||
(hf14aconfig.forceanticol == 0) ? _GREEN_("std") " ( follow standard )" : "",
|
||||
(hf14aconfig.forceanticol == 1) ? _RED_("force") " ( always do anticol )" : "",
|
||||
(hf14aconfig.forceanticol == 2) ? _RED_("skip") " ( always skip anticol )" : ""
|
||||
);
|
||||
Dbprintf(" [b] BCC override........%s%s%s",
|
||||
(hf14aconfig.forcebcc == 0) ? _GREEN_("std") " : follow standard" : "",
|
||||
(hf14aconfig.forcebcc == 1) ? _RED_("fix") " : fix bad BCC" : "",
|
||||
(hf14aconfig.forcebcc == 2) ? _RED_("ignore") " : ignore bad BCC, always use card BCC" : ""
|
||||
Dbprintf(" [b] BCC override........ %s%s%s",
|
||||
(hf14aconfig.forcebcc == 0) ? _GREEN_("std") " ( follow standard )" : "",
|
||||
(hf14aconfig.forcebcc == 1) ? _RED_("fix") " ( fix bad BCC )" : "",
|
||||
(hf14aconfig.forcebcc == 2) ? _RED_("ignore") " ( ignore bad BCC, always use card BCC )" : ""
|
||||
);
|
||||
Dbprintf(" [2] CL2 override........%s%s%s",
|
||||
(hf14aconfig.forcecl2 == 0) ? _GREEN_("std") " : follow standard" : "",
|
||||
(hf14aconfig.forcecl2 == 1) ? _RED_("force") " : always do CL2" : "",
|
||||
(hf14aconfig.forcecl2 == 2) ? _RED_("skip") " : always skip CL2" : ""
|
||||
Dbprintf(" [2] CL2 override........ %s%s%s",
|
||||
(hf14aconfig.forcecl2 == 0) ? _GREEN_("std") " ( follow standard )" : "",
|
||||
(hf14aconfig.forcecl2 == 1) ? _RED_("force") " ( always do CL2 )" : "",
|
||||
(hf14aconfig.forcecl2 == 2) ? _RED_("skip") " ( always skip CL2 )" : ""
|
||||
);
|
||||
Dbprintf(" [3] CL3 override........%s%s%s",
|
||||
(hf14aconfig.forcecl3 == 0) ? _GREEN_("std") " : follow standard" : "",
|
||||
(hf14aconfig.forcecl3 == 1) ? _RED_("force") " : always do CL3" : "",
|
||||
(hf14aconfig.forcecl3 == 2) ? _RED_("skip") " : always skip CL3" : ""
|
||||
Dbprintf(" [3] CL3 override........ %s%s%s",
|
||||
(hf14aconfig.forcecl3 == 0) ? _GREEN_("std") " ( follow standard )" : "",
|
||||
(hf14aconfig.forcecl3 == 1) ? _RED_("force") " ( always do CL3 )" : "",
|
||||
(hf14aconfig.forcecl3 == 2) ? _RED_("skip") " ( always skip CL3 )" : ""
|
||||
);
|
||||
Dbprintf(" [r] RATS override.......%s%s%s",
|
||||
(hf14aconfig.forcerats == 0) ? _GREEN_("std") " : follow standard " : "",
|
||||
(hf14aconfig.forcerats == 1) ? _RED_("force") " : always do RATS" : "",
|
||||
(hf14aconfig.forcerats == 2) ? _RED_("skip") " : always skip RATS" : ""
|
||||
Dbprintf(" [r] RATS override....... %s%s%s",
|
||||
(hf14aconfig.forcerats == 0) ? _GREEN_("std") " ( follow standard )" : "",
|
||||
(hf14aconfig.forcerats == 1) ? _RED_("force") " ( always do RATS )" : "",
|
||||
(hf14aconfig.forcerats == 2) ? _RED_("skip") " () always skip RATS )" : ""
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,12 @@ static sampling_t samples = {0, 0, 0, 0};
|
|||
void printLFConfig(void) {
|
||||
uint32_t d = config.divisor;
|
||||
DbpString(_CYAN_("LF Sampling config"));
|
||||
Dbprintf(" [q] divisor.............%d ( "_GREEN_("%d.%02d kHz")" )", d, 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100));
|
||||
Dbprintf(" [b] bits per sample.....%d", config.bits_per_sample);
|
||||
Dbprintf(" [d] decimation..........%d", config.decimation);
|
||||
Dbprintf(" [a] averaging...........%s", (config.averaging) ? "Yes" : "No");
|
||||
Dbprintf(" [t] trigger threshold...%d", config.trigger_threshold);
|
||||
Dbprintf(" [s] samples to skip.....%d ", config.samples_to_skip);
|
||||
Dbprintf(" [q] divisor............. %d ( "_GREEN_("%d.%02d kHz")" )", d, 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100));
|
||||
Dbprintf(" [b] bits per sample..... %d", config.bits_per_sample);
|
||||
Dbprintf(" [d] decimation.......... %d", config.decimation);
|
||||
Dbprintf(" [a] averaging........... %s", (config.averaging) ? "yes" : "no");
|
||||
Dbprintf(" [t] trigger threshold... %d", config.trigger_threshold);
|
||||
Dbprintf(" [s] samples to skip..... %d ", config.samples_to_skip);
|
||||
|
||||
DbpString(_CYAN_("LF Sampling Stack"));
|
||||
print_stack_usage();
|
||||
|
@ -54,8 +54,8 @@ void printSamples(void) {
|
|||
DbpString(_CYAN_("LF Sampling memory usage"));
|
||||
// Dbprintf(" decimation counter...%d", samples.dec_counter);
|
||||
// Dbprintf(" sum..................%u", samples.sum);
|
||||
Dbprintf(" counter.............." _YELLOW_("%u"), samples.counter);
|
||||
Dbprintf(" total saved.........." _YELLOW_("%u"), samples.total_saved);
|
||||
Dbprintf(" counter.............. " _YELLOW_("%u"), samples.counter);
|
||||
Dbprintf(" total saved.......... " _YELLOW_("%u"), samples.total_saved);
|
||||
print_stack_usage();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue