Skip to content

Commit 8a50464

Browse files
committed
jtag: align switch and case statements
The coding style requires the 'case' to be at the same indentation level of its 'switch' statement. Align the code accordingly. No changes are reported by git log -p -w --ignore-blank-lines --patience Change-Id: Iaf368b0bdd7c797b0e4cfb91e838696d706fdcce Signed-off-by: Antonio Borneo <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/9053 Tested-by: jenkins Reviewed-by: zapb <[email protected]>
1 parent 9bc4873 commit 8a50464

File tree

4 files changed

+223
-223
lines changed

4 files changed

+223
-223
lines changed

src/jtag/adapter.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,15 @@ int adapter_config_rclk(unsigned int fallback_speed_khz)
271271
int adapter_get_speed(int *speed)
272272
{
273273
switch (adapter_config.clock_mode) {
274-
case CLOCK_MODE_KHZ:
275-
adapter_khz_to_speed(adapter_get_speed_khz(), speed);
276-
break;
277-
case CLOCK_MODE_RCLK:
278-
adapter_rclk_to_speed(adapter_config.rclk_fallback_speed_khz, speed);
279-
break;
280-
default:
281-
LOG_ERROR("BUG: unknown adapter clock mode");
282-
return ERROR_FAIL;
274+
case CLOCK_MODE_KHZ:
275+
adapter_khz_to_speed(adapter_get_speed_khz(), speed);
276+
break;
277+
case CLOCK_MODE_RCLK:
278+
adapter_rclk_to_speed(adapter_config.rclk_fallback_speed_khz, speed);
279+
break;
280+
default:
281+
LOG_ERROR("BUG: unknown adapter clock mode");
282+
return ERROR_FAIL;
283283
}
284284
return ERROR_OK;
285285
}
@@ -615,34 +615,34 @@ COMMAND_HANDLER(handle_reset_config_command)
615615

616616
/* minimal JTAG has neither SRST nor TRST (so that's the default) */
617617
switch (new_cfg & (RESET_HAS_TRST | RESET_HAS_SRST)) {
618-
case RESET_HAS_SRST:
619-
modes[0] = "srst_only";
620-
break;
621-
case RESET_HAS_TRST:
622-
modes[0] = "trst_only";
623-
break;
624-
case RESET_TRST_AND_SRST:
625-
modes[0] = "trst_and_srst";
626-
break;
627-
default:
628-
modes[0] = "none";
629-
break;
618+
case RESET_HAS_SRST:
619+
modes[0] = "srst_only";
620+
break;
621+
case RESET_HAS_TRST:
622+
modes[0] = "trst_only";
623+
break;
624+
case RESET_TRST_AND_SRST:
625+
modes[0] = "trst_and_srst";
626+
break;
627+
default:
628+
modes[0] = "none";
629+
break;
630630
}
631631

632632
/* normally SRST and TRST are decoupled; but bugs happen ... */
633633
switch (new_cfg & (RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST)) {
634-
case RESET_SRST_PULLS_TRST:
635-
modes[1] = "srst_pulls_trst";
636-
break;
637-
case RESET_TRST_PULLS_SRST:
638-
modes[1] = "trst_pulls_srst";
639-
break;
640-
case RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST:
641-
modes[1] = "combined";
642-
break;
643-
default:
644-
modes[1] = "separate";
645-
break;
634+
case RESET_SRST_PULLS_TRST:
635+
modes[1] = "srst_pulls_trst";
636+
break;
637+
case RESET_TRST_PULLS_SRST:
638+
modes[1] = "trst_pulls_srst";
639+
break;
640+
case RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST:
641+
modes[1] = "combined";
642+
break;
643+
default:
644+
modes[1] = "separate";
645+
break;
646646
}
647647

648648
/* TRST-less connectors include Altera, Xilinx, and minimal JTAG */

src/jtag/core.c

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -969,58 +969,58 @@ int default_interface_jtag_execute_queue(void)
969969

