summaryrefslogtreecommitdiff
path: root/src/dev/dma_device.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@arm.com>2012-11-02 11:32:01 -0500
committerAndreas Sandberg <Andreas.Sandberg@arm.com>2012-11-02 11:32:01 -0500
commitb81a977e6ab7dbfd122cb778cfe3d40ca7451198 (patch)
tree09804c27367de8cf93623ec4644bf47abf316bf9 /src/dev/dma_device.cc
parenteb703a4b4e167e4d45f92203a1e0849f19cdba6d (diff)
downloadgem5-b81a977e6ab7dbfd122cb778cfe3d40ca7451198.tar.xz
sim: Move the draining interface into a separate base class
This patch moves the draining interface from SimObject to a separate class that can be used by any object needing draining. However, objects not visible to the Python code (i.e., objects not deriving from SimObject) still depend on their parents informing them when to drain. This patch also gets rid of the CountedDrainEvent (which isn't really an event) and replaces it with a DrainManager.
Diffstat (limited to 'src/dev/dma_device.cc')
-rw-r--r--src/dev/dma_device.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dev/dma_device.cc b/src/dev/dma_device.cc
index 1aa4a8647..952d6f622 100644
--- a/src/dev/dma_device.cc
+++ b/src/dev/dma_device.cc
@@ -51,7 +51,7 @@
DmaPort::DmaPort(MemObject *dev, System *s)
: MasterPort(dev->name() + ".dma", dev), device(dev), sendEvent(this),
sys(s), masterId(s->getMasterId(dev->name())),
- pendingCount(0), drainEvent(NULL),
+ pendingCount(0), drainManager(NULL),
inRetry(false)
{ }
@@ -98,9 +98,9 @@ DmaPort::handleResp(PacketPtr pkt, Tick delay)
delete pkt;
// we might be drained at this point, if so signal the drain event
- if (pendingCount == 0 && drainEvent) {
- drainEvent->process();
- drainEvent = NULL;
+ if (pendingCount == 0 && drainManager) {
+ drainManager->signalDrainDone();
+ drainManager = NULL;
}
}
@@ -128,22 +128,22 @@ DmaDevice::init()
}
unsigned int
-DmaDevice::drain(Event *de)
+DmaDevice::drain(DrainManager *dm)
{
- unsigned int count = pioPort.drain(de) + dmaPort.drain(de);
+ unsigned int count = pioPort.drain(dm) + dmaPort.drain(dm);
if (count)
- changeState(Draining);
+ setDrainState(Drainable::Draining);
else
- changeState(Drained);
+ setDrainState(Drainable::Drained);
return count;
}
unsigned int
-DmaPort::drain(Event *de)
+DmaPort::drain(DrainManager *dm)
{
if (pendingCount == 0)
return 0;
- drainEvent = de;
+ drainManager = dm;
DPRINTF(Drain, "DmaPort not drained\n");
return 1;
}