use COMMAND_REGISTER macro
[fw/openocd] / src / target / arm966e.c
index fc50acb6653b3480f9ba717a068aa6f8f0d593b0..f61787580ba3c56a409579d9dc83e5b32aecf118 100644 (file)
@@ -165,31 +165,31 @@ int arm966e_write_cp15(struct target *target, int reg_addr, uint32_t value)
 COMMAND_HANDLER(arm966e_handle_cp15_command)
 {
        int retval;
-       struct target *target = get_current_target(cmd_ctx);
+       struct target *target = get_current_target(CMD_CTX);
        struct arm966e_common *arm966e = target_to_arm966(target);
 
-       retval = arm966e_verify_pointer(cmd_ctx, arm966e);
+       retval = arm966e_verify_pointer(CMD_CTX, arm966e);
        if (retval != ERROR_OK)
                return retval;
 
        if (target->state != TARGET_HALTED)
        {
-               command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
+               command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_OK;
        }
 
        /* one or more argument, access a single register (write if second argument is given */
-       if (argc >= 1)
+       if (CMD_ARGC >= 1)
        {
                uint32_t address;
-               COMMAND_PARSE_NUMBER(u32, args[0], address);
+               COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
 
-               if (argc == 1)
+               if (CMD_ARGC == 1)
                {
                        uint32_t value;
                        if ((retval = arm966e_read_cp15(target, address, &value)) != ERROR_OK)
                        {
-                               command_print(cmd_ctx,
+                               command_print(CMD_CTX,
                                                "couldn't access reg %" PRIi32,
                                                address);
                                return ERROR_OK;
@@ -199,21 +199,21 @@ COMMAND_HANDLER(arm966e_handle_cp15_command)
                                return retval;
                        }
 
-                       command_print(cmd_ctx, "%" PRIi32 ": %8.8" PRIx32,
+                       command_print(CMD_CTX, "%" PRIi32 ": %8.8" PRIx32,
                                        address, value);
                }
-               else if (argc == 2)
+               else if (CMD_ARGC == 2)
                {
                        uint32_t value;
-                       COMMAND_PARSE_NUMBER(u32, args[1], value);
+                       COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
                        if ((retval = arm966e_write_cp15(target, address, value)) != ERROR_OK)
                        {
-                               command_print(cmd_ctx,
+                               command_print(CMD_CTX,
                                                "couldn't access reg %" PRIi32,
                                                address);
                                return ERROR_OK;
                        }
-                       command_print(cmd_ctx, "%" PRIi32 ": %8.8" PRIx32,
+                       command_print(CMD_CTX, "%" PRIi32 ": %8.8" PRIx32,
                                        address, value);
                }
        }
@@ -228,10 +228,10 @@ int arm966e_register_commands(struct command_context *cmd_ctx)
        struct command *arm966e_cmd;
 
        retval = arm9tdmi_register_commands(cmd_ctx);
-       arm966e_cmd = register_command(cmd_ctx, NULL, "arm966e",
+       arm966e_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm966e",
                        NULL, COMMAND_ANY,
                        "arm966e specific commands");
-       register_command(cmd_ctx, arm966e_cmd, "cp15",
+       COMMAND_REGISTER(cmd_ctx, arm966e_cmd, "cp15",
                        arm966e_handle_cp15_command, COMMAND_EXEC,
                        "display/modify cp15 register <num> [value]");