[Cryptech-Commits] [sw/stm32] 01/03: re-implement 'show fpga cores'

git at cryptech.is git at cryptech.is
Mon Aug 15 13:26:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

fredrik at thulin.net pushed a commit to branch master
in repository sw/stm32.

commit af14a95ac67eedc197f278cf272586a6ccd16f63
Author: Fredrik Thulin <fredrik at thulin.net>
AuthorDate: Thu Aug 11 09:16:10 2016 +0200

    re-implement 'show fpga cores'
---
 projects/cli-test/mgmt-show.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/projects/cli-test/mgmt-show.c b/projects/cli-test/mgmt-show.c
index e88b784..7d6b509 100644
--- a/projects/cli-test/mgmt-show.c
+++ b/projects/cli-test/mgmt-show.c
@@ -69,6 +69,25 @@ static int cmd_show_fpga_status(struct cli_def *cli, const char *command, char *
     return CLI_OK;
 }
 
+static int cmd_show_fpga_cores(struct cli_def *cli, const char *command, char *argv[], int argc)
+{
+    const hal_core_t *core;
+    const hal_core_info_t *info;
+
+    if (! fpgacfg_check_done()) {
+        cli_print(cli, "FPGA has not loaded a bitstream");
+        return CLI_OK;
+    }
+
+    for (core = hal_core_iterate(NULL); core != NULL; core = hal_core_iterate(core)) {
+	info = hal_core_info(core);
+	cli_print(cli, "%04x: %8.8s %4.4s",
+		  (unsigned int)info->base, info->name, info->version);
+    }
+
+    return CLI_OK;
+}
+
 static int cmd_show_keystore_status(struct cli_def *cli, const char *command, char *argv[], int argc)
 {
     cli_print(cli, "Keystore memory is %sonline", (keystore_check_id() != 1) ? "NOT ":"");
@@ -135,6 +154,9 @@ void configure_cli_show(struct cli_def *cli)
     /* show fpga status*/
     cli_register_command(cli, c_fpga, "status", cmd_show_fpga_status, 0, 0, "Show status about the FPGA");
 
+    /* show fpga cores*/
+    cli_register_command(cli, c_fpga, "cores", cmd_show_fpga_cores, 0, 0, "Show the currently available FPGA cores");
+
     struct cli_command *c_keystore = cli_register_command(cli, c, "keystore", NULL, 0, 0, NULL);
 
     /* show keystore status*/



More information about the Commits mailing list