]> cloudbase.mooo.com Git - z180-stamp.git/blob - include/cli.h
Remove STM32 variant (and submodule libopencm3)
[z180-stamp.git] / include / cli.h
1 /*
2 * (C) Copyright 2014-2016 Leo C. <erbl259-lmu@yahoo.de>
3 *
4 * (C) Copyright 2014 Google, Inc
5 * Simon Glass <sjg@chromium.org>
6 *
7 * SPDX-License-Identifier: GPL-2.0
8 */
9
10 #ifndef CLI_H
11 #define CLI_H
12
13 /**
14 * Go into the command loop
15 *
16 * This will return if we get a timeout waiting for a command, but only for
17 * the simple parser (not hush). See CONFIG_BOOT_RETRY_TIME.
18 */
19 void cli_loop(void);
20
21 /**
22 * cli_simple_run_command() - Execute a command with the simple CLI
23 *
24 * @cmd: String containing the command to execute
25 * @flag Flag value - see CMD_FLAG_...
26 * @return 1 - command executed, repeatable
27 * 0 - command executed but not repeatable, interrupted commands are
28 * always considered not repeatable
29 * -1 - not executed (unrecognized, bootd recursion or too many args)
30 * (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is
31 * considered unrecognized)
32 */
33 //int cli_simple_run_command(const char *cmd, int flag);
34
35 /**
36 * cli_simple_run_command_list() - Execute a list of command
37 *
38 * The commands should be separated by ; or \n and will be executed
39 * by the built-in parser.
40 *
41 * This function cannot take a const char * for the command, since if it
42 * finds newlines in the string, it replaces them with \0.
43 *
44 * @param cmd String containing list of commands
45 * @param flag Execution flags (CMD_FLAG_...)
46 * @return 0 on success, or != 0 on error.
47 */
48 //int cli_simple_run_command_list(char *cmd, int flag);
49
50 /**
51 * parse_line() - split a command line down into separate arguments
52 *
53 * The argv[] array is filled with pointers into @line, and each argument
54 * is terminated by \0 (i.e. @line is changed in the process unless there
55 * is only one argument).
56 *
57 * #argv is terminated by a NULL after the last argument pointer.
58 *
59 * At most CONFIG_SYS_MAXARGS arguments are permited - if there are more
60 * than that then an error is printed, and this function returns
61 * CONFIG_SYS_MAXARGS, with argv[] set up to that point.
62 *
63 * @line: Command line to parse
64 * @args: Array to hold arguments
65 * @return number of arguments
66 */
67 //int cli_simple_parse_line(char *line, char *argv[]);
68
69 /*
70 * Run a command.
71 *
72 * @param cmd Command to run
73 * @param flag Execution flags (CMD_FLAG_...)
74 * @return 0 on success, or != 0 on error.
75 */
76 int run_command(const char *cmd, int flag);
77
78 int run_command_list(const char *cmd, int len);
79
80
81 #endif /* CLI_H */