summaryrefslogtreecommitdiff
path: root/src/dev/io_device.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2007-07-23 21:51:38 -0700
committerNathan Binkert <nate@binkert.org>2007-07-23 21:51:38 -0700
commitabc76f20cb98c90e8dab416dd16dfd4a954013ba (patch)
treef3131e68a09c1b4537e17df5b14df21df53746e4 /src/dev/io_device.hh
parent552097b92e37fb4c0fd27960afe0a03c02894f11 (diff)
downloadgem5-abc76f20cb98c90e8dab416dd16dfd4a954013ba.tar.xz
Major changes to how SimObjects are created and initialized. Almost all
creation and initialization now happens in python. Parameter objects are generated and initialized by python. The .ini file is now solely for debugging purposes and is not used in construction of the objects in any way. --HG-- extra : convert_revision : 7e722873e417cb3d696f2e34c35ff488b7bff4ed
Diffstat (limited to 'src/dev/io_device.hh')
-rw-r--r--src/dev/io_device.hh67
1 files changed, 27 insertions, 40 deletions
diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh
index 25bd2de8d..e65400ca2 100644
--- a/src/dev/io_device.hh
+++ b/src/dev/io_device.hh
@@ -35,6 +35,9 @@
#include "mem/mem_object.hh"
#include "mem/packet.hh"
#include "mem/tport.hh"
+#include "params/BasicPioDevice.hh"
+#include "params/DmaDevice.hh"
+#include "params/PioDevice.hh"
#include "sim/sim_object.hh"
class Event;
@@ -186,29 +189,16 @@ class PioDevice : public MemObject
virtual Tick write(PacketPtr pkt) = 0;
public:
- /** Params struct which is extended through each device based on
- * the parameters it needs. Since we are re-writing everything, we
- * might as well start from the bottom this time. */
- struct Params
- {
- std::string name;
- Platform *platform;
- System *system;
- };
-
- protected:
- Params *_params;
-
- public:
- const Params *params() const { return _params; }
-
- PioDevice(Params *p)
- : MemObject(p->name), platform(p->platform), sys(p->system),
- pioPort(NULL), _params(p)
- {}
-
+ typedef PioDeviceParams Params;
+ PioDevice(const Params *p);
virtual ~PioDevice();
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
+
virtual void init();
virtual unsigned int drain(Event *de);
@@ -229,13 +219,6 @@ class PioDevice : public MemObject
class BasicPioDevice : public PioDevice
{
- public:
- struct Params : public PioDevice::Params
- {
- Addr pio_addr;
- Tick pio_delay;
- };
-
protected:
/** Address that the device listens to. */
Addr pioAddr;
@@ -247,10 +230,14 @@ class BasicPioDevice : public PioDevice
Tick pioDelay;
public:
- BasicPioDevice(Params *p)
- : PioDevice(p), pioAddr(p->pio_addr), pioSize(0),
- pioDelay(p->pio_delay)
- {}
+ typedef BasicPioDeviceParams Params;
+ BasicPioDevice(const Params *p);
+
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
/** return the address ranges that this device responds to.
* @param range_list range list to populate with ranges
@@ -261,22 +248,22 @@ class BasicPioDevice : public PioDevice
class DmaDevice : public PioDevice
{
- public:
- struct Params : public PioDevice::Params
- {
- Tick min_backoff_delay;
- Tick max_backoff_delay;
- };
-
protected:
DmaPort *dmaPort;
Tick minBackoffDelay;
Tick maxBackoffDelay;
public:
- DmaDevice(Params *p);
+ typedef DmaDeviceParams Params;
+ DmaDevice(const Params *p);
virtual ~DmaDevice();
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
+
void dmaWrite(Addr addr, int size, Event *event, uint8_t *data)
{
dmaPort->dmaAction(MemCmd::WriteInvalidateReq,