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;
}
if (CMD_ARGC >= 1)
{
uint32_t address;
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
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;
return retval;
}
- command_print(cmd_ctx, "%" PRIi32 ": %8.8" PRIx32,
+ command_print(CMD_CTX, "%" PRIi32 ": %8.8" PRIx32,
address, value);
}
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);
}
}
return ERROR_OK;
}
+static const struct command_registration arm966e_exec_command_handlers[] = {
+ {
+ .name = "cp15",
+ .handler = arm966e_handle_cp15_command,
+ .mode = COMMAND_EXEC,
+ .usage = "<opcode> [value]",
+ .help = "display/modify cp15 register",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
+static const struct command_registration arm966e_command_handlers[] = {
+ {
+ .name = "arm966e",
+ .mode = COMMAND_ANY,
+ .help = "arm966e command group",
+ .chain = arm966e_exec_command_handlers,
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
/** Registers commands used to access coprocessor resources. */
int arm966e_register_commands(struct command_context *cmd_ctx)
{
- int retval;
- struct command *arm966e_cmd;
-
- retval = arm9tdmi_register_commands(cmd_ctx);
- arm966e_cmd = register_command(cmd_ctx, NULL, "arm966e",
- NULL, COMMAND_ANY,
- "arm966e specific commands");
- register_command(cmd_ctx, arm966e_cmd, "cp15",
- arm966e_handle_cp15_command, COMMAND_EXEC,
- "display/modify cp15 register <num> [value]");
-
- return retval;
+ arm9tdmi_register_commands(cmd_ctx);
+ return register_commands(cmd_ctx, NULL, arm966e_command_handlers);
}
/** Holds methods for ARM966 targets. */