From e3fe7d89b6094bfef42f42329e15631f684f0748 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Thu, 21 Jul 2016 16:32:43 -0400 Subject: Use a fresh port of libcli, which retains more of the original API. --- projects/cli-test/mgmt-show.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'projects/cli-test/mgmt-show.c') diff --git a/projects/cli-test/mgmt-show.c b/projects/cli-test/mgmt-show.c index b918cce..e88b784 100644 --- a/projects/cli-test/mgmt-show.c +++ b/projects/cli-test/mgmt-show.c @@ -32,8 +32,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* Rename both CMSIS HAL_OK and libhal HAL_OK to disambiguate */ #define HAL_OK CMSIS_HAL_OK - #include "stm-init.h" #include "stm-keystore.h" #include "stm-fpgacfg.h" @@ -42,7 +42,6 @@ #include "mgmt-cli.h" #include "mgmt-show.h" -/* Rename both CMSIS HAL_OK and libhal HAL_OK to disambiguate */ #undef HAL_OK #define LIBHAL_OK HAL_OK #include "hal.h" @@ -53,7 +52,6 @@ #include - static int cmd_show_cpuspeed(struct cli_def *cli, const char *command, char *argv[], int argc) { volatile uint32_t hclk; @@ -127,18 +125,21 @@ static int cmd_show_keystore_data(struct cli_def *cli, const char *command, char void configure_cli_show(struct cli_def *cli) { - /* show */ - cli_command_root(show); + struct cli_command *c = cli_register_command(cli, NULL, "show", NULL, 0, 0, NULL); /* show cpuspeed */ - cli_command_node(show, cpuspeed, "Show the speed at which the CPU currently operates"); + cli_register_command(cli, c, "cpuspeed", cmd_show_cpuspeed, 0, 0, "Show the speed at which the CPU currently operates"); + + struct cli_command *c_fpga = cli_register_command(cli, c, "fpga", NULL, 0, 0, NULL); - cli_command_branch(show, fpga); /* show fpga status*/ - cli_command_node(show_fpga, status, "Show status about the FPGA"); + cli_register_command(cli, c_fpga, "status", cmd_show_fpga_status, 0, 0, "Show status about the FPGA"); + + struct cli_command *c_keystore = cli_register_command(cli, c, "keystore", NULL, 0, 0, NULL); - cli_command_branch(show, keystore); /* show keystore status*/ - cli_command_node(show_keystore, status, "Show status of the keystore memory"); - cli_command_node(show_keystore, data, "Show the first page of the keystore memory"); + cli_register_command(cli, c_keystore, "status", cmd_show_keystore_status, 0, 0, "Show status of the keystore memory"); + + /* show keystore data */ + cli_register_command(cli, c_keystore, "data", cmd_show_keystore_data, 0, 0, "Show the first page of the keystore memory"); } -- cgit v1.2.3