diff --git a/application.c b/application.c index 05f1c5b..89008c9 100644 --- a/application.c +++ b/application.c @@ -185,6 +185,19 @@ static void print_target(void) putc('\n'); } +/** print decoded IDCODE + * @param[in] idcode IDCODE to decode + */ +static void print_idcode(uint32_t idcode) +{ + printf("designer: %03x/%s, part number: 0x%04x/%s, revision %u", + (idcode >> 1) & 0x3ff, + swd_jep106_manufacturer((idcode >> 8) & 0x0f, (idcode >> 1) & 0x7f), + (idcode >> 12) & 0xffff, + swd_dpidr_partno((idcode >> 1) & 0x3ff, (idcode >> 12) & 0xffff), + (idcode >> 28) & 0x0f); +} + /** select channel of multiplexer * @param[in] channel channel to select, or -1 to disable multiplexer */ @@ -278,7 +291,9 @@ static void command_swd_scan(void* argument) swd_turnaround(1); // switch from reading to writing printf("0x%08x ", data); if (data & 0x1) { - printf("(designer: %03x/%s, version: %u, part number: 0x%02x/%s, revision %u)\n", (data >> 1) & 0x3ff, swd_jep106_manufacturer((data >> 8) & 0x0f, (data >> 1) & 0x7f), (data >> 12) & 0x0f, (data >> 20) & 0xff, swd_dpidr_partno((data >> 1) & 0x3ff, (data >> 20) & 0xff), (data >> 28) & 0x0f); + puts("("); + print_idcode(data); // decode DPIDR + puts(")\n"); } else { printf("(invalid: RAO != 1)\n"); }