.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm720t_read_memory,
- .write_memory = arm7_9_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.read_phys_memory = arm720t_read_phys_memory,
.write_phys_memory = arm720t_write_phys_memory,
.mmu = arm720_mmu,
.virt2phys = arm720_virt2phys,
- .bulk_write_memory = arm7_9_bulk_write_memory,
-
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
return ERROR_OK;
}
+int arm7_9_write_memory_opt(struct target *target,
+ uint32_t address,
+ uint32_t size,
+ uint32_t count,
+ const uint8_t *buffer)
+{
+ struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
+
+ if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
+ return arm7_9->bulk_write_memory(target, address, count, buffer);
+ else
+ return arm7_9_write_memory(target, address, size, count, buffer);
+}
+
static int dcc_count;
static const uint8_t *dcc_buffer;
void (*pre_restore_context)(struct target *target);
/**< Callback function called before restoring the processor context */
+
+ /**
+ * Write target memory in multiples of 4 bytes, optimized for
+ * writing large quantities of data.
+ */
+ int (*bulk_write_memory)(struct target *target, uint32_t address,
+ uint32_t count, const uint8_t *buffer);
};
static inline struct arm7_9_common *target_to_arm7_9(struct target *target)
uint32_t size, uint32_t count, uint8_t *buffer);
int arm7_9_write_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, const uint8_t *buffer);
+int arm7_9_write_memory_opt(struct target *target, uint32_t address,
+ uint32_t size, uint32_t count, const uint8_t *buffer);
int arm7_9_bulk_write_memory(struct target *target, uint32_t address,
uint32_t count, const uint8_t *buffer);
arm7_9->enable_single_step = arm7_9_enable_eice_step;
arm7_9->disable_single_step = arm7_9_disable_eice_step;
+ arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
.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,
return ERROR_OK;
}
+int arm920t_write_memory_opt(struct target *target, uint32_t address,
+ uint32_t size, uint32_t count, const uint8_t *buffer)
+{
+ struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
+
+ if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
+ return arm7_9->bulk_write_memory(target, address, count, buffer);
+ else
+ return arm920t_write_memory(target, address, size, count, buffer);
+}
+
/* EXPORTED to FA256 */
int arm920t_soft_reset_halt(struct target *target)
{
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
- .write_memory = arm920t_write_memory,
+ .write_memory = arm920t_write_memory_opt,
.read_phys_memory = arm920t_read_phys_memory,
.write_phys_memory = arm920t_write_phys_memory,
.mmu = arm920_mmu,
.virt2phys = arm920_virt2phys,
- .bulk_write_memory = arm7_9_bulk_write_memory,
-
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int arm920t_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
+int arm920t_write_memory_opt(struct target *target,
+ uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
int arm920t_post_debug_entry(struct target *target);
void arm920t_pre_restore_context(struct target *target);
int arm920t_get_ttb(struct target *target, uint32_t *result);
return retval;
}
+int arm926ejs_write_memory_opt(struct target *target, uint32_t address,
+ uint32_t size, uint32_t count, const uint8_t *buffer)
+{
+ struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
+
+ if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
+ return arm7_9->bulk_write_memory(target, address, count, buffer);
+ else
+ return arm926ejs_write_memory(target, address, size, count, buffer);
+}
+
static int arm926ejs_write_phys_memory(struct target *target,
uint32_t address, uint32_t size,
uint32_t count, const uint8_t *buffer)
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm926ejs_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm926ejs_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
int arm926ejs_arch_state(struct target *target);
int arm926ejs_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
+int arm926ejs_write_memory_opt(struct target *target,
+ uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
int arm926ejs_soft_reset_halt(struct target *target);
extern const struct command_registration arm926ejs_command_handlers[];
/**
* Write memory
*/
- retval = arm7_9_write_memory(target, address, size, count, buffer);
+ retval = arm7_9_write_memory_opt(target, address, size, count, buffer);
if (retval != ERROR_OK)
return retval;
.read_memory = arm946e_read_memory,
.write_memory = arm946e_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
-
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.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,
arm7_9->enable_single_step = arm9tdmi_enable_single_step;
arm7_9->disable_single_step = arm9tdmi_disable_single_step;
+ arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
.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,
arm7_9->enable_single_step = arm9tdmi_enable_single_step;
arm7_9->disable_single_step = arm9tdmi_disable_single_step;
+ arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
- .write_memory = arm920t_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm920t_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
arm7_9->enable_single_step = feroceon_enable_single_step;
arm7_9->disable_single_step = feroceon_disable_single_step;
+ arm7_9->bulk_write_memory = feroceon_bulk_write_memory;
+
/* MOE is not implemented */
arm7_9->examine_debug_reason = feroceon_examine_debug_reason;
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm926ejs_write_memory,
- .bulk_write_memory = feroceon_bulk_write_memory,
+ .write_memory = arm926ejs_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm7_9_write_memory,
- .bulk_write_memory = feroceon_bulk_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
return target->type->write_phys_memory(target, address, size, count, buffer);
}
-static int target_bulk_write_memory_default(struct target *target,
- uint32_t address, uint32_t count, const uint8_t *buffer)
-{
- return target_write_memory(target, address, 4, count, buffer);
-}
-
int target_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
if (target->type->write_buffer == NULL)
target->type->write_buffer = target_write_buffer_default;
- if (target->type->bulk_write_memory == NULL)
- target->type->bulk_write_memory = target_bulk_write_memory_default;
-
if (target->type->get_gdb_fileio_info == NULL)
target->type->get_gdb_fileio_info = target_get_gdb_fileio_info_default;
if (size >= 4) {
int aligned = size - (size % 4);
- /* use bulk writes above a certain limit. This may have to be changed */
- if (aligned > 128) {
- retval = target->type->bulk_write_memory(target, address, aligned / 4, buffer);
- if (retval != ERROR_OK)
- return retval;
- } else {
- retval = target_write_memory(target, address, 4, aligned / 4, buffer);
- if (retval != ERROR_OK)
- return retval;
- }
+ retval = target_write_memory(target, address, 4, aligned / 4, buffer);
+ if (retval != ERROR_OK)
+ return retval;
buffer += aligned;
address += aligned;
int (*write_buffer)(struct target *target, uint32_t address,
uint32_t size, const uint8_t *buffer);
- /**
- * Write target memory in multiples of 4 bytes, optimized for
- * writing large quantities of data. Do @b not call this
- * function directly, use target_bulk_write_memory() instead.
- */
- int (*bulk_write_memory)(struct target *target, uint32_t address,
- uint32_t count, const uint8_t *buffer);
-
int (*checksum_memory)(struct target *target, uint32_t address,
uint32_t count, uint32_t *checksum);
int (*blank_check_memory)(struct target *target, uint32_t address,