[Pdbg] [PATCH 08/10] libpdbg: Add api to control threads via sbefifo
Amitay Isaacs
amitay at ozlabs.org
Wed Jul 3 13:46:17 AEST 2019
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libpdbg/libpdbg.h | 4 ++++
libpdbg/target.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index 8a6640e..a8deb34 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -230,6 +230,10 @@ 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);
int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor);
+int sbe_thread_start(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id);
+int sbe_thread_stop(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id);
+int sbe_thread_step(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id);
+int sbe_thread_sreset(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id);
uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len);
void sbe_ffdc_dump(struct pdbg_target *target);
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 6508c14..18e492c 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -274,6 +274,37 @@ int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor)
return sbefifo->istep(sbefifo, major, minor);
}
+static int sbe_thread_control(struct pdbg_target *target,
+ uint32_t core_id, uint32_t thread_id, uint32_t oper)
+{
+ struct sbefifo *sbefifo;
+
+ assert(pdbg_target_is_class(target, "sbefifo"));
+
+ sbefifo = target_to_sbefifo(target);
+ return sbefifo->control(sbefifo, core_id, thread_id, oper);
+}
+
+int sbe_thread_start(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id)
+{
+ return sbe_thread_control(target, core_id, thread_id, 0);
+}
+
+int sbe_thread_stop(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id)
+{
+ return sbe_thread_control(target, core_id, thread_id, 1);
+}
+
+int sbe_thread_step(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id)
+{
+ return sbe_thread_control(target, core_id, thread_id, 2);
+}
+
+int sbe_thread_sreset(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id)
+{
+ return sbe_thread_control(target, core_id, thread_id, 3);
+}
+
uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len)
{
struct sbefifo *sbefifo;
--
2.21.0
More information about the Pdbg
mailing list