X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Farm966e.c;h=6a96ab18f2d6fab0f4c73e5ea71400be9f23a8e7;hp=c1e80582bf21488608f6bae8562c0491f8850079;hb=13f6c889ab9b6e5b1c4f48fca9807fdc1fb83f42;hpb=ec108ff59e23ec32abf1223488ad96dd26205a5b diff --git a/src/target/arm966e.c b/src/target/arm966e.c index c1e80582bf..6a96ab18f2 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -18,8 +18,9 @@ * 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. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -28,7 +29,6 @@ #include "target_type.h" #include "arm_opcodes.h" - #if 0 #define _DEBUG_INSTRUCTION_EXECUTION_ #endif @@ -53,7 +53,7 @@ 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); } @@ -84,12 +84,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, TAP_IDLE)) != ERROR_OK) - { + retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE); + if (retval != ERROR_OK) + return retval; + retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE); + if (retval != ERROR_OK) return retval; - } - arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE); fields[0].num_bits = 32; /* REVISIT: table 7-2 shows that bits 31-31 need to be @@ -116,17 +116,16 @@ static int arm966e_read_cp15(struct target *target, int reg_addr, uint32_t *valu #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 +138,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, TAP_IDLE)) != ERROR_OK) - { + retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE); + if (retval != ERROR_OK) + return retval; + retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE); + if (retval != ERROR_OK) return retval; - } - arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE); fields[0].num_bits = 32; fields[0].out_value = value_buf; @@ -177,42 +176,36 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) 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 +238,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, @@ -271,8 +264,7 @@ struct target_type arm966e_target = .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,