]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
move CLI prototypes to cli.h and add comments
authorSimon Glass <sjg@chromium.org>
Fri, 11 Apr 2014 02:01:25 +0000 (20:01 -0600)
committerTom Rini <trini@ti.com>
Thu, 29 May 2014 21:45:31 +0000 (17:45 -0400)
Move the CLI prototypes from common.h to cli.h as part of an effort to
reduce the size of common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 files changed:
board/ait/cam_enc_4xx/cam_enc_4xx.c
board/amcc/yucca/cmd_yucca.c
board/eltec/elppc/misc.c
board/eltec/mhpc/mhpc.c
board/hymod/hymod.c
board/hymod/input.c
common/cli_hush.c
common/cmd_bedbug.c
common/cmd_dcr.c
common/cmd_i2c.c
common/cmd_mem.c
common/cmd_nvedit.c
common/cmd_pci.c
common/main.c
common/menu.c
drivers/ddr/fsl/interactive.c
include/cli.h [new file with mode: 0644]
include/common.h

index b5cc3ed36356bcb51a46ebcea819ab4e8815eb71..7c26ba0059be3ea5fdeb07461a5106c031378959 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <errno.h>
 #include <linux/mtd/nand.h>
 #include <nand.h>
index dc78b73731596407c11efb463cac44ebd7364161..3257c29871cc99d75cb96a9560e3a41e3b4e8b98 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include "yucca.h"
 #include <i2c.h>
index d80eaba2d0a4d7e362af254650da05f44475c6a5..70d1f9a17fa95ec1774b40f1b8e14dc0cbf37382 100644 (file)
@@ -7,6 +7,7 @@
 
 /* includes */
 #include <common.h>
+#include <cli.h>
 #include <linux/ctype.h>
 #include <pci.h>
 #include <net.h>
index f3f564ffe4ba5ca9b59691a47b4673ad4f494946..ff9e0ab972395ba71e928d679ee5363cf9e248cb 100644 (file)
@@ -14,6 +14,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <cli.h>
 #include <linux/ctype.h>
 #include <commproc.h>
 #include "mpc8xx.h"
index 5fec914f5ad525c6f519b10fd315af3670d980f7..ea49e26dd2f983b40178176e6335dbe228620b19 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <mpc8260.h>
 #include <mpc8260_irq.h>
 #include <ioports.h>
index 184902cde5764b151ddab88cea4dd62384023ae9..23d3f19e3e94c59b6d464a9c6172b307c8ba79cb 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 
 int
 hymod_get_serno (const char *prompt)
index 012004aea540bba0a2ed89d164e3befcf9b9ad36..91e495690c9a973b2f301bafadca4c7999a6a35f 100644 (file)
@@ -79,6 +79,7 @@
 #include <malloc.h>         /* malloc, free, realloc*/
 #include <linux/ctype.h>    /* isalpha, isdigit */
 #include <common.h>        /* readline */
+#include <cli.h>
 #include <cli_hush.h>
 #include <command.h>        /* find_cmd */
 #ifndef CONFIG_SYS_PROMPT_HUSH_PS2
index 77b6e3e88e4b72aefdf55ef79cee6c6ffa6b4428..f1a70ef202810bd90f8839aa2d304267af2acfcd 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <linux/ctype.h>
 #include <net.h>
index 896f79f416c3a10128525cb91576fc285945dfd1..c5bcb8b89dc63f4c6ecc661b86da90898be14f72 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <config.h>
 #include <command.h>
 
index ebce7d4c3c05162a675bb4a01fdec15dd287e172..8ccde68110e16c31f3eaa2be849ca3cc133e2446 100644 (file)
@@ -66,6 +66,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <edid.h>
 #include <environment.h>
index 5b03c2d5b10b97777ef972a365262eae71fe0c9a..4b8738b4f036a9e12cea34962085b156f3e42380 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #ifdef CONFIG_HAS_DATAFLASH
 #include <dataflash.h>
index f4e306ceba9a3b67fa2319a6668ff35aa9410978..a1e98c6d9553ba3f80954796dcd53169b21988e5 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <environment.h>
 #include <search.h>
index d3e7c089b00ab5f4b06d48a0fedd5746cd388cc7..ddda207e584109ea9c8025587529f21067fe8321 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <asm/processor.h>
 #include <asm/io.h>
index a80fb7c3441cda6ef3318dad72cf000126502cdf..6d1c3a9fadb0da00f93541464beabd5a7db8b41c 100644 (file)
@@ -12,6 +12,7 @@
 /* #define     DEBUG   */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <fdtdec.h>
 #include <cli_hush.h>
index ba393adc32cbf1e3c26f1e6dfcc8f247fd43691a..88d4697254e9bd85fceab6bd55c49730fefc24d7 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <malloc.h>
 #include <errno.h>
 #include <linux/list.h>
