diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-10-20 13:11:56 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-10-20 13:11:56 -0700 |
commit | 38aef4c4c7e58e9166616554465bea70afab824f (patch) | |
tree | 67452346f5ed51a5fcd6b6a7f5a43c006464649d /src/dev/io_device.cc | |
parent | 7b500f56ca539d1a31f9590a810e86146dd2582f (diff) | |
download | gem5-38aef4c4c7e58e9166616554465bea70afab824f.tar.xz |
dev: clean up PioDevice and DmaDevive getPort() methods.
Make DmaDevice::getPort() call PioDevice::getPort() instead
of just copying and pasting the code.
Also move definitions from .hh to .cc file.
Diffstat (limited to 'src/dev/io_device.cc')
-rw-r--r-- | src/dev/io_device.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc index bfdf3d486..5e2395bf9 100644 --- a/src/dev/io_device.cc +++ b/src/dev/io_device.cc @@ -75,6 +75,18 @@ PioDevice::init() pioPort->sendStatusChange(Port::RangeChange); } +Port * +PioDevice::getPort(const std::string &if_name, int idx) +{ + if (if_name == "pio") { + if (pioPort != NULL) + fatal("%s: pio port already connected to %s", + name(), pioPort->getPeer()->name()); + pioPort = new PioPort(this, sys); + return pioPort; + } + return NULL; +} unsigned int PioDevice::drain(Event *de) @@ -349,3 +361,19 @@ DmaDevice::~DmaDevice() if (dmaPort) delete dmaPort; } + + +Port * +DmaDevice::getPort(const std::string &if_name, int idx) +{ + if (if_name == "dma") { + if (dmaPort != NULL) + fatal("%s: dma port already connected to %s", + name(), dmaPort->getPeer()->name()); + dmaPort = new DmaPort(this, sys, params()->min_backoff_delay, + params()->max_backoff_delay); + return dmaPort; + } + return PioDevice::getPort(if_name, idx); +} + |