1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2007 OpenMoko, Inc.
11 #include <stdio_dev.h>
14 int do_terminal(struct cmd_tbl *cmd, int flag, int argc, char *const argv[])
17 struct stdio_dev *dev = NULL;
22 /* Scan for selected output/input device */
23 dev = stdio_get_by_name(argv[1]);
27 if (IS_ENABLED(CONFIG_SERIAL))
30 printf("Entering terminal mode for port %s\n", dev->name);
31 puts("Use '~.' to leave the terminal and get back to u-boot\n");
36 /* read from console and display on serial port */
37 if (stdio_devices[0]->tstc(stdio_devices[0])) {
38 c = stdio_devices[0]->getc(stdio_devices[0]);
39 if (last_tilde == 1) {
46 /* write the delayed tilde */
48 /* fall-through to print current
60 /* read from serial port and display on console */
69 /***************************************************/
72 terminal, 3, 1, do_terminal,
73 "start terminal emulator",