adapter/jlink: Allow to determine the target power state
Change-Id: I0b4f543e0ba0e48c43f78e32e4fa41d7dec9d7b8 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8417 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
parent
fc0ec6cf0b
commit
4cab20b599
|
@ -1069,7 +1069,7 @@ COMMAND_HANDLER(jlink_handle_jlink_jtag_command)
|
|||
|
||||
COMMAND_HANDLER(jlink_handle_target_power_command)
|
||||
{
|
||||
if (CMD_ARGC != 1)
|
||||
if (CMD_ARGC > 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SET_TARGET_POWER)) {
|
||||
|
@ -1078,6 +1078,20 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
if (!CMD_ARGC) {
|
||||
uint32_t state;
|
||||
int ret = jaylink_get_hardware_info(devh, JAYLINK_HW_INFO_TARGET_POWER,
|
||||
&state);
|
||||
|
||||
if (ret != JAYLINK_OK) {
|
||||
command_print(CMD, "Failed to retrieve target power state");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
command_print(CMD, "%d", (bool)state);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
bool enable;
|
||||
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], enable);
|
||||
|
||||
|
@ -1859,7 +1873,7 @@ static const struct command_registration jlink_subcommand_handlers[] = {
|
|||
.handler = &jlink_handle_target_power_command,
|
||||
.mode = COMMAND_EXEC,
|
||||
.help = "set the target power supply",
|
||||
.usage = "<0|1|on|off>"
|
||||
.usage = "[0|1|on|off]"
|
||||
},
|
||||
{
|
||||
.name = "freemem",
|
||||
|
|
Loading…
Reference in New Issue