[Pdbg] [PATCH 4/8] libpdbg: Add function to register hw units
Amitay Isaacs
amitay at ozlabs.org
Thu Jun 13 13:24:12 AEST 2019
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libpdbg/hwunit.c | 14 ++++++++++++++
libpdbg/hwunit.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/libpdbg/hwunit.c b/libpdbg/hwunit.c
index db03d63..ad329f8 100644
--- a/libpdbg/hwunit.c
+++ b/libpdbg/hwunit.c
@@ -15,9 +15,23 @@
*/
#include <string.h>
+#include <assert.h>
#include "hwunit.h"
+#define MAX_HW_UNITS 1024
+
+static const struct hw_unit_info *g_hw_unit[MAX_HW_UNITS];
+static int g_hw_unit_count;
+
+void pdbg_hwunit_register(const struct hw_unit_info *hw_unit)
+{
+ assert(g_hw_unit_count < MAX_HW_UNITS);
+
+ g_hw_unit[g_hw_unit_count] = hw_unit;
+ g_hw_unit_count++;
+}
+
extern struct hw_unit_info *__start_hw_units;
extern struct hw_init_info *__stop_hw_units;
struct hw_unit_info *find_compatible_target(const char *compat)
diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h
index 7a0df6a..28dba27 100644
--- a/libpdbg/hwunit.h
+++ b/libpdbg/hwunit.h
@@ -30,6 +30,8 @@ struct hw_unit_info {
void *hw_unit;
size_t size;
};
+
+void pdbg_hwunit_register(const struct hw_unit_info *hw_unit);
struct hw_unit_info *find_compatible_target(const char *compat);
/* We can't pack the structs themselves directly into a special
--
2.21.0
More information about the Pdbg
mailing list