Add target_write_memory wrapper:
[fw/openocd] / src / target / target.h
index 09f8e9c32973060842636db752b2e6b07fe4301f..2214c06e65e1c656f6942194fb8aae0573620774 100644 (file)
@@ -161,8 +161,16 @@ typedef struct target_type_s
        * count: number of items of <size>
        */
        int (*read_memory_imp)(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
+       /**
+        * Target memory read callback.  Do @b not call this function
+        * directly, use target_read_memory() instead.
+        */
        int (*read_memory)(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
        int (*write_memory_imp)(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
+       /**
+        * Target memory write callback.  Do @b not call this function
+        * directly, use target_write_memory() instead.
+        */
        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 */
@@ -371,6 +379,23 @@ extern target_t* get_current_target(struct command_context_s *cmd_ctx);
 extern int get_num_by_target(target_t *query_target);
 extern target_t *get_target(const char *id);
 
+/**
+ * Read @count items of @a size bytes from the memory of @a target at
+ * the @a address given.
+ *
+ * This routine is a wrapper for target->type->read_memory.
+ */
+extern int target_read_memory(struct target_s *target,
+               u32 address, u32 size, u32 count, u8 *buffer);
+/**
+ * Write @count items of @a size bytes to the memory of @a target at
+ * the @a address given.
+ *
+ * This routine is wrapper for target->type->write_memory.
+ */
+extern int target_write_memory(struct target_s *target,
+               u32 address, u32 size, 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);