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(cmd_tbl_t
* 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]);
29 printf("Entering terminal mode for port %s\n", dev
->name
);
30 puts("Use '~.' to leave the terminal and get back to u-boot\n");
35 /* read from console and display on serial port */
36 if (stdio_devices
[0]->tstc()) {
37 c
= stdio_devices
[0]->getc();
38 if (last_tilde
== 1) {
45 /* write the delayed tilde */
47 /* fall-through to print current
59 /* read from serial port and display on console */
69 /***************************************************/
72 terminal
, 3, 1, do_terminal
,
73 "start terminal emulator",