Go to the documentation of this file.
45 #include <sys/ioctl.h>
47 #if defined(__FreeBSD__)
51 #include <sys/termios.h>
71 #include "debug/Terminal.hh"
72 #include "debug/TerminalVerbose.hh"
111 else if (revent & POLLNVAL)
148 switch (
p->outfile) {
151 case TerminalDump::stdoutput:
153 case TerminalDump::stderror:
155 case TerminalDump::file:
158 panic(
"Invalid option\n");
170 warn_once(
"Sockets disabled, not accepting terminal connections");
176 ": can't bind address terminal port %d inuse PID %d\n",
181 ccprintf(cerr,
"%s: Listening for connections on port %d\n",
192 panic(
"%s: cannot accept a connection if not listening!",
name());
196 char message[] =
"terminal already attached!\n";
213 write((
const uint8_t *)stream.str().c_str(), stream.str().size());
217 for (
size_t i = 0;
i <
txbuf.
size();
i +=
sizeof(buf)) {
218 const size_t chunk_len(std::min(
txbuf.
size() -
i,
sizeof(buf)));
220 write((
const uint8_t *)buf, chunk_len);
256 panic(
"Terminal not properly attached.\n");
261 }
while (ret == -1 && errno == EINTR);
280 panic(
"Terminal not properly attached.\n");
289 #define MORE_PENDING (ULL(1) << 61)
290 #define RECEIVE_SUCCESS (ULL(0) << 62)
291 #define RECEIVE_NONE (ULL(2) << 62)
292 #define RECEIVE_ERROR (ULL(3) << 62)
302 DPRINTF(TerminalVerbose,
"in: \'%c\' %#02x more: %d\n",
321 DPRINTF(TerminalVerbose,
"console_in: return: %#x\n", value);
331 static char last =
'\0';
333 if ((
c !=
'\n' &&
c !=
'\r') || (last !=
'\n' && last !=
'\r')) {
334 if (
c ==
'\n' ||
c ==
'\r') {
335 int size = linebuf.size();
336 char *buffer =
new char[size + 1];
337 linebuf.read(buffer, size);
342 linebuf.write(&
c, 1);
358 DPRINTF(TerminalVerbose,
"out: \'%c\' %#02x\n",
359 isprint(
c) ?
c :
' ', (
int)
c);
364 TerminalParams::create()
virtual bool listen(int port, bool reuse=true)
virtual int accept(bool nodelay=false)
void schedule(PollEvent *event)
ListenEvent * listenEvent
const FlagsType none
Nothing extra to print.
void writeData(uint8_t c) override
Transmit a character from the host interface to the device.
Terminal(const Params *p)
bool dataAvailable() const override
Check if there is pending data from the serial device.
OutputStream * findOrCreate(const std::string &name, bool binary=false)
ListenEvent(Terminal *t, int fd, int e)
std::ostream * stream() const
Get the output underlying output stream.
DataEvent(Terminal *t, int fd, int e)
void write(InputIterator in, size_t len)
Add elements to the end of the ring buffers and advance.
void notifyInterface()
Notify the host interface of pending data.
void peek(OutputIterator out, size_t len) const
Copy buffer contents without advancing the read pointer.
void read(OutputIterator out, size_t len)
Copy buffer contents and advance the read pointer.
OutputStream * terminalDump(const TerminalParams *p)
virtual const std::string name() const
bool empty() const
Is the queue empty?
static bool allDisabled()
Base class for serial devices such as terminals.
void remove(PollEvent *event)
Overload hash function for BasicBlockRange type.
void ccprintf(cp::Print &print)
ssize_t atomic_write(int fd, const void *s, size_t n)
uint8_t readData() override
Read a character from the device.
#define panic(...)
This implements a cprintf based panic() function.
Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17