summaryrefslogtreecommitdiff
path: root/src/dev/terminal.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2014-09-20 17:17:50 -0400
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2014-09-20 17:17:50 -0400
commit0c5139310d634d6d366f4120d88deef66c9266af (patch)
treec86dc547b8eeb36f3e6d78589889e4e2335d7f9f /src/dev/terminal.hh
parent0fa128bbd0a53a3428fa2028b8754e15c9ef7c38 (diff)
downloadgem5-0c5139310d634d6d366f4120d88deef66c9266af.tar.xz
dev: Refactor terminal<->UART interface to make it more generic
The terminal currently assumes that the transport to the guest always inherits from the Uart class. This assumption breaks when implementing, for example, a VirtIO consoles. This patch removes this assumption by adding pointer to the from the terminal to the uart and replacing it with a more general callback interface. The Uart, or any other class using the terminal, class implements an instance of the callbacks class and registers it with the terminal.
Diffstat (limited to 'src/dev/terminal.hh')
-rw-r--r--src/dev/terminal.hh17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/dev/terminal.hh b/src/dev/terminal.hh
index e2322d7c2..f7a860ac5 100644
--- a/src/dev/terminal.hh
+++ b/src/dev/terminal.hh
@@ -38,6 +38,7 @@
#include <iostream>
+#include "base/callback.hh"
#include "base/circlebuf.hh"
#include "base/pollevent.hh"
#include "base/socket.hh"
@@ -46,12 +47,24 @@
#include "sim/sim_object.hh"
class TerminalListener;
-class Uart;
class Terminal : public SimObject
{
public:
- Uart *uart;
+ /**
+ * Register a data available callback into the transport layer.
+ *
+ * The terminal needs to call the underlying transport layer to
+ * inform it of available data. The transport layer uses this
+ * method to register a callback that informs it of pending data.
+ *
+ * @param c Callback instance from transport layer.
+ */
+ void regDataAvailCallback(Callback *c);
+
+ protected:
+ /** Currently registered transport layer callbacks */
+ Callback *termDataAvail;
protected:
class ListenEvent : public PollEvent