diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-09-20 17:17:50 -0400 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2014-09-20 17:17:50 -0400 |
commit | 0c5139310d634d6d366f4120d88deef66c9266af (patch) | |
tree | c86dc547b8eeb36f3e6d78589889e4e2335d7f9f /src/dev/uart.hh | |
parent | 0fa128bbd0a53a3428fa2028b8754e15c9ef7c38 (diff) | |
download | gem5-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/uart.hh')
-rw-r--r-- | src/dev/uart.hh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dev/uart.hh b/src/dev/uart.hh index f1a26fda8..6c9c08ee7 100644 --- a/src/dev/uart.hh +++ b/src/dev/uart.hh @@ -36,9 +36,9 @@ #define __UART_HH__ #include "dev/io_device.hh" +#include "dev/terminal.hh" #include "params/Uart.hh" -class Terminal; class Platform; const int RX_INT = 0x1; @@ -46,7 +46,6 @@ const int TX_INT = 0x2; class Uart : public BasicPioDevice { - protected: int status; Platform *platform; @@ -72,6 +71,9 @@ class Uart : public BasicPioDevice * @return interrupt status */ bool intStatus() { return status ? true : false; } + + protected: + MakeCallback<Uart, &Uart::dataAvailable> callbackDataAvail; }; #endif // __UART_HH__ |