summaryrefslogtreecommitdiff
path: root/demo/main.c
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-10-04 00:58:57 -0600
committerAlejandro Soto <alejandro@34project.org>2023-10-04 00:58:57 -0600
commit897bd990f9e5ef1be358172c6804d49ffe7c453c (patch)
treec8ec072fff033aab81aff61fe9238db39d82740d /demo/main.c
parentb3555efa723d0b7101ea6989dc04492eca6b8745 (diff)
demo: implement run, halt cmds
Diffstat (limited to 'demo/main.c')
-rw-r--r--demo/main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/demo/main.c b/demo/main.c
index f75f6f1..efc183b 100644
--- a/demo/main.c
+++ b/demo/main.c
@@ -4,6 +4,24 @@ static struct cpu cpu0, cpu1, cpu2, cpu3;
struct cpu *__cpus[] = { &cpu0, &cpu1, &cpu2, &cpu3 };
+static void cmd_run(char **tokens)
+{
+ unsigned mask;
+ if (parse_cpu_mask(tokens, &mask) < 0)
+ return;
+
+ run_cpus(mask);
+}
+
+static void cmd_halt(char **tokens)
+{
+ unsigned mask;
+ if (parse_cpu_mask(tokens, &mask) < 0)
+ return;
+
+ halt_cpus(mask);
+}
+
void bsp_main(void)
{
run_cpu(1);
@@ -21,7 +39,12 @@ void bsp_main(void)
if (!cmd)
continue;
- print("unknown command '%s'", cmd);
+ if (!strcmp(cmd, "run"))
+ cmd_run(&tokens);
+ else if (!strcmp(cmd, "halt"))
+ cmd_halt(&tokens);
+ else
+ print("unknown command '%s'", cmd);
}
}