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