diff options
Diffstat (limited to 'com32/hdt/hdt-cli.h')
-rw-r--r-- | com32/hdt/hdt-cli.h | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h index 72e46a36..05fb143b 100644 --- a/com32/hdt/hdt-cli.h +++ b/com32/hdt/hdt-cli.h @@ -29,9 +29,14 @@ #ifndef DEFINE_HDT_CLI_H #define DEFINE_HDT_CLI_H #include <stdio.h> +#include <getkey.h> #include "hdt-common.h" +#define MAX_LINE_SIZE 256 + +#define CLI_SPACE " " +#define CLI_LF "\n" #define CLI_CLEAR "clear" #define CLI_EXIT "exit" #define CLI_HELP "help" @@ -62,14 +67,41 @@ typedef enum { VESA_MODE, } cli_mode_t; -struct s_cli_mode { +#define PROMPT_SIZE 32 +#define MAX_HISTORY_SIZE 32 +struct s_cli { cli_mode_t mode; - char prompt[32]; + char prompt[PROMPT_SIZE]; + char input[MAX_LINE_SIZE]; + int cursor_pos; + char history[MAX_HISTORY_SIZE][MAX_LINE_SIZE]; + int history_pos; + int max_history_pos; +}; + +/* A command-line command */ +struct commands_mode { + const unsigned int mode; + struct commands_module_descr* show_modules; + /* Future: set? */ +}; + +struct commands_module { + const char *name; + void ( * exec ) ( int argc, char** argv, struct s_hardware *hardware ); +}; + +/* Describe 'show', 'set', ... commands in a module */ +struct commands_module_descr { + struct commands_module* modules; + const int nb_modules; }; +struct commands_mode dmi_mode; + void start_cli_mode(struct s_hardware *hardware); void main_show(char *item, struct s_hardware *hardware); -int do_exit(struct s_cli_mode *cli_mode); +int do_exit(struct s_cli *cli); // DMI STUFF #define CLI_DMI_BASE_BOARD "base_board" @@ -80,10 +112,11 @@ int do_exit(struct s_cli_mode *cli_mode); #define CLI_DMI_MEMORY_BANK "bank" #define CLI_DMI_PROCESSOR "cpu" #define CLI_DMI_SYSTEM "system" +#define CLI_DMI_LIST CLI_SHOW_LIST +#define CLI_DMI_MAX_MODULES 9 void main_show_dmi(struct s_hardware *hardware); void handle_dmi_commands(char *cli_line, struct s_hardware *hardware); -void show_dmi_memory_modules(struct s_hardware *hardware, bool clearscreen, - bool show_free_banks); +void show_dmi_memory_modules(int argc, char** argv, struct s_hardware *hardware); // PCI STUFF #define CLI_PCI_DEVICE "device" |