X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Farm966e.c;h=98c62745f26d086a966981ea2903e135061190f7;hp=4f4764485afe2ac6d952a471d8651319943dffea;hb=6a453e5cf0adc4d19378e953122ca69efcf32b6d;hpb=e018c7c1d29e8dabb9b4a90bb9eb3574eb1668bb diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 4f4764485a..98c62745f2 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -16,10 +16,9 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * along with this program. If not, see . * ***************************************************************************/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -28,7 +27,6 @@ #include "target_type.h" #include "arm_opcodes.h" - #if 0 #define _DEBUG_INSTRUCTION_EXECUTION_ #endif @@ -53,16 +51,16 @@ int arm966e_init_arch_info(struct target *target, struct arm966e_common *arm966e static int arm966e_target_create(struct target *target, Jim_Interp *interp) { - struct arm966e_common *arm966e = calloc(1,sizeof(struct arm966e_common)); + struct arm966e_common *arm966e = calloc(1, sizeof(struct arm966e_common)); return arm966e_init_arch_info(target, arm966e, target->tap); } -static int arm966e_verify_pointer(struct command_context *cmd_ctx, +static int arm966e_verify_pointer(struct command_invocation *cmd, struct arm966e_common *arm966e) { if (arm966e->common_magic != ARM966E_COMMON_MAGIC) { - command_print(cmd_ctx, "target is not an ARM966"); + command_print(cmd->ctx, "target is not an ARM966"); return ERROR_TARGET_INVALID; } return ERROR_OK; @@ -84,12 +82,12 @@ static int arm966e_read_cp15(struct target *target, int reg_addr, uint32_t *valu uint8_t reg_addr_buf = reg_addr & 0x3f; uint8_t nr_w_buf = 0; - jtag_set_end_state(TAP_IDLE); - if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) - { + retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE); + if (retval != ERROR_OK) + return retval; + retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->intest_instr, NULL, TAP_IDLE); + if (retval != ERROR_OK) return retval; - } - arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); fields[0].num_bits = 32; /* REVISIT: table 7-2 shows that bits 31-31 need to be @@ -106,27 +104,26 @@ static int arm966e_read_cp15(struct target *target, int reg_addr, uint32_t *valu fields[2].out_value = &nr_w_buf; fields[2].in_value = NULL; - jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state()); + jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE); fields[1].in_value = (uint8_t *)value; - jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state()); + jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE); jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ - if ((retval = jtag_execute_queue()) != ERROR_OK) - { + retval = jtag_execute_queue(); + if (retval != ERROR_OK) return retval; - } LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, *value); #endif return ERROR_OK; } -// EXPORTED to str9x (flash) +/* EXPORTED to str9x (flash) */ int arm966e_write_cp15(struct target *target, int reg_addr, uint32_t value) { int retval = ERROR_OK; @@ -139,12 +136,12 @@ int arm966e_write_cp15(struct target *target, int reg_addr, uint32_t value) buf_set_u32(value_buf, 0, 32, value); - jtag_set_end_state(TAP_IDLE); - if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) - { + retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE); + if (retval != ERROR_OK) + return retval; + retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->intest_instr, NULL, TAP_IDLE); + if (retval != ERROR_OK) return retval; - } - arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL); fields[0].num_bits = 32; fields[0].out_value = value_buf; @@ -158,7 +155,7 @@ int arm966e_write_cp15(struct target *target, int reg_addr, uint32_t value) fields[2].out_value = &nr_w_buf; fields[2].in_value = NULL; - jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state()); + jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value); @@ -173,46 +170,40 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) 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, arm966e); if (retval != ERROR_OK) return retval; - if (target->state != TARGET_HALTED) - { + if (target->state != TARGET_HALTED) { 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 (CMD_ARGC >= 1) - { + if (CMD_ARGC >= 1) { uint32_t address; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address); - if (CMD_ARGC == 1) - { + if (CMD_ARGC == 1) { uint32_t value; - if ((retval = arm966e_read_cp15(target, address, &value)) != ERROR_OK) - { + retval = arm966e_read_cp15(target, address, &value); + if (retval != ERROR_OK) { command_print(CMD_CTX, "couldn't access reg %" PRIi32, address); return ERROR_OK; } - if ((retval = jtag_execute_queue()) != ERROR_OK) - { + retval = jtag_execute_queue(); + if (retval != ERROR_OK) return retval; - } command_print(CMD_CTX, "%" PRIi32 ": %8.8" PRIx32, address, value); - } - else if (CMD_ARGC == 2) - { + } else if (CMD_ARGC == 2) { uint32_t value; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); - if ((retval = arm966e_write_cp15(target, address, value)) != ERROR_OK) - { + retval = arm966e_write_cp15(target, address, value); + if (retval != ERROR_OK) { command_print(CMD_CTX, "couldn't access reg %" PRIi32, address); @@ -245,14 +236,14 @@ const struct command_registration arm966e_command_handlers[] = { .name = "arm966e", .mode = COMMAND_ANY, .help = "arm966e command group", + .usage = "", .chain = arm966e_exec_command_handlers, }, COMMAND_REGISTRATION_DONE }; /** Holds methods for ARM966 targets. */ -struct target_type arm966e_target = -{ +struct target_type arm966e_target = { .name = "arm966e", .poll = arm7_9_poll, @@ -268,11 +259,11 @@ struct target_type arm966e_target = .deassert_reset = arm7_9_deassert_reset, .soft_reset_halt = arm7_9_soft_reset_halt, + .get_gdb_arch = arm_get_gdb_arch, .get_gdb_reg_list = arm_get_gdb_reg_list, .read_memory = arm7_9_read_memory, - .write_memory = arm7_9_write_memory, - .bulk_write_memory = arm7_9_bulk_write_memory, + .write_memory = arm7_9_write_memory_opt, .checksum_memory = arm_checksum_memory, .blank_check_memory = arm_blank_check_memory,