diff options
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/target.c | 6 | ||||
-rw-r--r-- | src/target/target.h | 16 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c index 2209612c..4a60cc49 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -536,6 +536,12 @@ int target_write_memory(struct target_s *target, { return target->type->write_memory(target, address, size, count, buffer); } +int target_bulk_write_memory(struct target_s *target, + u32 address, u32 count, u8 *buffer) +{ + return target->type->bulk_write_memory(target, address, count, buffer); +} + int target_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, diff --git a/src/target/target.h b/src/target/target.h index 662c95b9..9674c473 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -179,7 +179,11 @@ typedef struct target_type_s */ int (*write_memory)(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); - /* write target memory in multiples of 4 byte, optimized for writing large quantities of data */ + /** + * 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_s *target, u32 address, u32 count, u8 *buffer); int (*checksum_memory)(struct target_s *target, u32 address, u32 count, u32* checksum); @@ -424,6 +428,16 @@ extern int target_read_memory(struct target_s *target, extern int target_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); +/** + * Write @count items of 4 bytes to the memory of @a target at + * the @a address given. Because it operates only on whole words, + * this should be faster than target_write_memory(). + * + * This routine is wrapper for target->type->bulk_write_memory. + */ +extern int target_bulk_write_memory(struct target_s *target, + u32 address, u32 count, u8 *buffer); + extern int target_write_buffer(struct target_s *target, u32 address, u32 size, u8 *buffer); extern int target_read_buffer(struct target_s *target, u32 address, u32 size, u8 *buffer); extern int target_checksum_memory(struct target_s *target, u32 address, u32 size, u32* crc); |