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