index cfe1e1f55aa613035e30ef7818e0daa68c479583..4e2120f7c457ac2d26fca088e7fc48bd9545c3ff 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <linux/ctype.h>
 #include <asm/types.h>
 #include <asm/io.h>
diff --git a/include/cli.h b/include/cli.h
new file mode 100644 (file)
index 0000000..0075bd4
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * (C) Copyright 2014 Google, Inc
+ * Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __CLI_H
+#define __CLI_H
+
+/**
+ * Go into the command loop
+ *
+ * This will return if we get a timeout waiting for a command. See
+ * CONFIG_BOOT_RETRY_TIME.
+ */
+void cli_loop(void);
+
+/**
+ * cli_simple_run_command() - Execute a command with the simple CLI
+ *
+ * @cmd:       String containing the command to execute
+ * @flag       Flag value - see CMD_FLAG_...
+ * @return 1  - command executed, repeatable
+ *     0  - command executed but not repeatable, interrupted commands are
+ *          always considered not repeatable
+ *     -1 - not executed (unrecognized, bootd recursion or too many args)
+ *           (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is
+ *           considered unrecognized)
+ */
+int cli_simple_run_command(const char *cmd, int flag);
+
+/**
+ * cli_simple_run_command_list() - Execute a list of command
+ *
+ * The commands should be separated by ; or \n and will be executed
+ * by the built-in parser.
+ *
+ * This function cannot take a const char * for the command, since if it
+ * finds newlines in the string, it replaces them with \0.
+ *
+ * @param cmd  String containing list of commands
+ * @param flag Execution flags (CMD_FLAG_...)
+ * @return 0 on success, or != 0 on error.
+ */
+int cli_simple_run_command_list(char *cmd, int flag);
+
+/**
+ * cli_readline() - read a line into the console_buffer
+ *
+ * This is a convenience function which calls cli_readline_into_buffer().
+ *
+ * @prompt: Prompt to display
+ * @return command line length excluding terminator, or -ve on error
+ */
+int readline(const char *const prompt);
+
+/**
+ * readline_into_buffer() - read a line into a buffer
+ *
+ * Display the prompt, then read a command line into @buffer. The
+ * maximum line length is CONFIG_SYS_CBSIZE including a \0 terminator, which
+ * will always be added.
+ *
+ * The command is echoed as it is typed. Command editing is supported if
+ * CONFIG_CMDLINE_EDITING is defined. Tab auto-complete is supported if
+ * CONFIG_AUTO_COMPLETE is defined. If CONFIG_BOOT_RETRY_TIME is defined,
+ * then a timeout will be applied.
+ *
+ * If CONFIG_BOOT_RETRY_TIME is defined and retry_time >= 0,
+ * time out when time goes past endtime (timebase time in ticks).
+ *
+ * @prompt:    Prompt to display
+ * @buffer:    Place to put the line that is entered
+ * @timeout:   Timeout in milliseconds, 0 if none
+ * @return command line length excluding terminator, or -ve on error: of the
+ * timeout is exceeded (either CONFIG_BOOT_RETRY_TIME or the timeout
+ * parameter), then -2 is returned. If a break is detected (Ctrl-C) then
+ * -1 is returned.
+ */
+int readline_into_buffer(const char *const prompt, char *buffer, int timeout);
+
+/**
+ * parse_line() - split a command line down into separate arguments
+ *
+ * The argv[] array is filled with pointers into @line, and each argument
+ * is terminated by \0 (i.e. @line is changed in the process unless there
+ * is only one argument).
+ *
+ * #argv is terminated by a NULL after the last argument pointer.
+ *
+ * At most CONFIG_SYS_MAXARGS arguments are permited - if there are more
+ * than that then an error is printed, and this function returns
+ * CONFIG_SYS_MAXARGS, with argv[] set up to that point.
+ *
+ * @line:      Command line to parse
+ * @args:      Array to hold arguments
+ * @return number of arguments
+ */
+int parse_line(char *line, char *argv[]);
+
+#endif
index 232136c0cd1340b8c7bd941a67996ee9c58e2e1c..75cb525f3ecfea7bb17284be42e4cebb887870b3 100644 (file)
@@ -286,10 +286,6 @@ int run_command(const char *cmd, int flag);
  * @return 0 on success, or != 0 on error.
  */
 int run_command_list(const char *cmd, int len, int flag);
-int    readline        (const char *const prompt);
-int    readline_into_buffer(const char *const prompt, char *buffer,
-                       int timeout);
-int    parse_line (char *, char *[]);
 void   init_cmd_timeout(void);
 void   reset_cmd_timeout(void);
 extern char console_buffer[];