45 #ifndef __DEV_DMA_DEVICE_HH__ 46 #define __DEV_DMA_DEVICE_HH__ 53 #include "params/DmaDevice.hh" 108 : completionEvent(ce), totBytes(tb), numBytes(0), delay(_delay)
153 uint32_t sid = 0, uint32_t ssid = 0);
180 uint32_t sid, uint32_t ssid,
Tick delay = 0)
193 uint32_t sid, uint32_t ssid,
Tick delay = 0)
207 void init()
override;
211 Port &getPort(
const std::string &if_name,
227 virtual const std::string
name()
const {
return "DmaCallback"; }
253 virtual void process() = 0;
333 unsigned max_req_size,
334 unsigned max_pending,
363 bool tryGet(uint8_t *dst,
size_t len);
367 return tryGet(static_cast<T *>(&value),
sizeof(T));
378 void get(uint8_t *dst,
size_t len);
383 get(
static_cast<uint8_t *
>(&value),
sizeof(T));
388 size_t size()
const {
return buffer.size(); }
408 void startFill(
Addr start,
size_t size);
425 return nextAddr == endAddr;
433 return !(pendingRequests.empty() && atEndOfBlock());
467 const Addr maxReqSize;
484 void reset(
size_t size);
487 bool done()
const {
return _done; }
489 const uint8_t *
data()
const {
return _data.data(); }
490 uint8_t *
data() {
return _data.data(); }
509 void handlePending();
515 void resumeFillTiming();
518 void resumeFillFunctional();
530 #endif // __DEV_DMA_DEVICE_HH__ A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Ports are used to interface objects to each other.
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 dmaRead(Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
DmaPort(ClockedObject *dev, System *s, uint32_t sid=0, uint32_t ssid=0)
Buffered DMA engine helper class.
const PortID InvalidPortID
DrainState
Object drain/handover states.
ClockedObject *const device
The device that owns this port.
void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
DrainState drain() override
DmaPort ensures that all oustanding DMA accesses have completed before it finishes draining...
std::shared_ptr< Request > RequestPtr
void chunkComplete()
Called by DMA engine completion event on each chunk completion.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
void signalDrainDone() const
Signal that an object is drained.
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...
const Request::Flags reqFlags
Request flags.
std::deque< DmaDoneEventUPtr > freeRequests
EventFunctionWrapper sendEvent
Event used to schedule a future sending from the transmit list.
const MasterID masterId
Id for all requests.
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...
uint64_t Tick
Tick count type.
void dmaRead(Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
virtual const std::string name() const
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
std::vector< uint8_t > _data
const uint8_t * data() const
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.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Draining buffers pending serialization/handover.
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.
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 SimObject 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.
Event * getChunkEvent()
Request a chunk event.
const Addr totBytes
Total number of bytes that this transaction involves.
DmaReqState(Event *ce, Addr tb, Tick _delay)
std::deque< DmaDoneEventUPtr > pendingRequests
bool isActive() const
Is the DMA engine active (i.e., are there still in-flight accesses)?
const uint32_t defaultSSid
Default substreamId.
const uint32_t defaultSid
Default streamId.
std::ostream CheckpointOut
unsigned int cacheBlockSize() const
const std::string name() const
Return port name (for DPRINTF).
void unserialize(ThreadContext &tc, CheckpointIn &cp)
Event * completionEvent
Event to call on the device when this transaction (all packets) complete.
bool atEndOfBlock() const
Has the DMA engine sent out the last request for the active block?
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
size_t size() const
Get the amount of data stored in the FIFO.
size_t requestSize() const
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...
const FlagsType init
This Stat is Initialized.
std::deque< PacketPtr > transmitList
Use a deque as we never do any insertion or removal in the middle.
unsigned int cacheLineSize() const
Get the cache line size of the system.