summaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/parport.c7
-rw-r--r--src/jtag/zy1000/zy1000.c15
2 files changed, 5 insertions, 17 deletions
diff --git a/src/jtag/parport.c b/src/jtag/parport.c
index 97f6458d..b80626f5 100644
--- a/src/jtag/parport.c
+++ b/src/jtag/parport.c
@@ -103,7 +103,7 @@ static struct cable cables[] =
/* configuration */
static char* parport_cable = NULL;
static uint16_t parport_port;
-static int parport_exit = 0;
+static bool parport_exit = 0;
static uint32_t parport_toggling_time_ns = 1000;
static int wait_states;
@@ -453,10 +453,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command)
return ERROR_OK;
}
- if (strcmp(CMD_ARGV[0], "on") == 0)
- parport_exit = 1;
- else if (strcmp(CMD_ARGV[0], "off") == 0)
- parport_exit = 0;
+ COMMAND_PARSE_ON_OFF(CMD_ARGV[0], parport_exit);
return ERROR_OK;
}
diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c
index a509aee5..206b362c 100644
--- a/src/jtag/zy1000/zy1000.c
+++ b/src/jtag/zy1000/zy1000.c
@@ -236,18 +236,9 @@ int handle_power_command(struct command_context *cmd_ctx, char *cmd, char **args
if (argc == 1)
{
- if (strcmp(args[0], "on") == 0)
- {
- setPower(1);
- }
- else if (strcmp(args[0], "off") == 0)
- {
- setPower(0);
- } else
- {
- command_print(cmd_ctx, "arg is \"on\" or \"off\"");
- return ERROR_INVALID_ARGUMENTS;
- }
+ bool enable;
+ COMMAND_PARSE_ON_OFF(args[0], enable);
+ setPower(enable);
}
command_print(cmd_ctx, "Target power %s", savePower ? "on" : "off");