diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2006-03-29 17:40:09 -0500 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2006-03-29 17:40:09 -0500 |
commit | 2177d822ce1eecffb685f13468412c99b1e59ecd (patch) | |
tree | 4ae56528a80dcffacda85b6e4a1c5602c6f19652 /dev/io_device.hh | |
parent | 1e4e989b8396b9f4f322fb27bbfa1cf9e2007334 (diff) | |
parent | 3dcb589ea46290ecfe2c2e54ebf2ba8921a932ed (diff) | |
download | gem5-2177d822ce1eecffb685f13468412c99b1e59ecd.tar.xz |
Merge m5.eecs.umich.edu:/bk/newmem
into ewok.(none):/home/gblack/m5/newmem
--HG--
extra : convert_revision : 7866241cf43416636cbd6a3a4f6eeda561ed2e27
Diffstat (limited to 'dev/io_device.hh')
-rw-r--r-- | dev/io_device.hh | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/dev/io_device.hh b/dev/io_device.hh index ba16372cc..e2565cfdc 100644 --- a/dev/io_device.hh +++ b/dev/io_device.hh @@ -192,20 +192,40 @@ class PioDevice : public SimObject /** Pure virtual function that the device must implement. Called when a read * command is recieved by the port. */ - virtual bool read(Packet &pkt) = 0; + virtual Tick read(Packet &pkt) = 0; /** Pure virtual function that the device must implement. Called when a * write command is recieved by the port. */ - virtual bool write(Packet &pkt) = 0; + virtual Tick write(Packet &pkt) = 0; public: - PioDevice(const std::string &name, Platform *p); + /** 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; + }; + protected: + Params *_params; + + public: + const Params *params() const { return _params; } + + PioDevice(Params *params) + : SimObject(params()->name), platform(params()->platform) + {} virtual ~PioDevice(); virtual Port *getPort(const std::string &if_name) { if (if_name == "pio") + if (pioPort != NULL) + panic("pio port already connected to."); + pioPort = new PioPort(this, params()->platform); return pioPort; else return NULL; @@ -214,6 +234,33 @@ class PioDevice : public SimObject }; +class BasicPioDevice : public PioDevice +{ + public: + struct Params + { + Addr pio_addr; + Tick pio_delay; + }; + + protected: + /** Address that the device listens to. */ + Addr pioAddr; + + /** Size that the device's address range. */ + Addr pioSize = 0; + + /** Delay that the device experinces on an access. */ + Tick pioDelay; + + public: + BasePioDevice(Params *p) + : PioDevice(p), pioAddr(p->pio_addr), pioDelay(p->pioDelay) + {} + + virtual void addressRanges(AddrRangeList &range_list, bool &owner); +}; + class DmaDevice : public PioDevice { protected: |