Add target_bulk_write_memory wrapper:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 31 May 2009 09:39:04 +0000 (09:39 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 31 May 2009 09:39:04 +0000 (09:39 +0000)
- replaces all calls to target->type->bulk_write_memory.
- add documentation in target_s to warn not to invoke callback directly.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1963 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/flash/orion_nand.c
src/target/target.c
src/target/target.h

index 5ec1c25cde5c41b6d9941c300cf0fae94a53841e..f1208a634b1151d07f375b290156ad18b9d57c77 100644 (file)
@@ -140,8 +140,7 @@ static int orion_nand_fast_block_write(struct nand_device_s *device, u8 *data, i
 
        /* 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),
index 2209612cf180a2ef03c26b2560604a173d2653f2..4a60cc4977cf1bf02e0ab2194a3bc16a982c2900 100644 (file)
@@ -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,
index 662c95b943ccb14884af3a0b3deb88ce64ce4902..9674c473c150409869c4bb6a82ca964329721685 100644 (file)
@@ -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);