From af14a95ac67eedc197f278cf272586a6ccd16f63 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Thu, 11 Aug 2016 09:16:10 +0200 Subject: re-implement 'show fpga cores' --- projects/cli-test/mgmt-show.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'projects/cli-test') 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*/ -- cgit v1.2.3