41#ifndef __DEV_DMA_DEVICE_HH__
42#define __DEV_DMA_DEVICE_HH__
52#include "params/DmaDevice.hh"
124 uint32_t _sid, uint32_t _ssid,
Event *
ce,
Tick _delay,
207 uint8_t *
data, uint32_t sid, uint32_t ssid,
Tick delay,
230 uint32_t sid, uint32_t ssid,
Tick delay=0)
244 uint32_t sid, uint32_t ssid,
Tick delay=0)
258 void init()
override;
278 virtual const std::string
name()
const {
return "DmaCallback"; }
383 unsigned max_req_size,
384 unsigned max_pending,
419 return tryGet(
static_cast<T *
>(&value),
sizeof(T));
430 void get(uint8_t *dst,
size_t len);
437 get(
static_cast<uint8_t *
>(&value),
sizeof(T));
Declaration and inline definition of ChunkGenerator object.
The AddrRangeMap uses an STL map to implement an interval tree for address decoding.
This class takes an arbitrary memory region (address/length pair) and generates a series of appropria...
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Event * getChunkEvent()
Request a chunk event.
void chunkComplete()
Called by DMA engine completion event on each chunk completion.
virtual ~DmaCallback()=default
DrainState drain() override
DmaPort ensures that all oustanding DMA accesses have completed before it finishes draining.
virtual const std::string name() const
virtual void process()=0
Callback function invoked on completion of all chunks.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
void dmaRead(Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
void dmaRead(Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
virtual ~DmaDevice()=default
Addr cacheBlockSize() const
void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
DmaDevice(const Params &p)
ClockedObject *const device
The device that owns this port.
EventFunctionWrapper sendEvent
Event used to schedule a future sending from the transmit list.
System *const sys
The system that device/port are in.
void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, Tick delay, Request::Flags flag=0)
bool sendAtomicBdReq(DmaReqState *state)
Send the next packet from a DMA request in atomic mode, and request and/or use memory backdoors if po...
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
DmaPort(ClockedObject *dev, System *s, uint32_t sid=0, uint32_t ssid=0)
void trySendTimingReq()
Take the first request on the transmit list and attempt to send a timing packet from it.
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
PacketPtr inRetry
The packet (if any) waiting for a retry to send.
uint32_t pendingCount
Number of outstanding packets the dma port has.
std::deque< DmaReqState * > transmitList
Use a deque as we never do any insertion or removal in the middle.
AddrRangeMap< MemBackdoorPtr, 1 > memBackdoors
void sendDma()
For timing, attempt to send the first item on the transmit list, and if it is successful and there ar...
const uint32_t defaultSid
Default streamId.
void handleResp(DmaReqState *state, Addr addr, Addr size, Tick delay=0)
bool retryPending
Whether the other side expects us to wait for a retry.
const RequestorID requestorId
Id for all requests.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
bool sendAtomicReq(DmaReqState *state)
Send the next packet from a DMA request in atomic mode.
const uint32_t defaultSSid
Default substreamId.
void handleRespPacket(PacketPtr pkt, Tick delay=0)
Handle a response packet by updating the corresponding DMA request state to reflect the bytes receive...
std::vector< uint8_t > _data
const uint8_t * data() const
DmaDoneEvent(DmaReadFifo *_parent, size_t max_size)
size_t requestSize() const
Buffered DMA engine helper class.
void serialize(CheckpointOut &cp) const override
Serialize an object.
size_t size() const
Get the amount of data stored in the FIFO.
virtual void onIdle()
Last response received callback.
bool tryGet(uint8_t *dst, size_t len)
Try to read data from the FIFO.
void startFill(Addr start, size_t size)
Start filling the FIFO.
DmaReadFifo(DmaPort &port, size_t size, unsigned max_req_size, unsigned max_pending, Request::Flags flags=0)
const Request::Flags reqFlags
Request flags.
virtual void onEndOfBlock()
End of block callback.
void resumeFill()
Try to issue new DMA requests or bypass DMA requests.
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::deque< DmaDoneEventUPtr > freeRequests
void flush()
Flush the FIFO.
void dmaDone()
DMA request done, handle incoming data and issue new request.
bool isActive() const
Is the DMA engine active (i.e., are there still in-flight accesses)?
void stopFill()
Stop the DMA engine.
void resumeFillBypass()
Try to bypass DMA requests in non-caching mode.
bool atEndOfBlock() const
Has the DMA engine sent out the last request for the active block?
const Addr maxReqSize
Maximum request size in bytes.
const size_t fifoSize
Maximum FIFO size in bytes.
void handlePending()
Handle pending requests that have been flagged as done.
void resumeFillTiming()
Try to issue new DMA requests during normal execution.
std::unique_ptr< DmaDoneEvent > DmaDoneEventUPtr
std::deque< DmaDoneEventUPtr > pendingRequests
Interface for objects that might require draining before checkpointing.
Simple FIFO implementation backed by a circular buffer.
Command
List of all commands associated with a packet.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
This device is the base class which all devices senstive to an address range inherit from.
Ports are used to interface objects to each other.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Basic support for object serialization.
Addr cacheLineSize() const
Get the cache line size of the system.
void signalDrainDone() const
Signal that an object is drained.
DrainState
Object drain/handover states.
@ Draining
Draining buffers pending serialization/handover.
@ Drained
Buffers drained, ready for serialization/handover.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
const Packet::Command cmd
Command for the request.
const Addr totBytes
Total number of bytes that this transaction involves.
Event * completionEvent
Event to call on the device when this transaction (all packets) complete.
Addr numBytes
Number of bytes that have been acked for this transaction.
const uint32_t sid
Stream IDs.
const RequestorID id
The requestor ID to use for requests.
const Tick delay
Amount to delay completion of dma by.
DmaReqState(Packet::Command _cmd, Addr addr, Addr chunk_sz, Addr tb, uint8_t *_data, Request::Flags _flags, RequestorID _id, uint32_t _sid, uint32_t _ssid, Event *ce, Tick _delay, Event *ae=nullptr)
ChunkGenerator gen
Object to track what chunks of bytes to send at a time.
uint8_t *const data
Pointer to a buffer for the data.
Event * abortEvent
Event to call on the device when this transaction is aborted.
const Request::Flags flags
The flags to use for requests.
bool aborted
Whether this request was aborted.
A virtual base opaque structure used to hold state associated with the packet (e.g....