diff options
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/cortex_m3.c | 17 | ||||
-rw-r--r-- | src/target/target.c | 19 |
2 files changed, 10 insertions, 26 deletions
diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 42f8ee08..e7b51107 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1898,18 +1898,11 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) if (CMD_ARGC > 0) { - if (!strcmp(CMD_ARGV[0], "on")) - { - cortex_m3_write_debug_halt_mask(target, C_HALT | C_MASKINTS, 0); - } - else if (!strcmp(CMD_ARGV[0], "off")) - { - cortex_m3_write_debug_halt_mask(target, C_HALT, C_MASKINTS); - } - else - { - command_print(CMD_CTX, "usage: cortex_m3 maskisr ['on'|'off']"); - } + bool enable; + COMMAND_PARSE_ON_OFF(CMD_ARGV[0], enable); + uint32_t mask_on = C_HALT | (enable ? C_MASKINTS : 0); + uint32_t mask_off = enable ? 0 : C_MASKINTS; + cortex_m3_write_debug_halt_mask(target, mask_on, mask_off); } command_print(CMD_CTX, "cortex_m3 interrupt mask %s", diff --git a/src/target/target.c b/src/target/target.c index 98e7a403..f203913c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2003,23 +2003,14 @@ COMMAND_HANDLER(handle_poll_command) return retval; if ((retval = target_arch_state(target)) != ERROR_OK) return retval; - } else if (CMD_ARGC == 1) { - if (strcmp(CMD_ARGV[0], "on") == 0) - { - jtag_poll_set_enabled(true); - } - else if (strcmp(CMD_ARGV[0], "off") == 0) - { - jtag_poll_set_enabled(false); - } - else - { - command_print(CMD_CTX, "arg is \"on\" or \"off\""); - } - } else + bool enable; + COMMAND_PARSE_ON_OFF(CMD_ARGV[0], enable); + jtag_poll_set_enabled(enable); + } + else { return ERROR_COMMAND_SYNTAX_ERROR; } |