diff options
| author | Alistair Popple <alistair@popple.id.au> | 2018-09-04 15:24:19 +1000 |
|---|---|---|
| committer | Alistair Popple <alistair@popple.id.au> | 2018-11-09 11:20:04 +1100 |
| commit | d4e0bb5af7a7b8db3187cf19b19658d37838c86b (patch) | |
| tree | 70f256851647d020c256b3f9694f20e8d800b697 /libpdbg | |
| parent | 8cc92dbc1d743e3fab72ea418794eafb50d81255 (diff) | |
| download | pdbg-d4e0bb5af7a7b8db3187cf19b19658d37838c86b.tar.gz pdbg-d4e0bb5af7a7b8db3187cf19b19658d37838c86b.zip | |
libpdbg: Add API to get device tree path and find target via path
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
Diffstat (limited to 'libpdbg')
| -rw-r--r-- | libpdbg/libpdbg.c | 13 | ||||
| -rw-r--r-- | libpdbg/libpdbg.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c index ccaad3e..f77138a 100644 --- a/libpdbg/libpdbg.c +++ b/libpdbg/libpdbg.c @@ -135,6 +135,19 @@ const char *pdbg_target_dn_name(struct pdbg_target *target) return target->dn_name; } +char *pdbg_target_path(const struct pdbg_target *target) +{ + return dt_get_path(target); +} + +struct pdbg_target *pdbg_target_from_path(struct pdbg_target *target, const char *path) +{ + if (!target) + target = dt_root; + + return dt_find_by_path(target, path); +} + void pdbg_set_target_property(struct pdbg_target *target, const char *name, const void *val, size_t size) { struct dt_property *p; diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 138521c..b11866a 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -84,6 +84,8 @@ void pdbg_target_release(struct pdbg_target *target); enum pdbg_target_status pdbg_target_status(struct pdbg_target *target); void pdbg_target_status_set(struct pdbg_target *target, enum pdbg_target_status status); uint32_t pdbg_target_index(struct pdbg_target *target); +char *pdbg_target_path(const struct pdbg_target *target); +struct pdbg_target *pdbg_target_from_path(struct pdbg_target *target, const char *path); uint32_t pdbg_parent_index(struct pdbg_target *target, char *klass); char *pdbg_target_class_name(struct pdbg_target *target); char *pdbg_target_name(struct pdbg_target *target); |

