]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
Add cli_ prefix to readline functions
authorSimon Glass <sjg@chromium.org>
Fri, 11 Apr 2014 02:01:27 +0000 (20:01 -0600)
committerTom Rini <trini@ti.com>
Thu, 29 May 2014 21:45:31 +0000 (17:45 -0400)
This makes it clear where the code resides.

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/cli_readline.c
common/cli_simple.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/menu.c
drivers/ddr/fsl/interactive.c
include/cli.h

index 7c26ba0059be3ea5fdeb07461a5106c031378959..9aa1d7aece41f56fa1451f18e23274b9a84eaeba 100644 (file)
@@ -777,7 +777,7 @@ static void ait_menu_read_env(char *name)
 
        sprintf(output, "%s old: %s value: ", name, getenv(name));
        memset(cbuf, 0, CONFIG_SYS_CBSIZE);
-       readret = readline_into_buffer(output, cbuf, 0);
+       readret = cli_readline_into_buffer(output, cbuf, 0);
 
        if (readret >= 0) {
                ret = setenv(name, cbuf);
index 3257c29871cc99d75cb96a9560e3a41e3b4e8b98..c1724bf03480819f256f3c7003a6d864c1be887a 100644 (file)
@@ -52,7 +52,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
 
        do {
                printf("enter sys clock frequency 33 or 66 MHz or quit to abort\n");
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
@@ -75,7 +75,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
                        printf("enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n");
 #endif
                }
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
@@ -119,7 +119,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
                                printf("enter plb clock frequency 133, 166 MHz or quit to abort\n");
 
 #endif
-                       nbytes = readline (" ? ");
+                       nbytes = cli_readline(" ? ");
 
                        if (strcmp(console_buffer, "quit") == 0)
                                return 0;
@@ -143,7 +143,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
 
        do {
                printf("enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n");
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
@@ -164,13 +164,13 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
        printf("Pci-X clk = %s MHz\n", pcixClock);
 
        do {
-               printf("\npress [y] to write I2C bootstrap \n");
-               printf("or [n] to abort.  \n");
-               printf("Don't forget to set board switches \n");
-               printf("according to your choice before re-starting \n");
-               printf("(refer to 440spe_uboot_kit_um_1_01.pdf) \n");
+               printf("\npress [y] to write I2C bootstrap\n");
+               printf("or [n] to abort.\n");
+               printf("Don't forget to set board switches\n");
+               printf("according to your choice before re-starting\n");
+               printf("(refer to 440spe_uboot_kit_um_1_01.pdf)\n");
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (strcmp(console_buffer, "n") == 0)
                        return 0;
 
index 70d1f9a17fa95ec1774b40f1b8e14dc0cbf37382..2acf80047fe0f98b197a9eb9b36fe46b4a0fd718 100644 (file)
@@ -114,7 +114,7 @@ int misc_init_r (void)
                printf ("Press key:\n  <c> to copy current revision info to nvram.\n");
                printf ("  <r> to reenter revision info.\n");
                printf ("=> ");
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        switch ((char) toupper (console_buffer[0])) {
                        case 'C':
                                copyNv = 1;
@@ -131,7 +131,7 @@ int misc_init_r (void)
                memcpy (buf, &eerev.revision[0][0], 14);        /* save all revision info */
                printf ("Enter revision number (0-9): %c  ",
                        eerev.revision[0][0]);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        eerev.revision[0][0] =
                                (char) toupper (console_buffer[0]);
                        memcpy (&eerev.revision[1][0], buf, 12);        /* shift rest of rev info */
@@ -139,14 +139,14 @@ int misc_init_r (void)
 
                printf ("Enter revision character (A-Z): %c  ",
                        eerev.revision[0][1]);
-               if (1 == readline (NULL)) {
+               if (1 == cli_readline(NULL)) {
                        eerev.revision[0][1] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter board name (V-XXXX-XXXX): %s  ",
                        (char *) &eerev.board);
-               if (11 == readline (NULL)) {
+               if (11 == cli_readline(NULL)) {
                        for (i = 0; i < 11; i++)
                                eerev.board[i] =
                                        (char) toupper (console_buffer[i]);
@@ -154,14 +154,14 @@ int misc_init_r (void)
                }
 
                printf ("Enter serial number: %s ", (char *) &eerev.serial);
-               if (6 == readline (NULL)) {
+               if (6 == cli_readline(NULL)) {
                        for (i = 0; i < 6; i++)
                                eerev.serial[i] = console_buffer[i];
                        eerev.serial[6] = '\0';
                }
 
                printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x  ", eerev.etheraddr[0], eerev.etheraddr[1], eerev.etheraddr[2], eerev.etheraddr[3], eerev.etheraddr[4], eerev.etheraddr[5]);
-               if (12 == readline (NULL)) {
+               if (12 == cli_readline(NULL)) {
                        for (i = 0; i < 12; i += 2)
                                eerev.etheraddr[i >> 1] =
                                        (char) (16 *
@@ -176,7 +176,7 @@ int misc_init_r (void)
                l = strlen ((char *) &eerev.text);
                printf ("Add to text section (max 64 chr): %s ",
                        (char *) &eerev.text);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        for (i = l; i < 63; i++)
                                eerev.text[i] = console_buffer[i - l];
                        eerev.text[63] = '\0';
index ff9e0ab972395ba71e928d679ee5363cf9e248cb..5781b2a54f3888203df4e4dbc077ffd24ca07c26 100644 (file)
@@ -147,21 +147,21 @@ int misc_init_r (void)
        if (strncmp ((char *) &mhpcRevInfo.board[2], "MHPC", 4) != 0) {
                printf ("Enter revision number (0-9): %c  ",
                        mhpcRevInfo.revision[0]);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        mhpcRevInfo.revision[0] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter revision character (A-Z): %c  ",
                        mhpcRevInfo.revision[1]);
-               if (1 == readline (NULL)) {
+               if (1 == cli_readline(NULL)) {
                        mhpcRevInfo.revision[1] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter board name (V-XXXX-XXXX): %s  ",
                        (char *) &mhpcRevInfo.board);
-               if (11 == readline (NULL)) {
+               if (11 == cli_readline(NULL)) {
                        for (i = 0; i < 11; i++) {
                                mhpcRevInfo.board[i] =
                                        (char) toupper (console_buffer[i]);
@@ -178,7 +178,7 @@ int misc_init_r (void)
                do {
                        printf ("\nEnter sensor number (0-255): %d  ",
                                (int) mhpcRevInfo.sensor);
-                       if (0 != readline (NULL)) {
+                       if (0 != cli_readline(NULL)) {
                                mhpcRevInfo.sensor =
                                        (unsigned char)
                                        simple_strtoul (console_buffer, NULL,
@@ -188,7 +188,7 @@ int misc_init_r (void)
 
                printf ("Enter serial number: %s ",
                        (char *) &mhpcRevInfo.serial);
-               if (6 == readline (NULL)) {
+               if (6 == cli_readline(NULL)) {
                        for (i = 0; i < 6; i++) {
                                mhpcRevInfo.serial[i] = console_buffer[i];
                        }
@@ -196,7 +196,7 @@ int misc_init_r (void)
                }
 
                printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x  ", mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1], mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3], mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
-               if (12 == readline (NULL)) {
+               if (12 == cli_readline(NULL)) {
                        for (i = 0; i < 12; i += 2) {
                                mhpcRevInfo.etheraddr[i >> 1] =
                                        (char) (16 *
index ea49e26dd2f983b40178176e6335dbe228620b19..55ffd676cf5907946c3ca1bd5eff611dca38f3dd 100644 (file)
@@ -416,7 +416,7 @@ last_stage_init (void)
 
 #ifdef CONFIG_BOOT_RETRY_TIME
        /*
-        * we use the readline () function, but we also want
+        * we use the cli_readline() function, but we also want
         * command timeout enabled
         */
        init_cmd_timeout ();
index 23d3f19e3e94c59b6d464a9c6172b307c8ba79cb..59ad6aa3ed92a97f9369111de6d4ef4719d43048 100644 (file)
@@ -19,7 +19,7 @@ hymod_get_serno (const char *prompt)
                reset_cmd_timeout ();
 #endif
 
-               n = readline (prompt);
+               n = cli_readline(prompt);
 
                if (n < 0)
                        return (n);
@@ -47,7 +47,7 @@ hymod_get_ethaddr (void)
                reset_cmd_timeout ();
 #endif
 
-               n = readline ("Enter board ethernet address: ");
+               n = cli_readline("Enter board ethernet address: ");
 
                if (n < 0)
                        return (n);
index 91e495690c9a973b2f301bafadca4c7999a6a35f..a612bfbef51e7b806ea22c19c6288ef256b12eb0 100644 (file)
@@ -1007,9 +1007,9 @@ static void get_user_input(struct in_str *i)
 #endif
        i->__promptme = 1;
        if (i->promptmode == 1) {
-               n = readline(CONFIG_SYS_PROMPT);
+               n = cli_readline(CONFIG_SYS_PROMPT);
        } else {
-               n = readline(CONFIG_SYS_PROMPT_HUSH_PS2);
+               n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
        }
 #ifdef CONFIG_BOOT_RETRY_TIME
        if (n == -2) {
index cea0b7c81b8f9eb327065844de1666b002de7890..df446b8c8362e998c3279d799fd2a3adcbb10f58 100644 (file)
@@ -484,7 +484,7 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len,
 
 /****************************************************************************/
 
-int readline(const char *const prompt)
+int cli_readline(const char *const prompt)
 {
        /*
         * If console_buffer isn't 0-length the user will be prompted to modify
@@ -492,11 +492,12 @@ int readline(const char *const prompt)
         */
        console_buffer[0] = '\0';
 
-       return readline_into_buffer(prompt, console_buffer, 0);
+       return cli_readline_into_buffer(prompt, console_buffer, 0);
 }
 
 
-int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
+int cli_readline_into_buffer(const char *const prompt, char *buffer,
+                            int timeout)
 {
        char *p = buffer;
 #ifdef CONFIG_CMDLINE_EDITING
index 0610615ea5ab05ea82efa7e172dd5fb9a23c5e0b..3039cfcca1fe73d0a0615a64133916cd092742cd 100644 (file)
@@ -19,7 +19,7 @@
        debug_cond(DEBUG_PARSER, fmt, ##args)
 
 
-int parse_line(char *line, char *argv[])
+int cli_simple_parse_line(char *line, char *argv[])
 {
        int nargs = 0;
 
@@ -238,7 +238,7 @@ int cli_simple_run_command(const char *cmd, int flag)
                process_macros(token, finaltoken);
 
                /* Extract arguments */
-               argc = parse_line(finaltoken, argv);
+               argc = cli_simple_parse_line(finaltoken, argv);
                if (argc == 0) {
                        rc = -1;        /* no command at all */
                        continue;
@@ -272,7 +272,7 @@ void cli_loop(void)
                        reset_cmd_timeout();
                }
 #endif
-               len = readline(CONFIG_SYS_PROMPT);
+               len = cli_readline(CONFIG_SYS_PROMPT);
 
                flag = 0;       /* assume no special flags for now */
                if (len > 0)
index f1a70ef202810bd90f8839aa2d304267af2acfcd..bdcf712d111077a5b12222296686b403b0fc8dee 100644 (file)
@@ -20,7 +20,7 @@ extern int run_command __P ((const char *, int));
 ulong dis_last_addr = 0;       /* Last address disassembled   */
 ulong dis_last_len = 20;       /* Default disassembler length */
 CPU_DEBUG_CTX bug_ctx;         /* Bedbug context structure    */
-\f
+
 
 /* ======================================================================
  * U-Boot's puts function does not append a newline, so the bedbug stuff
@@ -34,7 +34,7 @@ int bedbug_puts (const char *str)
        printf ("%s\r\n", str);
        return 0;
 }                              /* bedbug_puts */
-\f
+
 
 
 /* ======================================================================
@@ -66,7 +66,7 @@ void bedbug_init (void)
 
        return;
 }                              /* bedbug_init */
-\f
+
 
 
 /* ======================================================================
@@ -107,7 +107,7 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
            "disassemble memory",
            "ds <address> [# instructions]");
-\f
+
 /* ======================================================================
  * Entry point from the interpreter to the assembler.  Assembles
  * instructions in consecutive memory locations until a '.' (period) is
@@ -135,7 +135,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                        F_RADHEX);
 
                sprintf (prompt, "%08lx:    ", mem_addr);
-               readline (prompt);
+               cli_readline(prompt);
 
                if (console_buffer[0] && strcmp (console_buffer, ".")) {
                        if ((instr =
@@ -157,7 +157,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
 U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
            "assemble memory", "as <address>");
-\f
+
 /* ======================================================================
  * Used to set a break point from the interpreter.  Simply calls into the
  * CPU-specific break point set routine.
@@ -178,7 +178,7 @@ U_BOOT_CMD (break, 3, 0, do_bedbug_break,
            "break <address> - Break at an address\n"
            "break off <bp#> - Disable breakpoint.\n"
            "break show      - List breakpoints.");
-\f
+
 /* ======================================================================
  * Called from the debug interrupt routine.  Simply calls the CPU-specific
  * breakpoint handling routine.
@@ -193,7 +193,7 @@ void do_bedbug_breakpoint (struct pt_regs *regs)
 
        return;
 }                              /* do_bedbug_breakpoint */
-\f
+
 
 
 /* ======================================================================
@@ -226,7 +226,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
 
        /* A miniature main loop */
        while (bug_ctx.stopped) {
-               len = readline (prompt_str);
+               len = cli_readline(prompt_str);
 
                flag = 0;       /* assume no special flags for now */
 
@@ -251,7 +251,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
 
        return;
 }                              /* bedbug_main_loop */
-\f
+
 
 
 /* ======================================================================
@@ -275,7 +275,7 @@ int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv
 U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
            "continue from a breakpoint",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to continue to the next instruction, stepping into
  * subroutines.  Works by calling the find_next_addr() routine to compute
@@ -306,7 +306,7 @@ int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (step, 1, 1, do_bedbug_step,
            "single step execution.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to continue to the next instruction, stepping over
  * subroutines.  Works by calling the find_next_addr() routine to compute
@@ -337,7 +337,7 @@ int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (next, 1, 1, do_bedbug_next,
            "single step execution, stepping over subroutines.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to print the current stack.  This assumes an EABI
  * architecture, so it starts with GPR R1 and works back up the stack.
@@ -382,7 +382,7 @@ int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
            "Print the running stack.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to dump the registers.  Calls the CPU-specific
  * show registers routine.
index c5bcb8b89dc63f4c6ecc661b86da90898be14f72..4fddd804abd9bbad5b3c682dbe5211151a47b3a0 100644 (file)
@@ -63,7 +63,7 @@ int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        do {
                value = get_dcr (dcrn);
                printf ("%04x: %08lx", dcrn, value);
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
index 8ccde68110e16c31f3eaa2be849ca3cc133e2446..7158b5a2db1164c81afd2f560a92bc1293781c0f 100644 (file)
@@ -613,7 +613,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                                printf(" %08lx", data);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
index 4b8738b4f036a9e12cea34962085b156f3e42380..15a4b84efdc95f1f8374673fadac592e4fa64124 100644 (file)
@@ -1150,7 +1150,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
                else
                        printf(" %02x", *((u8 *)ptr));
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
                        /* <CR> pressed as only input, don't modify current
                         * location and move to next. "-" pressed will go back.
index a1e98c6d9553ba3f80954796dcd53169b21988e5..e6c33956e7b5c493b62128aa5ce6c06ff67bb38a 100644 (file)
@@ -409,7 +409,7 @@ int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
 
        /* prompt for input */
-       len = readline(message);
+       len = cli_readline(message);
 
        if (size < len)
                console_buffer[size] = '\0';
@@ -592,7 +592,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
        else
                buffer[0] = '\0';
 
-       if (readline_into_buffer("edit: ", buffer, 0) < 0)
+       if (cli_readline_into_buffer("edit: ", buffer, 0) < 0)
                return 1;
 
        return setenv(argv[1], buffer);
index ddda207e584109ea9c8025587529f21067fe8321..1ed55cedb16e13800b8b08c7b7d7e6cfdc260c02 100644 (file)
@@ -346,7 +346,7 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
                        printf(" %02x", val1);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
                        /* <CR> pressed as only input, don't modify current
                         * location and move to next. "-" pressed will go back.
index 88d4697254e9bd85fceab6bd55c49730fefc24d7..94afeb290098dc4b1356496ade659d1985fcd143 100644 (file)
@@ -197,8 +197,9 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)
                menu_display(m);
 
                if (!m->item_choice) {
-                       readret = readline_into_buffer("Enter choice: ", cbuf,
-                                       m->timeout / 10);
+                       readret = cli_readline_into_buffer("Enter choice: ",
+                                                          cbuf,
+                                                          m->timeout / 10);
 
                        if (readret >= 0) {
                                choice_item = menu_item_by_key(m, cbuf);
index 4e2120f7c457ac2d26fca088e7fc48bd9545c3ff..c9f86302d776343f3fbfe5cbe56b11f15805d140 100644 (file)
@@ -1865,11 +1865,12 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
                } else {
                        /*
                         * No need to worry for buffer overflow here in
-                        * this function;  readline() maxes out at CFG_CBSIZE
+                        * this function;  cli_readline() maxes out at
+                        * CFG_CBSIZE
                         */
-                       readline_into_buffer(prompt, buffer, 0);
+                       cli_readline_into_buffer(prompt, buffer, 0);
                }
-               argc = parse_line(buffer, argv);
+               argc = cli_simple_parse_line(buffer, argv);
                if (argc == 0)
                        continue;
 
index b04539f3202f855f42067f70d281b21943b6789a..61f8aee4add979f5af97e7e2e8c29e1676f15270 100644 (file)
@@ -53,7 +53,7 @@ int cli_simple_run_command_list(char *cmd, int flag);
  * @prompt: Prompt to display
  * @return command line length excluding terminator, or -ve on error
  */
-int readline(const char *const prompt);
+int cli_readline(const char *const prompt);
 
 /**
  * readline_into_buffer() - read a line into a buffer
@@ -78,7 +78,8 @@ int readline(const char *const prompt);
  * 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);
+int cli_readline_into_buffer(const char *const prompt, char *buffer,
+                               int timeout);
 
 /**
  * parse_line() - split a command line down into separate arguments
@@ -97,7 +98,7 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout);
  * @args:      Array to hold arguments
  * @return number of arguments
  */
-int parse_line(char *line, char *argv[]);
+int cli_simple_parse_line(char *line, char *argv[]);
 
 /** bootretry_dont_retry() - Indicate that we should not retry the boot */
 void bootretry_dont_retry(void);