|
From: <zw...@ma...> - 2009-05-31 11:39:09
|
Author: zwelch
Date: 2009-05-31 11:39:04 +0200 (Sun, 31 May 2009)
New Revision: 1963
Modified:
trunk/src/flash/orion_nand.c
trunk/src/target/target.c
trunk/src/target/target.h
Log:
Add target_bulk_write_memory wrapper:
- replaces all calls to target->type->bulk_write_memory.
- add documentation in target_s to warn not to invoke callback directly.
Modified: trunk/src/flash/orion_nand.c
===================================================================
--- trunk/src/flash/orion_nand.c 2009-05-31 09:38:43 UTC (rev 1962)
+++ trunk/src/flash/orion_nand.c 2009-05-31 09:39:04 UTC (rev 1963)
@@ -140,8 +140,7 @@
/* copy data to target's memory */
target_buf = hw->copy_area->address + code_size;
- retval = target->type->bulk_write_memory(target, target_buf,
- size/4, data);
+ retval = target_bulk_write_memory(target, target_buf, size/4, data);
if (retval == ERROR_OK && size & 3) {
retval = target_write_memory(target,
target_buf + (size & ~3),
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2009-05-31 09:38:43 UTC (rev 1962)
+++ trunk/src/target/target.c 2009-05-31 09:39:04 UTC (rev 1963)
@@ -536,7 +536,13 @@
{
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,
int num_reg_params, reg_param_t *reg_param,
Modified: trunk/src/target/target.h
===================================================================
--- trunk/src/target/target.h 2009-05-31 09:38:43 UTC (rev 1962)
+++ trunk/src/target/target.h 2009-05-31 09:39:04 UTC (rev 1963)
@@ -179,7 +179,11 @@
*/
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_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);
|