Updates all command parsing of "on" and "off" arguments.
uint32_t bank_nr;
uint32_t first;
uint32_t last;
uint32_t bank_nr;
uint32_t first;
uint32_t last;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
struct flash_bank *p = get_flash_bank_by_num(bank_nr);
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
struct flash_bank *p = get_flash_bank_by_num(bank_nr);
else
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
else
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
- if (strcmp(CMD_ARGV[3], "on") == 0)
- set = 1;
- else if (strcmp(CMD_ARGV[3], "off") == 0)
- set = 0;
- else
- return ERROR_COMMAND_SYNTAX_ERROR;
+ bool set;
+ COMMAND_PARSE_ON_OFF(CMD_ARGV[3], set);
int retval;
if ((retval = flash_check_sector_parameters(CMD_CTX,
int retval;
if ((retval = flash_check_sector_parameters(CMD_CTX,
/* configuration */
static char* parport_cable = NULL;
static uint16_t parport_port;
/* 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;
static uint32_t parport_toggling_time_ns = 1000;
static int wait_states;
- 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);
- 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");
}
command_print(cmd_ctx, "Target power %s", savePower ? "on" : "off");
- 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",
}
command_print(CMD_CTX, "cortex_m3 interrupt mask %s",
return retval;
if ((retval = target_arch_state(target)) != ERROR_OK)
return retval;
return retval;
if ((retval = target_arch_state(target)) != ERROR_OK)
return retval;
}
else if (CMD_ARGC == 1)
{
}
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;
}
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)