I/O Base Classes

From gem5
Revision as of 03:27, 18 June 2006 by Saidi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The base classes in src/dev/io_device.* allow devices to be created with reasonable ease. The classes and virtual functions that must be implemented are listed below. Before

pioPort

The PioPort class is a programmed I/O port that all devices that are sensitive to an address range use. The port takes all the memory access types and roles them into one read() and write() call that the device must respond to. The device must also provide the addressRanges() function with which it returns the address ranges it is interested in. An extra sendTiming() function is implemented which takes an delay. In this way the device can immediately call sendTiming(pkt, time) after processing a request and the request will be handled by the port even if the port bus the device connects to is blocked. Because of this a PIO device should not call Port::sendTiming() only PioPort::sendTiming() should be used. sendTiming() causes a new PioPort::SendEvent is created and when the event time is reached the packet is sent. If the send is not successful then the packet is placed on a the transmit list and resent when recvRetry() is called.

If desired a device could have more than one PIO port. However in the normal case it would only have one port and return multiple ranges when the addressRange() function is called. The only time multiple PIO ports would be desirable is if your device wanted to have separate connection to two memory objects.

PioDevice

This device is the base class which all devices senstive to an address range inherit from. There are three pure virtual functions which all devices must implement addressRanges(), read(), and write(). The magic do choose which mode we are in, etc is handled by the PioPort so the device doesn't have to bother.