1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2007 OpenMoko, Inc.
4 * Written by Harald Welte <laforge@openmoko.org>
12 #include <stdio_dev.h>
15 int do_terminal(struct cmd_tbl *cmd, int flag, int argc, char *const argv[])
18 struct stdio_dev *dev = NULL;
23 /* Scan for selected output/input device */
24 dev = stdio_get_by_name(argv[1]);
28 if (IS_ENABLED(CONFIG_SERIAL))
31 printf("Entering terminal mode for port %s\n", dev->name);
32 puts("Use '~.' to leave the terminal and get back to u-boot\n");
37 /* read from console and display on serial port */
38 if (stdio_devices[0]->tstc(stdio_devices[0])) {
39 c = stdio_devices[0]->getc(stdio_devices[0]);
40 if (last_tilde == 1) {
47 /* write the delayed tilde */
49 /* fall-through to print current
61 /* read from serial port and display on console */
71 /***************************************************/
74 terminal, 3, 1, do_terminal,
75 "start terminal emulator",