[Pdbg] [PATCH 4/5] adu: Add new api for memory read/write
Amitay Isaacs
amitay at ozlabs.org
Mon Jan 7 15:30:19 AEDT 2019
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libpdbg/libpdbg.h | 3 +++
libpdbg/target.c | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index ee8437f..b332a7e 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -221,6 +221,9 @@ int __adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput,
int __adu_putmem(struct pdbg_target *target, uint64_t addr, uint8_t *input,
uint64_t size, bool ci);
+int mem_read(struct pdbg_target *target, uint64_t addr, uint8_t *output, uint64_t size, uint8_t block_size, bool ci);
+int mem_write(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size, uint8_t block_size, bool ci);
+
int opb_read(struct pdbg_target *target, uint32_t addr, uint32_t *data);
int opb_write(struct pdbg_target *target, uint32_t addr, uint32_t data);
diff --git a/libpdbg/target.c b/libpdbg/target.c
index af9199d..e678470 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -216,6 +216,26 @@ int fsi_write(struct pdbg_target *fsi_dt, uint32_t addr, uint32_t data)
return fsi->write(fsi, addr64, data);
}
+int mem_read(struct pdbg_target *target, uint64_t addr, uint8_t *output, uint64_t size, uint8_t block_size, bool ci)
+{
+ struct adu *adu;
+
+ assert(pdbg_target_is_class(target, "adu"));
+ adu = target_to_adu(target);
+
+ return adu->read(adu, addr, output, size, block_size, ci);
+}
+
+int mem_write(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size, uint8_t block_size, bool ci)
+{
+ struct adu *adu;
+
+ assert(pdbg_target_is_class(target, "adu"));
+ adu = target_to_adu(target);
+
+ return adu->write(adu, addr, input, size, block_size, ci);
+}
+
struct pdbg_target *require_target_parent(struct pdbg_target *target)
{
assert(target->parent);
--
2.20.1
More information about the Pdbg
mailing list