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.cc | |
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.cc')
-rw-r--r-- | src/dev/uart.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dev/uart.cc b/src/dev/uart.cc index 084511444..f232f0f28 100644 --- a/src/dev/uart.cc +++ b/src/dev/uart.cc @@ -39,10 +39,12 @@ using namespace std; Uart::Uart(const Params *p, Addr pio_size) - : BasicPioDevice(p, pio_size), platform(p->platform), term(p->terminal) + : BasicPioDevice(p, pio_size), + platform(p->platform), term(p->terminal), + callbackDataAvail(this) { status = 0; - // set back pointers - term->uart = this; + // setup terminal callbacks + term->regDataAvailCallback(&callbackDataAvail); } |