From 97fbd793b3a4edec490b2b034f7b6fe5261ca03e Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Mon, 23 Nov 2009 07:43:06 -0800 Subject: [PATCH] cortex_m3: use register_commands() --- src/target/cortex_m3.c | 55 +++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 47052e90..be81af98 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1912,27 +1912,44 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) return ERROR_OK; } +static const struct command_registration cortex_m3_exec_command_handlers[] = { + { + .name = "disassemble", + .handler = &handle_cortex_m3_disassemble_command, + .mode = COMMAND_EXEC, + .help = "disassemble Thumb2 instructions", + .usage = "
[]", + }, + { + .name = "maskisr", + .handler = &handle_cortex_m3_mask_interrupts_command, + .mode = COMMAND_EXEC, + .help = "mask cortex_m3 interrupts", + .usage = "['on'|'off']", + }, + { + .name = "vector_catch", + .handler = &handle_cortex_m3_vector_catch_command, + .mode = COMMAND_EXEC, + .help = "catch hardware vectors", + .usage = "['all'|'none'|]", + }, + COMMAND_REGISTRATION_DONE +}; +static const struct command_registration cortex_m3_command_handlers[] = { + { + .name = "cortex_m3", + .mode = COMMAND_ANY, + .help = "Cortex-M3 command group", + .chain = cortex_m3_exec_command_handlers, + }, + COMMAND_REGISTRATION_DONE +}; + static int cortex_m3_register_commands(struct command_context *cmd_ctx) { - int retval; - struct command *cortex_m3_cmd; - - retval = armv7m_register_commands(cmd_ctx); - - cortex_m3_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "cortex_m3", - NULL, COMMAND_ANY, "cortex_m3 specific commands"); - - COMMAND_REGISTER(cmd_ctx, cortex_m3_cmd, "disassemble", - handle_cortex_m3_disassemble_command, COMMAND_EXEC, - "disassemble Thumb2 instructions
[]"); - COMMAND_REGISTER(cmd_ctx, cortex_m3_cmd, "maskisr", - handle_cortex_m3_mask_interrupts_command, COMMAND_EXEC, - "mask cortex_m3 interrupts ['on'|'off']"); - COMMAND_REGISTER(cmd_ctx, cortex_m3_cmd, "vector_catch", - handle_cortex_m3_vector_catch_command, COMMAND_EXEC, - "catch hardware vectors ['all'|'none'|]"); - - return retval; + armv7m_register_commands(cmd_ctx); + return register_commands(cmd_ctx, NULL, cortex_m3_command_handlers); } struct target_type cortexm3_target = -- 2.39.5