diff options
Diffstat (limited to 'src/dev/serial/terminal.cc')
-rw-r--r-- | src/dev/serial/terminal.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/dev/serial/terminal.cc b/src/dev/serial/terminal.cc index bc8c14c53..002a2ebb7 100644 --- a/src/dev/serial/terminal.cc +++ b/src/dev/serial/terminal.cc @@ -1,4 +1,16 @@ /* + * Copyright (c) 2019 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2001-2005 The Regents of The University of Michigan * All rights reserved. * @@ -109,7 +121,7 @@ Terminal::DataEvent::process(int revent) Terminal::Terminal(const Params *p) : SerialDevice(p), listenEvent(NULL), dataEvent(NULL), number(p->number), data_fd(-1), txbuf(16384), rxbuf(16384), - outfile(p->output ? simout.findOrCreate(p->name) : NULL) + outfile(terminalDump(p)) #if TRACING_ON == 1 , linebuf(16384) #endif @@ -133,6 +145,22 @@ Terminal::~Terminal() delete dataEvent; } +OutputStream * +Terminal::terminalDump(const TerminalParams* p) +{ + switch (p->outfile) { + case Enums::TerminalDump::none: + return nullptr; + case Enums::TerminalDump::stdout: + return simout.findOrCreate("stdout"); + case Enums::TerminalDump::stderr: + return simout.findOrCreate("stderr"); + case Enums::TerminalDump::file: + return simout.findOrCreate(p->name); + default: + panic("Invalid option\n"); + } +} /////////////////////////////////////////////////////////////////////// // socket creation and terminal attach |