helper/command: change prototype of command_print/command_print_sameline

To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.

Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
	sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
	's/\(command_print(cmd\)->ctx,/\1,/'
	's/\(command_print(CMD\)_CTX,/\1,/'
	's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
	's/\(command_print_sameline(cmd\)->ctx,/\1,/'
	's/\(command_print_sameline(CMD\)_CTX,/\1,/'
	's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'

This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.

Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Antonio Borneo
2019-04-03 10:37:24 +02:00
committed by Tomas Vanek
parent 6916550938
commit 6cb5ba6f11
105 changed files with 963 additions and 963 deletions

View File

@@ -1199,7 +1199,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 +1207,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 +1233,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" : "<unknown>");
}
@@ -1260,8 +1260,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 +1270,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 +1280,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 +1288,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 +1435,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 +1456,27 @@ 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");
command_print(cmd, "\tType is MEM-AP AHB");
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 +1485,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 +1681,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 +1703,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 +1716,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,7 +1740,7 @@ 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:
@@ -1801,7 +1801,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 +1853,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 +1884,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 +1906,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;