45 #ifndef __DEV_DMA_DEVICE_HH__
46 #define __DEV_DMA_DEVICE_HH__
53 #include "params/DmaDevice.hh"
178 void init()
override;
198 virtual const std::string
name()
const {
return "DmaCallback"; }
319 unsigned max_req_size,
320 unsigned max_pending,
353 return tryGet(static_cast<T *>(&value),
sizeof(T));
364 void get(uint8_t *dst,
size_t len);
369 get(
static_cast<uint8_t *
>(&value),
sizeof(T));
470 void reset(
size_t size);
516 #endif // __DEV_DMA_DEVICE_HH__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
size_t size() const
Get the amount of data stored in the FIFO.
void queueDma(PacketPtr pkt)
std::unique_ptr< DmaDoneEvent > DmaDoneEventUPtr
Addr numBytes
Number of bytes that have been acked for this transaction.
const Tick delay
Amount to delay completion of dma by.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void dmaRead(Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
Buffered DMA engine helper class.
void startFill(Addr start, size_t size)
Start filling the FIFO.
const PortID InvalidPortID
DrainState
Object drain/handover states.
DrainState drain() override
DmaPort ensures that all oustanding DMA accesses have completed before it finishes draining...
::Flags< FlagsType > Flags
bool atEndOfBlock() const
Has the DMA engine sent out the last request for the active block?
void chunkComplete()
Called by DMA engine completion event on each chunk completion.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the slave port.
void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
void trySendTimingReq()
Take the first packet of the transmit list and attempt to send it as a timing request.
uint32_t pendingCount
Number of outstanding packets the dma port has.
void handleResp(PacketPtr pkt, Tick delay=0)
Handle a response packet by updating the corresponding DMA request state to reflect the bytes receive...
void handlePending()
Handle pending requests that have been flagged as done.
const Request::Flags reqFlags
Request flags.
std::deque< DmaDoneEventUPtr > freeRequests
unsigned int cacheLineSize() const
Get the cache line size of the system.
const MasterID masterId
Id for all requests.
const uint8_t * data() const
static const FlagsType AutoDelete
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Interface for objects that might require draining before checkpointing.
void sendDma()
For timing, attempt to send the first item on the transmit list, and if it is successful and there ar...
DmaDoneEvent(DmaReadFifo *_parent, size_t max_size)
DmaDevice(const Params *p)
void stopFill()
Stop the DMA engine.
bool isActive() const
Is the DMA engine active (i.e., are there still in-flight accesses)?
void dmaDone()
DMA request done, handle incoming data and issue new request.
uint64_t Tick
Tick count type.
void recvReqRetry() override
Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be...
EventWrapper< DmaPort,&DmaPort::sendDma > sendEvent
Event used to schedule a future sending from the transmit list.
const Addr maxReqSize
Maximum request size in bytes.
unsigned int cacheBlockSize() const
std::vector< uint8_t > _data
virtual void onIdle()
Last response received callback.
const size_t fifoSize
Maximum FIFO size in bytes.
This device is the base class which all devices senstive to an address range inherit from...
virtual void onEndOfBlock()
End of block callback.
BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a master port with a given name and index.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
DrainState drain() override
Notify an object that it needs to drain its state.
Draining buffers pending serialization/handover.
Event invoked by DmaDevice on completion of each chunk.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
System *const sys
The system that device/port are in.
void resumeFillFunctional()
Try to bypass DMA requests in KVM execution mode.
Basic support for object serialization.
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a MemObject that sees the packet.
RequestPtr dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, Tick delay, Request::Flags flag=0)
DrainState drain() override
Notify an object that it needs to drain its state.
virtual void process()=0
Callback function invoked on completion of all chunks.
Event * getChunkEvent()
Request a chunk event.
const Addr totBytes
Total number of bytes that this transaction involves.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
DmaReqState(Event *ce, Addr tb, Tick _delay)
std::deque< DmaDoneEventUPtr > pendingRequests
size_t requestSize() const
void resumeFill()
Try to issue new DMA requests or bypass DMA requests.
std::ostream CheckpointOut
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
void signalDrainDone() const
Signal that an object is drained.
DmaChunkEvent(DmaCallback *cb)
static const Priority Default_Pri
Default is zero for historical reasons.
void resumeFillTiming()
Try to issue new DMA requests during normal execution.
DmaPort(MemObject *dev, System *s)
bool tryGet(uint8_t *dst, size_t len)
Try to read data from the FIFO.
Event * completionEvent
Event to call on the device when this transaction (all packets) complete.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
DmaReadFifo(DmaPort &port, size_t size, unsigned max_req_size, unsigned max_pending, Request::Flags flags=0)
Command
List of all commands associated with a packet.
void flush()
Flush the FIFO.
bool inRetry
If the port is currently waiting for a retry before it can send whatever it is that it's sending...
virtual const std::string name() const
MemObject *const device
The device that owns this port.
std::deque< PacketPtr > transmitList
Use a deque as we never do any insertion or removal in the middle.