aboutsummaryrefslogtreecommitdiff
path: root/src/include/target.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/target.h')
-rw-r--r--src/include/target.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/include/target.h b/src/include/target.h
index 940a360..5a9a94a 100644
--- a/src/include/target.h
+++ b/src/include/target.h
@@ -112,12 +112,27 @@ target *target_attach(target *t, target_destroy_callback destroy_cb);
#define target_regs_size(target) \
((target)->regs_size)
-#define target_mem_map(target) \
- ((target)->xml_mem_map ? (target)->xml_mem_map : "")
-
#define target_tdesc(target) \
((target)->tdesc ? (target)->tdesc : "")
+struct target_ram {
+ uint32_t start;
+ uint32_t length;
+ struct target_ram *next;
+};
+
+struct target_flash {
+ uint32_t start;
+ uint32_t length;
+ uint32_t blocksize;
+ int (*erase)(struct target_flash *f, uint32_t addr, size_t len);
+ int (*write)(struct target_flash *f, uint32_t dest,
+ const uint8_t *src, size_t len);
+ int (*done)(struct target_flash *t);
+ target *t;
+ struct target_flash *next;
+};
+
struct target_s {
/* Notify controlling debugger if target is lost */
target_destroy_callback destroy_callback;
@@ -158,8 +173,12 @@ struct target_s {
unsigned target_options;
uint32_t idcode;
- /* Flash memory access functions */
+ /* Target memory map */
const char *xml_mem_map;
+ struct target_ram *ram;
+ struct target_flash *flash;
+
+ /* DEPRECATED: Flash memory access functions */
int (*flash_erase)(target *t, uint32_t addr, size_t len);
int (*flash_write)(target *t, uint32_t dest,
const uint8_t *src, size_t len);
@@ -190,6 +209,9 @@ extern bool connect_assert_srst;
target *target_new(unsigned size);
void target_list_free(void);
void target_add_commands(target *t, const struct command_s *cmds, const char *name);
+void target_add_ram(target *t, uint32_t start, uint32_t len);
+void target_add_flash(target *t, struct target_flash *f);
+const char *target_mem_map(target *t);
static inline uint32_t target_mem_read32(target *t, uint32_t addr)
{