aboutsummaryrefslogtreecommitdiff
path: root/core.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-08-10 17:56:37 -0400
committerPaul Selkirk <paul@psgd.org>2016-08-10 17:56:37 -0400
commit99b022abb09ffd17fc54b4e479086444f0eeb79f (patch)
treeb616cea8b90b474c792b2e06f340ba8d590ce54e /core.c
parentf5a63c380d9091b002949624001b2b1426454b56 (diff)
Reset table of cores, e.g. after resetting FPGA from CLI.
Diffstat (limited to 'core.c')
-rw-r--r--core.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/core.c b/core.c
index 3c840d4..378f085 100644
--- a/core.c
+++ b/core.c
@@ -93,10 +93,10 @@ static const struct { const char *name; hal_addr_t extra; } gaps[] = {
{ "modexpa7", 3 * CORE_SIZE }, /* ModexpA7 uses four slots */
};
+static hal_core_t *head = NULL;
+
static hal_core_t *probe_cores(void)
{
- static hal_core_t *head = NULL;
-
if (head != NULL)
return head;
@@ -167,6 +167,20 @@ static hal_core_t *probe_cores(void)
return NULL;
}
+void hal_core_reset_table(void)
+{
+#if HAL_STATIC_CORE_STATE_BLOCKS > 0
+ head = NULL;
+ memset(core_table, 0, sizeof(core_table));
+#else
+ while (head != NULL) {
+ hal_core_t *next = head->next;
+ free(head);
+ head = next;
+ }
+#endif
+}
+
hal_core_t * hal_core_iterate(hal_core_t *core)
{
return core == NULL ? probe_cores() : core->next;