add handle_command_parse_bool command helper
[openocd.git] / src / target / arm11.c
index 6e007cfa41ce0dbbc0abeddf1074b52cac2c05f7..58b5d54238ec3aa0f34e13628ec2117fd8c528d4 100644 (file)
@@ -1981,52 +1981,17 @@ static int arm11_build_reg_cache(struct target *target)
        return ERROR_OK;
 }
 
-static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name)
-{
-       if (CMD_ARGC == 0)
-       {
-               LOG_INFO("%s is %s.", name, *var ? "enabled" : "disabled");
-               return ERROR_OK;
-       }
-
-       if (CMD_ARGC != 1)
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       switch (CMD_ARGV[0][0])
-       {
-       case '0':       /* 0 */
-       case 'f':       /* false */
-       case 'F':
-       case 'd':       /* disable */
-       case 'D':
-               *var = false;
-               break;
-
-       case '1':       /* 1 */
-       case 't':       /* true */
-       case 'T':
-       case 'e':       /* enable */
-       case 'E':
-               *var = true;
-               break;
-       }
-
-       LOG_INFO("%s %s.", *var ? "Enabled" : "Disabled", name);
-
-       return ERROR_OK;
-}
-
-#define BOOL_WRAPPER(name, print_name) \
-COMMAND_HANDLER(arm11_handle_bool_##name) \
-{ \
-       return CALL_COMMAND_HANDLER(arm11_handle_bool, \
-                       &arm11_config_##name, print_name); \
-}
+#define ARM11_BOOL_WRAPPER(name, print_name)   \
+               COMMAND_HANDLER(arm11_handle_bool_##name) \
+               { \
+                       return CALL_COMMAND_HANDLER(handle_command_parse_bool, \
+                                       &arm11_config_##name, print_name); \
+               }
 
-BOOL_WRAPPER(memwrite_burst,                   "memory write burst mode")
-BOOL_WRAPPER(memwrite_error_fatal,             "fatal error mode for memory writes")
-BOOL_WRAPPER(step_irq_enable,                  "IRQs while stepping")
-BOOL_WRAPPER(hardware_step,                    "hardware single step")
+ARM11_BOOL_WRAPPER(memwrite_burst, "memory write burst mode")
+ARM11_BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes")
+ARM11_BOOL_WRAPPER(step_irq_enable, "IRQs while stepping")
+ARM11_BOOL_WRAPPER(hardware_step, "hardware single step")
 
 COMMAND_HANDLER(arm11_handle_vcr)
 {

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)