Commit e1bf824dfd6881f6f633238c275bfa1e5d83c433

Authored by Simon Glass
Committed by Tom Rini
1 parent 6493ccc7cf

Add cli_ prefix to readline functions

This makes it clear where the code resides.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 18 changed files with 67 additions and 63 deletions Side-by-side Diff

board/ait/cam_enc_4xx/cam_enc_4xx.c
... ... @@ -777,7 +777,7 @@
777 777  
778 778 sprintf(output, "%s old: %s value: ", name, getenv(name));
779 779 memset(cbuf, 0, CONFIG_SYS_CBSIZE);
780   - readret = readline_into_buffer(output, cbuf, 0);
  780 + readret = cli_readline_into_buffer(output, cbuf, 0);
781 781  
782 782 if (readret >= 0) {
783 783 ret = setenv(name, cbuf);
board/amcc/yucca/cmd_yucca.c
... ... @@ -52,7 +52,7 @@
52 52  
53 53 do {
54 54 printf("enter sys clock frequency 33 or 66 MHz or quit to abort\n");
55   - nbytes = readline (" ? ");
  55 + nbytes = cli_readline(" ? ");
56 56  
57 57 if (strcmp(console_buffer, "quit") == 0)
58 58 return 0;
... ... @@ -75,7 +75,7 @@
75 75 printf("enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n");
76 76 #endif
77 77 }
78   - nbytes = readline (" ? ");
  78 + nbytes = cli_readline(" ? ");
79 79  
80 80 if (strcmp(console_buffer, "quit") == 0)
81 81 return 0;
... ... @@ -119,7 +119,7 @@
119 119 printf("enter plb clock frequency 133, 166 MHz or quit to abort\n");
120 120  
121 121 #endif
122   - nbytes = readline (" ? ");
  122 + nbytes = cli_readline(" ? ");
123 123  
124 124 if (strcmp(console_buffer, "quit") == 0)
125 125 return 0;
... ... @@ -143,7 +143,7 @@
143 143  
144 144 do {
145 145 printf("enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n");
146   - nbytes = readline (" ? ");
  146 + nbytes = cli_readline(" ? ");
147 147  
148 148 if (strcmp(console_buffer, "quit") == 0)
149 149 return 0;
150 150  
... ... @@ -164,13 +164,13 @@
164 164 printf("Pci-X clk = %s MHz\n", pcixClock);
165 165  
166 166 do {
167   - printf("\npress [y] to write I2C bootstrap \n");
168   - printf("or [n] to abort. \n");
169   - printf("Don't forget to set board switches \n");
170   - printf("according to your choice before re-starting \n");
171   - printf("(refer to 440spe_uboot_kit_um_1_01.pdf) \n");
  167 + printf("\npress [y] to write I2C bootstrap\n");
  168 + printf("or [n] to abort.\n");
  169 + printf("Don't forget to set board switches\n");
  170 + printf("according to your choice before re-starting\n");
  171 + printf("(refer to 440spe_uboot_kit_um_1_01.pdf)\n");
172 172  
173   - nbytes = readline (" ? ");
  173 + nbytes = cli_readline(" ? ");
174 174 if (strcmp(console_buffer, "n") == 0)
175 175 return 0;
176 176  
board/eltec/elppc/misc.c
... ... @@ -114,7 +114,7 @@
114 114 printf ("Press key:\n <c> to copy current revision info to nvram.\n");
115 115 printf (" <r> to reenter revision info.\n");
116 116 printf ("=> ");
117   - if (0 != readline (NULL)) {
  117 + if (0 != cli_readline(NULL)) {
118 118 switch ((char) toupper (console_buffer[0])) {
119 119 case 'C':
120 120 copyNv = 1;
... ... @@ -131,7 +131,7 @@
131 131 memcpy (buf, &eerev.revision[0][0], 14); /* save all revision info */
132 132 printf ("Enter revision number (0-9): %c ",
133 133 eerev.revision[0][0]);
134   - if (0 != readline (NULL)) {
  134 + if (0 != cli_readline(NULL)) {
135 135 eerev.revision[0][0] =
136 136 (char) toupper (console_buffer[0]);
137 137 memcpy (&eerev.revision[1][0], buf, 12); /* shift rest of rev info */
138 138  
... ... @@ -139,14 +139,14 @@
139 139  
140 140 printf ("Enter revision character (A-Z): %c ",
141 141 eerev.revision[0][1]);
142   - if (1 == readline (NULL)) {
  142 + if (1 == cli_readline(NULL)) {
143 143 eerev.revision[0][1] =
144 144 (char) toupper (console_buffer[0]);
145 145 }
146 146  
147 147 printf ("Enter board name (V-XXXX-XXXX): %s ",
148 148 (char *) &eerev.board);
149   - if (11 == readline (NULL)) {
  149 + if (11 == cli_readline(NULL)) {
150 150 for (i = 0; i < 11; i++)
151 151 eerev.board[i] =
152 152 (char) toupper (console_buffer[i]);
153 153  
... ... @@ -154,14 +154,14 @@
154 154 }
155 155  
156 156 printf ("Enter serial number: %s ", (char *) &eerev.serial);
157   - if (6 == readline (NULL)) {
  157 + if (6 == cli_readline(NULL)) {
158 158 for (i = 0; i < 6; i++)
159 159 eerev.serial[i] = console_buffer[i];
160 160 eerev.serial[6] = '\0';
161 161 }
162 162  
163 163 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]);
164   - if (12 == readline (NULL)) {
  164 + if (12 == cli_readline(NULL)) {
165 165 for (i = 0; i < 12; i += 2)
166 166 eerev.etheraddr[i >> 1] =
167 167 (char) (16 *
... ... @@ -176,7 +176,7 @@
176 176 l = strlen ((char *) &eerev.text);
177 177 printf ("Add to text section (max 64 chr): %s ",
178 178 (char *) &eerev.text);
179   - if (0 != readline (NULL)) {
  179 + if (0 != cli_readline(NULL)) {
180 180 for (i = l; i < 63; i++)
181 181 eerev.text[i] = console_buffer[i - l];
182 182 eerev.text[63] = '\0';
board/eltec/mhpc/mhpc.c
... ... @@ -147,21 +147,21 @@
147 147 if (strncmp ((char *) &mhpcRevInfo.board[2], "MHPC", 4) != 0) {
148 148 printf ("Enter revision number (0-9): %c ",
149 149 mhpcRevInfo.revision[0]);
150   - if (0 != readline (NULL)) {
  150 + if (0 != cli_readline(NULL)) {
151 151 mhpcRevInfo.revision[0] =
152 152 (char) toupper (console_buffer[0]);
153 153 }
154 154  
155 155 printf ("Enter revision character (A-Z): %c ",
156 156 mhpcRevInfo.revision[1]);
157   - if (1 == readline (NULL)) {
  157 + if (1 == cli_readline(NULL)) {
158 158 mhpcRevInfo.revision[1] =
159 159 (char) toupper (console_buffer[0]);
160 160 }
161 161  
162 162 printf ("Enter board name (V-XXXX-XXXX): %s ",
163 163 (char *) &mhpcRevInfo.board);
164   - if (11 == readline (NULL)) {
  164 + if (11 == cli_readline(NULL)) {
165 165 for (i = 0; i < 11; i++) {
166 166 mhpcRevInfo.board[i] =
167 167 (char) toupper (console_buffer[i]);
... ... @@ -178,7 +178,7 @@
178 178 do {
179 179 printf ("\nEnter sensor number (0-255): %d ",
180 180 (int) mhpcRevInfo.sensor);
181   - if (0 != readline (NULL)) {
  181 + if (0 != cli_readline(NULL)) {
182 182 mhpcRevInfo.sensor =
183 183 (unsigned char)
184 184 simple_strtoul (console_buffer, NULL,
... ... @@ -188,7 +188,7 @@
188 188  
189 189 printf ("Enter serial number: %s ",
190 190 (char *) &mhpcRevInfo.serial);
191   - if (6 == readline (NULL)) {
  191 + if (6 == cli_readline(NULL)) {
192 192 for (i = 0; i < 6; i++) {
193 193 mhpcRevInfo.serial[i] = console_buffer[i];
194 194 }
... ... @@ -196,7 +196,7 @@
196 196 }
197 197  
198 198 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]);
199   - if (12 == readline (NULL)) {
  199 + if (12 == cli_readline(NULL)) {
200 200 for (i = 0; i < 12; i += 2) {
201 201 mhpcRevInfo.etheraddr[i >> 1] =
202 202 (char) (16 *
... ... @@ -416,7 +416,7 @@
416 416  
417 417 #ifdef CONFIG_BOOT_RETRY_TIME
418 418 /*
419   - * we use the readline () function, but we also want
  419 + * we use the cli_readline() function, but we also want
420 420 * command timeout enabled
421 421 */
422 422 init_cmd_timeout ();
... ... @@ -19,7 +19,7 @@
19 19 reset_cmd_timeout ();
20 20 #endif
21 21  
22   - n = readline (prompt);
  22 + n = cli_readline(prompt);
23 23  
24 24 if (n < 0)
25 25 return (n);
... ... @@ -47,7 +47,7 @@
47 47 reset_cmd_timeout ();
48 48 #endif
49 49  
50   - n = readline ("Enter board ethernet address: ");
  50 + n = cli_readline("Enter board ethernet address: ");
51 51  
52 52 if (n < 0)
53 53 return (n);
... ... @@ -1007,9 +1007,9 @@
1007 1007 #endif
1008 1008 i->__promptme = 1;
1009 1009 if (i->promptmode == 1) {
1010   - n = readline(CONFIG_SYS_PROMPT);
  1010 + n = cli_readline(CONFIG_SYS_PROMPT);
1011 1011 } else {
1012   - n = readline(CONFIG_SYS_PROMPT_HUSH_PS2);
  1012 + n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
1013 1013 }
1014 1014 #ifdef CONFIG_BOOT_RETRY_TIME
1015 1015 if (n == -2) {
common/cli_readline.c
... ... @@ -484,7 +484,7 @@
484 484  
485 485 /****************************************************************************/
486 486  
487   -int readline(const char *const prompt)
  487 +int cli_readline(const char *const prompt)
488 488 {
489 489 /*
490 490 * If console_buffer isn't 0-length the user will be prompted to modify
491 491  
... ... @@ -492,11 +492,12 @@
492 492 */
493 493 console_buffer[0] = '\0';
494 494  
495   - return readline_into_buffer(prompt, console_buffer, 0);
  495 + return cli_readline_into_buffer(prompt, console_buffer, 0);
496 496 }
497 497  
498 498  
499   -int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
  499 +int cli_readline_into_buffer(const char *const prompt, char *buffer,
  500 + int timeout)
500 501 {
501 502 char *p = buffer;
502 503 #ifdef CONFIG_CMDLINE_EDITING
... ... @@ -19,7 +19,7 @@
19 19 debug_cond(DEBUG_PARSER, fmt, ##args)
20 20  
21 21  
22   -int parse_line(char *line, char *argv[])
  22 +int cli_simple_parse_line(char *line, char *argv[])
23 23 {
24 24 int nargs = 0;
25 25  
... ... @@ -238,7 +238,7 @@
238 238 process_macros(token, finaltoken);
239 239  
240 240 /* Extract arguments */
241   - argc = parse_line(finaltoken, argv);
  241 + argc = cli_simple_parse_line(finaltoken, argv);
242 242 if (argc == 0) {
243 243 rc = -1; /* no command at all */
244 244 continue;
... ... @@ -272,7 +272,7 @@
272 272 reset_cmd_timeout();
273 273 }
274 274 #endif
275   - len = readline(CONFIG_SYS_PROMPT);
  275 + len = cli_readline(CONFIG_SYS_PROMPT);
276 276  
277 277 flag = 0; /* assume no special flags for now */
278 278 if (len > 0)
... ... @@ -20,8 +20,8 @@
20 20 ulong dis_last_addr = 0; /* Last address disassembled */
21 21 ulong dis_last_len = 20; /* Default disassembler length */
22 22 CPU_DEBUG_CTX bug_ctx; /* Bedbug context structure */
23   -
24 23  
  24 +
25 25 /* ======================================================================
26 26 * U-Boot's puts function does not append a newline, so the bedbug stuff
27 27 * will use this for the output of the dis/assembler.
28 28  
... ... @@ -34,9 +34,9 @@
34 34 printf ("%s\r\n", str);
35 35 return 0;
36 36 } /* bedbug_puts */
37   -
38 37  
39 38  
  39 +
40 40 /* ======================================================================
41 41 * Initialize the bug_ctx structure used by the bedbug debugger. This is
42 42 * specific to the CPU since each has different debug registers and
43 43  
... ... @@ -66,9 +66,9 @@
66 66  
67 67 return;
68 68 } /* bedbug_init */
69   -
70 69  
71 70  
  71 +
72 72 /* ======================================================================
73 73 * Entry point from the interpreter to the disassembler. Repeated calls
74 74 * will resume from the last disassembled address.
... ... @@ -107,7 +107,7 @@
107 107 U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
108 108 "disassemble memory",
109 109 "ds <address> [# instructions]");
110   -
  110 +
111 111 /* ======================================================================
112 112 * Entry point from the interpreter to the assembler. Assembles
113 113 * instructions in consecutive memory locations until a '.' (period) is
... ... @@ -135,7 +135,7 @@
135 135 F_RADHEX);
136 136  
137 137 sprintf (prompt, "%08lx: ", mem_addr);
138   - readline (prompt);
  138 + cli_readline(prompt);
139 139  
140 140 if (console_buffer[0] && strcmp (console_buffer, ".")) {
141 141 if ((instr =
... ... @@ -157,7 +157,7 @@
157 157  
158 158 U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
159 159 "assemble memory", "as <address>");
160   -
  160 +
161 161 /* ======================================================================
162 162 * Used to set a break point from the interpreter. Simply calls into the
163 163 * CPU-specific break point set routine.
... ... @@ -178,7 +178,7 @@
178 178 "break <address> - Break at an address\n"
179 179 "break off <bp#> - Disable breakpoint.\n"
180 180 "break show - List breakpoints.");
181   -
  181 +
182 182 /* ======================================================================
183 183 * Called from the debug interrupt routine. Simply calls the CPU-specific
184 184 * breakpoint handling routine.
185 185  
... ... @@ -193,9 +193,9 @@
193 193  
194 194 return;
195 195 } /* do_bedbug_breakpoint */
196   -
197 196  
198 197  
  198 +
199 199 /* ======================================================================
200 200 * Called from the CPU-specific breakpoint handling routine. Enter a
201 201 * mini main loop until the stopped flag is cleared from the breakpoint
... ... @@ -226,7 +226,7 @@
226 226  
227 227 /* A miniature main loop */
228 228 while (bug_ctx.stopped) {
229   - len = readline (prompt_str);
  229 + len = cli_readline(prompt_str);
230 230  
231 231 flag = 0; /* assume no special flags for now */
232 232  
233 233  
... ... @@ -251,9 +251,9 @@
251 251  
252 252 return;
253 253 } /* bedbug_main_loop */
254   -
255 254  
256 255  
  256 +
257 257 /* ======================================================================
258 258 * Interpreter command to continue from a breakpoint. Just clears the
259 259 * stopped flag in the context so that the breakpoint routine will
... ... @@ -275,7 +275,7 @@
275 275 U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
276 276 "continue from a breakpoint",
277 277 "");
278   -
  278 +
279 279 /* ======================================================================
280 280 * Interpreter command to continue to the next instruction, stepping into
281 281 * subroutines. Works by calling the find_next_addr() routine to compute
... ... @@ -306,7 +306,7 @@
306 306 U_BOOT_CMD (step, 1, 1, do_bedbug_step,
307 307 "single step execution.",
308 308 "");
309   -
  309 +
310 310 /* ======================================================================
311 311 * Interpreter command to continue to the next instruction, stepping over
312 312 * subroutines. Works by calling the find_next_addr() routine to compute
... ... @@ -337,7 +337,7 @@
337 337 U_BOOT_CMD (next, 1, 1, do_bedbug_next,
338 338 "single step execution, stepping over subroutines.",
339 339 "");
340   -
  340 +
341 341 /* ======================================================================
342 342 * Interpreter command to print the current stack. This assumes an EABI
343 343 * architecture, so it starts with GPR R1 and works back up the stack.
... ... @@ -382,7 +382,7 @@
382 382 U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
383 383 "Print the running stack.",
384 384 "");
385   -
  385 +
386 386 /* ======================================================================
387 387 * Interpreter command to dump the registers. Calls the CPU-specific
388 388 * show registers routine.
... ... @@ -63,7 +63,7 @@
63 63 do {
64 64 value = get_dcr (dcrn);
65 65 printf ("%04x: %08lx", dcrn, value);
66   - nbytes = readline (" ? ");
  66 + nbytes = cli_readline(" ? ");
67 67 if (nbytes == 0) {
68 68 /*
69 69 * <CR> pressed as only input, don't modify current
... ... @@ -613,7 +613,7 @@
613 613 printf(" %08lx", data);
614 614 }
615 615  
616   - nbytes = readline (" ? ");
  616 + nbytes = cli_readline(" ? ");
617 617 if (nbytes == 0) {
618 618 /*
619 619 * <CR> pressed as only input, don't modify current
... ... @@ -1150,7 +1150,7 @@
1150 1150 else
1151 1151 printf(" %02x", *((u8 *)ptr));
1152 1152  
1153   - nbytes = readline (" ? ");
  1153 + nbytes = cli_readline(" ? ");
1154 1154 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1155 1155 /* <CR> pressed as only input, don't modify current
1156 1156 * location and move to next. "-" pressed will go back.
... ... @@ -409,7 +409,7 @@
409 409 return 1;
410 410  
411 411 /* prompt for input */
412   - len = readline(message);
  412 + len = cli_readline(message);
413 413  
414 414 if (size < len)
415 415 console_buffer[size] = '\0';
... ... @@ -592,7 +592,7 @@
592 592 else
593 593 buffer[0] = '\0';
594 594  
595   - if (readline_into_buffer("edit: ", buffer, 0) < 0)
  595 + if (cli_readline_into_buffer("edit: ", buffer, 0) < 0)
596 596 return 1;
597 597  
598 598 return setenv(argv[1], buffer);
... ... @@ -346,7 +346,7 @@
346 346 printf(" %02x", val1);
347 347 }
348 348  
349   - nbytes = readline (" ? ");
  349 + nbytes = cli_readline(" ? ");
350 350 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
351 351 /* <CR> pressed as only input, don't modify current
352 352 * location and move to next. "-" pressed will go back.
... ... @@ -197,8 +197,9 @@
197 197 menu_display(m);
198 198  
199 199 if (!m->item_choice) {
200   - readret = readline_into_buffer("Enter choice: ", cbuf,
201   - m->timeout / 10);
  200 + readret = cli_readline_into_buffer("Enter choice: ",
  201 + cbuf,
  202 + m->timeout / 10);
202 203  
203 204 if (readret >= 0) {
204 205 choice_item = menu_item_by_key(m, cbuf);
drivers/ddr/fsl/interactive.c
... ... @@ -1865,11 +1865,12 @@
1865 1865 } else {
1866 1866 /*
1867 1867 * No need to worry for buffer overflow here in
1868   - * this function; readline() maxes out at CFG_CBSIZE
  1868 + * this function; cli_readline() maxes out at
  1869 + * CFG_CBSIZE
1869 1870 */
1870   - readline_into_buffer(prompt, buffer, 0);
  1871 + cli_readline_into_buffer(prompt, buffer, 0);
1871 1872 }
1872   - argc = parse_line(buffer, argv);
  1873 + argc = cli_simple_parse_line(buffer, argv);
1873 1874 if (argc == 0)
1874 1875 continue;
1875 1876  
... ... @@ -53,7 +53,7 @@
53 53 * @prompt: Prompt to display
54 54 * @return command line length excluding terminator, or -ve on error
55 55 */
56   -int readline(const char *const prompt);
  56 +int cli_readline(const char *const prompt);
57 57  
58 58 /**
59 59 * readline_into_buffer() - read a line into a buffer
... ... @@ -78,7 +78,8 @@
78 78 * parameter), then -2 is returned. If a break is detected (Ctrl-C) then
79 79 * -1 is returned.
80 80 */
81   -int readline_into_buffer(const char *const prompt, char *buffer, int timeout);
  81 +int cli_readline_into_buffer(const char *const prompt, char *buffer,
  82 + int timeout);
82 83  
83 84 /**
84 85 * parse_line() - split a command line down into separate arguments
... ... @@ -97,7 +98,7 @@
97 98 * @args: Array to hold arguments
98 99 * @return number of arguments
99 100 */
100   -int parse_line(char *line, char *argv[]);
  101 +int cli_simple_parse_line(char *line, char *argv[]);
101 102  
102 103 /** bootretry_dont_retry() - Indicate that we should not retry the boot */
103 104 void bootretry_dont_retry(void);