X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Farm_adi_v5.c;h=d2ec960a82076f2ab7b3eba7c9b78b578a89da11;hb=refs%2Fchanges%2F31%2F5231%2F6;hp=f9eb8f4cbb361db453cf254907fe1d13c9c16a3e;hpb=d50e92e7f7e44ef315e5bf005a78f9184db051c4;p=openocd.git diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index f9eb8f4cbb..d2ec960a82 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -914,7 +914,8 @@ int dap_find_ap(struct adiv5_dap *dap, enum ap_type type_to_find, struct adiv5_a ((id_val & IDR_TYPE) == type_to_find)) { /* type matches*/ LOG_DEBUG("Found %s at AP index: %d (IDR=0x%08" PRIX32 ")", - (type_to_find == AP_TYPE_AHB_AP) ? "AHB-AP" : + (type_to_find == AP_TYPE_AHB3_AP) ? "AHB3-AP" : + (type_to_find == AP_TYPE_AHB5_AP) ? "AHB5-AP" : (type_to_find == AP_TYPE_APB_AP) ? "APB-AP" : (type_to_find == AP_TYPE_AXI_AP) ? "AXI-AP" : (type_to_find == AP_TYPE_JTAG_AP) ? "JTAG-AP" : "Unknown", @@ -926,7 +927,8 @@ int dap_find_ap(struct adiv5_dap *dap, enum ap_type type_to_find, struct adiv5_a } LOG_DEBUG("No %s found", - (type_to_find == AP_TYPE_AHB_AP) ? "AHB-AP" : + (type_to_find == AP_TYPE_AHB3_AP) ? "AHB3-AP" : + (type_to_find == AP_TYPE_AHB5_AP) ? "AHB5-AP" : (type_to_find == AP_TYPE_APB_AP) ? "APB-AP" : (type_to_find == AP_TYPE_AXI_AP) ? "AXI-AP" : (type_to_find == AP_TYPE_JTAG_AP) ? "JTAG-AP" : "Unknown"); @@ -1199,7 +1201,7 @@ static int dap_rom_display(struct command_invocation *cmd, char tabs[16] = ""; if (depth > 16) { - command_print(cmd->ctx, "\tTables too deep"); + command_print(cmd, "\tTables too deep"); return ERROR_FAIL; } @@ -1207,25 +1209,25 @@ static int dap_rom_display(struct command_invocation *cmd, snprintf(tabs, sizeof(tabs), "[L%02d] ", depth); uint32_t base_addr = dbgbase & 0xFFFFF000; - command_print(cmd->ctx, "\t\tComponent base address 0x%08" PRIx32, base_addr); + command_print(cmd, "\t\tComponent base address 0x%08" PRIx32, base_addr); retval = dap_read_part_id(ap, base_addr, &cid, &pid); if (retval != ERROR_OK) { - command_print(cmd->ctx, "\t\tCan't read component, the corresponding core might be turned off"); + command_print(cmd, "\t\tCan't read component, the corresponding core might be turned off"); return ERROR_OK; /* Don't abort recursion */ } if (!is_dap_cid_ok(cid)) { - command_print(cmd->ctx, "\t\tInvalid CID 0x%08" PRIx32, cid); + command_print(cmd, "\t\tInvalid CID 0x%08" PRIx32, cid); return ERROR_OK; /* Don't abort recursion */ } /* component may take multiple 4K pages */ uint32_t size = (pid >> 36) & 0xf; if (size > 0) - command_print(cmd->ctx, "\t\tStart address 0x%08" PRIx32, (uint32_t)(base_addr - 0x1000 * size)); + command_print(cmd, "\t\tStart address 0x%08" PRIx32, (uint32_t)(base_addr - 0x1000 * size)); - command_print(cmd->ctx, "\t\tPeripheral ID 0x%010" PRIx64, pid); + command_print(cmd, "\t\tPeripheral ID 0x%010" PRIx64, pid); uint8_t class = (cid >> 12) & 0xf; uint16_t part_num = pid & 0xfff; @@ -1233,12 +1235,12 @@ static int dap_rom_display(struct command_invocation *cmd, if (designer_id & 0x80) { /* JEP106 code */ - command_print(cmd->ctx, "\t\tDesigner is 0x%03" PRIx16 ", %s", + command_print(cmd, "\t\tDesigner is 0x%03" PRIx16 ", %s", designer_id, jep106_manufacturer(designer_id >> 8, designer_id & 0x7f)); } else { /* Legacy ASCII ID, clear invalid bits */ designer_id &= 0x7f; - command_print(cmd->ctx, "\t\tDesigner ASCII code 0x%02" PRIx16 ", %s", + command_print(cmd, "\t\tDesigner ASCII code 0x%02" PRIx16 ", %s", designer_id, designer_id == 0x41 ? "ARM" : ""); } @@ -1260,8 +1262,8 @@ static int dap_rom_display(struct command_invocation *cmd, break; } - command_print(cmd->ctx, "\t\tPart is 0x%" PRIx16", %s %s", part_num, type, full); - command_print(cmd->ctx, "\t\tComponent class is 0x%" PRIx8 ", %s", class, class_description[class]); + command_print(cmd, "\t\tPart is 0x%" PRIx16", %s %s", part_num, type, full); + command_print(cmd, "\t\tComponent class is 0x%" PRIx8 ", %s", class, class_description[class]); if (class == 1) { /* ROM Table */ uint32_t memtype; @@ -1270,9 +1272,9 @@ static int dap_rom_display(struct command_invocation *cmd, return retval; if (memtype & 0x01) - command_print(cmd->ctx, "\t\tMEMTYPE system memory present on bus"); + command_print(cmd, "\t\tMEMTYPE system memory present on bus"); else - command_print(cmd->ctx, "\t\tMEMTYPE system memory not present: dedicated debug bus"); + command_print(cmd, "\t\tMEMTYPE system memory not present: dedicated debug bus"); /* Read ROM table entries from base address until we get 0x00000000 or reach the reserved area */ for (uint16_t entry_offset = 0; entry_offset < 0xF00; entry_offset += 4) { @@ -1280,7 +1282,7 @@ static int dap_rom_display(struct command_invocation *cmd, retval = mem_ap_read_atomic_u32(ap, base_addr | entry_offset, &romentry); if (retval != ERROR_OK) return retval; - command_print(cmd->ctx, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "", + command_print(cmd, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "", tabs, entry_offset, romentry); if (romentry & 0x01) { /* Recurse */ @@ -1288,9 +1290,9 @@ static int dap_rom_display(struct command_invocation *cmd, if (retval != ERROR_OK) return retval; } else if (romentry != 0) { - command_print(cmd->ctx, "\t\tComponent not present"); + command_print(cmd, "\t\tComponent not present"); } else { - command_print(cmd->ctx, "\t%s\tEnd of ROM table", tabs); + command_print(cmd, "\t%s\tEnd of ROM table", tabs); break; } } @@ -1435,7 +1437,7 @@ static int dap_rom_display(struct command_invocation *cmd, } break; } - command_print(cmd->ctx, "\t\tType is 0x%02" PRIx8 ", %s, %s", + command_print(cmd, "\t\tType is 0x%02" PRIx8 ", %s, %s", (uint8_t)(devtype & 0xff), major, subtype); /* REVISIT also show 0xfc8 DevId */ @@ -1456,27 +1458,30 @@ int dap_info_command(struct command_invocation *cmd, if (retval != ERROR_OK) return retval; - command_print(cmd->ctx, "AP ID register 0x%8.8" PRIx32, apid); + command_print(cmd, "AP ID register 0x%8.8" PRIx32, apid); if (apid == 0) { - command_print(cmd->ctx, "No AP found at this ap 0x%x", ap->ap_num); + command_print(cmd, "No AP found at this ap 0x%x", ap->ap_num); return ERROR_FAIL; } switch (apid & (IDR_JEP106 | IDR_TYPE)) { case IDR_JEP106_ARM | AP_TYPE_JTAG_AP: - command_print(cmd->ctx, "\tType is JTAG-AP"); + command_print(cmd, "\tType is JTAG-AP"); break; - case IDR_JEP106_ARM | AP_TYPE_AHB_AP: - command_print(cmd->ctx, "\tType is MEM-AP AHB"); + case IDR_JEP106_ARM | AP_TYPE_AHB3_AP: + command_print(cmd, "\tType is MEM-AP AHB3"); + break; + case IDR_JEP106_ARM | AP_TYPE_AHB5_AP: + command_print(cmd, "\tType is MEM-AP AHB5"); break; case IDR_JEP106_ARM | AP_TYPE_APB_AP: - command_print(cmd->ctx, "\tType is MEM-AP APB"); + command_print(cmd, "\tType is MEM-AP APB"); break; case IDR_JEP106_ARM | AP_TYPE_AXI_AP: - command_print(cmd->ctx, "\tType is MEM-AP AXI"); + command_print(cmd, "\tType is MEM-AP AXI"); break; default: - command_print(cmd->ctx, "\tUnknown AP type"); + command_print(cmd, "\tUnknown AP type"); break; } @@ -1485,15 +1490,15 @@ int dap_info_command(struct command_invocation *cmd, */ mem_ap = (apid & IDR_CLASS) == AP_CLASS_MEM_AP; if (mem_ap) { - command_print(cmd->ctx, "MEM-AP BASE 0x%8.8" PRIx32, dbgbase); + command_print(cmd, "MEM-AP BASE 0x%8.8" PRIx32, dbgbase); if (dbgbase == 0xFFFFFFFF || (dbgbase & 0x3) == 0x2) { - command_print(cmd->ctx, "\tNo ROM table present"); + command_print(cmd, "\tNo ROM table present"); } else { if (dbgbase & 0x01) - command_print(cmd->ctx, "\tValid ROM table present"); + command_print(cmd, "\tValid ROM table present"); else - command_print(cmd->ctx, "\tROM table in legacy format"); + command_print(cmd, "\tROM table in legacy format"); dap_rom_display(cmd, ap, dbgbase & 0xFFFFF000, 0); } @@ -1681,7 +1686,7 @@ COMMAND_HANDLER(dap_baseaddr_command) if (retval != ERROR_OK) return retval; - command_print(CMD_CTX, "0x%8.8" PRIx32, baseaddr); + command_print(CMD, "0x%8.8" PRIx32, baseaddr); return retval; } @@ -1703,7 +1708,7 @@ COMMAND_HANDLER(dap_memaccess_command) } dap->ap[dap->apsel].memaccess_tck = memaccess_tck; - command_print(CMD_CTX, "memory bus access delay set to %" PRIi32 " tck", + command_print(CMD, "memory bus access delay set to %" PRIi32 " tck", dap->ap[dap->apsel].memaccess_tck); return ERROR_OK; @@ -1716,7 +1721,7 @@ COMMAND_HANDLER(dap_apsel_command) switch (CMD_ARGC) { case 0: - command_print(CMD_CTX, "%" PRIi32, dap->apsel); + command_print(CMD, "%" PRIi32, dap->apsel); return ERROR_OK; case 1: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); @@ -1740,12 +1745,12 @@ COMMAND_HANDLER(dap_apcsw_command) switch (CMD_ARGC) { case 0: - command_print(CMD_CTX, "ap %" PRIi32 " selected, csw 0x%8.8" PRIx32, + command_print(CMD, "ap %" PRIi32 " selected, csw 0x%8.8" PRIx32, dap->apsel, apcsw); return ERROR_OK; case 1: if (strcmp(CMD_ARGV[0], "default") == 0) - csw_val = CSW_DEFAULT; + csw_val = CSW_AHB_DEFAULT; else COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], csw_val); @@ -1801,7 +1806,7 @@ COMMAND_HANDLER(dap_apid_command) if (retval != ERROR_OK) return retval; - command_print(CMD_CTX, "0x%8.8" PRIx32, apid); + command_print(CMD, "0x%8.8" PRIx32, apid); return retval; } @@ -1853,7 +1858,7 @@ COMMAND_HANDLER(dap_apreg_command) return retval; if (CMD_ARGC == 2) - command_print(CMD_CTX, "0x%08" PRIx32, value); + command_print(CMD, "0x%08" PRIx32, value); return retval; } @@ -1884,7 +1889,7 @@ COMMAND_HANDLER(dap_dpreg_command) return retval; if (CMD_ARGC == 1) - command_print(CMD_CTX, "0x%08" PRIx32, value); + command_print(CMD, "0x%08" PRIx32, value); return retval; } @@ -1906,7 +1911,7 @@ COMMAND_HANDLER(dap_ti_be_32_quirks_command) return ERROR_COMMAND_SYNTAX_ERROR; } dap->ti_be_32_quirks = enable; - command_print(CMD_CTX, "TI BE-32 quirks mode %s", + command_print(CMD, "TI BE-32 quirks mode %s", enable ? "enabled" : "disabled"); return 0;