970970
while (debug_level >= LOG_LVL_DEBUG_IO && cmd) {
971971
switch (cmd->type) {
972-
case JTAG_SCAN:
973-
LOG_DEBUG_IO("JTAG %s SCAN to %s",
974-
cmd->cmd.scan->ir_scan ? "IR" : "DR",
975-
tap_state_name(cmd->cmd.scan->end_state));
976-
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
977-
struct scan_field *field = cmd->cmd.scan->fields + i;
978-
if (field->out_value) {
979-
char *str = buf_to_hex_str(field->out_value, field->num_bits);
980-
LOG_DEBUG_IO(" %ub out: %s", field->num_bits, str);
981-
free(str);
982-
}
983-
if (field->in_value) {
984-
char *str = buf_to_hex_str(field->in_value, field->num_bits);
985-
LOG_DEBUG_IO(" %ub in: %s", field->num_bits, str);
986-
free(str);
987-
}
972+
case JTAG_SCAN:
973+
LOG_DEBUG_IO("JTAG %s SCAN to %s",
974+
cmd->cmd.scan->ir_scan ? "IR" : "DR",
975+
tap_state_name(cmd->cmd.scan->end_state));
976+
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
977+
struct scan_field *field = cmd->cmd.scan->fields + i;
978+
if (field->out_value) {
979+
char *str = buf_to_hex_str(field->out_value, field->num_bits);
980+
LOG_DEBUG_IO(" %ub out: %s", field->num_bits, str);
981+
free(str);
988982
}
989-
break;
990-
case JTAG_TLR_RESET:
991-
LOG_DEBUG_IO("JTAG TLR RESET to %s",
992-
tap_state_name(cmd->cmd.statemove->end_state));
993-
break;
994-
case JTAG_RUNTEST:
995-
LOG_DEBUG_IO("JTAG RUNTEST %d cycles to %s",
996-
cmd->cmd.runtest->num_cycles,
997-
tap_state_name(cmd->cmd.runtest->end_state));
998-
break;
999-
case JTAG_RESET:
1000-
{
1001-
const char *reset_str[3] = {
1002-
"leave", "deassert", "assert"
1003-
};
1004-
LOG_DEBUG_IO("JTAG RESET %s TRST, %s SRST",
1005-
reset_str[cmd->cmd.reset->trst + 1],
1006-
reset_str[cmd->cmd.reset->srst + 1]);
983+
if (field->in_value) {
984+
char *str = buf_to_hex_str(field->in_value, field->num_bits);
985+
LOG_DEBUG_IO(" %ub in: %s", field->num_bits, str);
986+
free(str);
1007987
}
1008-
break;
1009-
case JTAG_PATHMOVE:
1010-
LOG_DEBUG_IO("JTAG PATHMOVE (TODO)");
1011-
break;
1012-
case JTAG_SLEEP:
1013-
LOG_DEBUG_IO("JTAG SLEEP (TODO)");
1014-
break;
1015-
case JTAG_STABLECLOCKS:
1016-
LOG_DEBUG_IO("JTAG STABLECLOCKS (TODO)");
1017-
break;
1018-
case JTAG_TMS:
1019-
LOG_DEBUG_IO("JTAG TMS (TODO)");
1020-
break;
1021-
default:
1022-
LOG_ERROR("Unknown JTAG command: %d", cmd->type);
1023-
break;
988+
}
989+
break;
990+
case JTAG_TLR_RESET:
991+
LOG_DEBUG_IO("JTAG TLR RESET to %s",
992+
tap_state_name(cmd->cmd.statemove->end_state));
993+
break;
994+
case JTAG_RUNTEST:
995+
LOG_DEBUG_IO("JTAG RUNTEST %d cycles to %s",
996+
cmd->cmd.runtest->num_cycles,
997+
tap_state_name(cmd->cmd.runtest->end_state));
998+
break;
999+
case JTAG_RESET:
1000+
{
1001+
const char *reset_str[3] = {
1002+
"leave", "deassert", "assert"
1003+
};
1004+
LOG_DEBUG_IO("JTAG RESET %s TRST, %s SRST",
1005+
reset_str[cmd->cmd.reset->trst + 1],
1006+
reset_str[cmd->cmd.reset->srst + 1]);
1007+
}
1008+
break;
1009+
case JTAG_PATHMOVE:
1010+
LOG_DEBUG_IO("JTAG PATHMOVE (TODO)");
1011+
break;
1012+
case JTAG_SLEEP:
1013+
LOG_DEBUG_IO("JTAG SLEEP (TODO)");
1014+
break;
1015+
case JTAG_STABLECLOCKS:
1016+
LOG_DEBUG_IO("JTAG STABLECLOCKS (TODO)");
1017+
break;
1018+
case JTAG_TMS:
1019+
LOG_DEBUG_IO("JTAG TMS (TODO)");
1020+
break;
1021+
default:
1022+
LOG_ERROR("Unknown JTAG command: %d", cmd->type);
1023+
break;
10241024
}
10251025
cmd = cmd->next;
10261026
}
@@ -1551,22 +1551,22 @@ int jtag_init_inner(struct command_context *cmd_ctx)
15511551
*/
15521552
retval = jtag_examine_chain();
15531553
switch (retval) {
1554-
case ERROR_OK:
1555-
/* complete success */
1556-
break;
1557-
default:
1558-
/* For backward compatibility reasons, try coping with
1559-
* configuration errors involving only ID mismatches.
1560-
* We might be able to talk to the devices.
1561-
*
1562-
* Also the device might be powered down during startup.
1563-
*
1564-
* After OpenOCD starts, we can try to power on the device
1565-
* and run a reset.
1566-
*/
1567-
LOG_ERROR("Trying to use configured scan chain anyway...");
1568-
issue_setup = false;
1569-
break;
1554+
case ERROR_OK:
1555+
/* complete success */
1556+
break;
1557+
default:
1558+
/* For backward compatibility reasons, try coping with
1559+
* configuration errors involving only ID mismatches.
1560+
* We might be able to talk to the devices.
1561+
*
1562+
* Also the device might be powered down during startup.
1563+
*
1564+
* After OpenOCD starts, we can try to power on the device
1565+
* and run a reset.
1566+
*/
1567+
LOG_ERROR("Trying to use configured scan chain anyway...");
1568+
issue_setup = false;
1569+
break;
15701570
}
15711571

15721572
/* Now look at IR values. Problems here will prevent real

0 commit comments

Comments
 (0)