[Cryptech-Commits] [sw/stm32] 05/08: Add 'show fpga status' and 'show fpga cores'.

git at cryptech.is git at cryptech.is
Wed Jul 6 23:03:27 UTC 2016


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

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

commit d60fa7aea472a53315189af2a21419b210833f36
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Wed Jul 6 14:49:06 2016 -0400

    Add 'show fpga status' and 'show fpga cores'.
---
 projects/hsm/mgmt-fpga.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/projects/hsm/mgmt-fpga.c b/projects/hsm/mgmt-fpga.c
index b74392e..45bd33c 100644
--- a/projects/hsm/mgmt-fpga.c
+++ b/projects/hsm/mgmt-fpga.c
@@ -133,10 +133,37 @@ static int cmd_fpga_reset_registers(struct cli_def *cli, const char *command, ch
     return CLI_OK;
 }
 
+static int cmd_fpga_show_status(struct cli_def *cli, const char *command, char *argv[], int argc)
+{
+    cli_print(cli, "FPGA has %sloaded a bitstream", fpgacfg_check_done() ? "":"NOT ");
+    return CLI_OK;
+}
+
+static int cmd_fpga_show_cores(struct cli_def *cli, const char *command, char *argv[], int argc)
+{
+    const hal_core_t *core;
+    const hal_core_info_t *info;
+
+    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;
+}
+
 void configure_cli_fpga(struct cli_def *cli)
 {
     /* fpga */
     cli_command_root(fpga);
+
+    cli_command_branch(fpga, show);
+    /* show fpga status*/
+    cli_command_node(fpga_show, status, "Show status about the FPGA");
+    /* show fpga cores*/
+    cli_command_node(fpga_show, cores, "Show FPGA core names and versions");
+
     /* fpga reset */
     cli_command_node(fpga, reset, "Reset FPGA (config reset)");
     /* fpga reset registers */



More information about the Commits mailing list