39#ifndef _uhal_tests_DummyHardware_hpp_
40#define _uhal_tests_DummyHardware_hpp_
74 virtual void run() = 0;
79 template <
class DurationType>
92 template< u
int8_t IPbus_major , u
int8_t IPbus_minor >
103 DummyHardware (
const uint32_t& aReplyDelay,
const bool& aBigEndianHack );
114 void SetEndpoint(
const uint32_t& aAddress ,
const uint32_t& aValue );
127 void ni_read (
const uint32_t& aAddress );
133 void read (
const uint32_t& aAddress );
147 void ni_write (
const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt ,
const std::vector<uint32_t>::const_iterator& aEnd );
155 void write (
const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt ,
const std::vector<uint32_t>::const_iterator& aEnd );
162 void rmw_sum (
const uint32_t& aAddress ,
const uint32_t& aAddend );
170 void rmw_bits (
const uint32_t& aAddress ,
const uint32_t& aAndTerm ,
const uint32_t& aOrTerm );
202 std::deque< std::pair< uint32_t , std::vector< uint32_t > > >
mReplyHistory;
Helper class to decode IPbus packets as passed from the Client to the Target.
Abstract base class to emulate IPbus hardware.
void unknown_type()
Analyse request and create reply when the header is unknown.
void rmw_sum(const uint32_t &aAddress, const uint32_t &aAddend)
Analyse request and create reply when a read-modify-write sum is observed.
std::vector< uint32_t > mMemory
The memory space of the virtual hardware.
void read(const uint32_t &aAddress)
Analyse request and create reply when an incrementing read is observed.
void SetEndpoint(const uint32_t &aAddress, const uint32_t &aValue)
bool mBigEndianHack
Whether we are talking to an IPbus client which includes the big-endian hack.
std::vector< uint32_t > mReply
The buffer for the outgoing IPbus packet.
void ni_write(const uint32_t &aAddress, std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd)
Analyse request and create reply when a non-incrementing write is observed.
std::deque< uint32_t > mSentControlPacketHeaderHistory
History of the sent control packet headers.
void ni_read(const uint32_t &aAddress)
Analyse request and create reply when a non-incrementing read is observed.
uint32_t GetEndpoint(const uint32_t &aAddress)
std::deque< uint32_t > mReceivedControlPacketHeaderHistory
History of the received control packet headers.
void write(const uint32_t &aAddress, std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd)
Analyse request and create reply when an incrementing write is observed.
std::vector< uint32_t > mReceive
The buffer for the incoming IPbus packet.
std::deque< uint8_t > mTrafficHistory
History of the IPbus 2.0 packet-types received.
std::deque< std::pair< uint32_t, std::vector< uint32_t > > > mReplyHistory
The history of the replies for the retry mechanism (IPbus 2.0 and above only)
void rmw_bits(const uint32_t &aAddress, const uint32_t &aAndTerm, const uint32_t &aOrTerm)
Analyse request and create reply when a read-modify-write bits is observed.
void status_packet_header()
Analyse request and create reply when an IPbus 2.0 status packet header is observed.
uint32_t mLastPacketHeader
The last sent packet header for the retry mechanism (IPbus 2.0 and above only)
std::vector< uint32_t > mConfigurationSpace
The configuration space within the virtual hardware.
bool control_packet_header()
Analyse request and create reply when an IPbus 2.0 control packet header is observed.
void resend_packet_header()
Analyse request and create reply when an IPbus 2.0 resend packet header is observed.
void readConfigurationSpace(const uint32_t &aAddress)
Analyse request and create reply when an incrementing "configuration space" read is observed.
HostToTargetInspector< IPbus_major, IPbus_minor > base_type
void unknown_packet_header()
Analyse request and create reply when an unknown IPbus 2.0 packet header is observed.
void bot()
Analyse request and create reply when a Byte-OrderTransaction is observed.
void AnalyzeReceivedAndCreateReply(const uint32_t &aByteCount)
Function which analyses the received IPbus packet and creates the suitable response.
Common abstract base class for IPbus 1.3 and 2.0 dummy hardware.
std::chrono::microseconds mReplyDelay
The delay in seconds between the request and reply of the first transaction.
virtual void run()=0
Function which "starts" the dummy hardware; does not return until the 'stop' method is called.
DummyHardwareInterface(const std::chrono::microseconds &aReplyDelay)
virtual void stop()=0
Stops this dummy hardware instance - i.e. makes the 'run' method return.
void setReplyDelay(const DurationType &aDelay)
virtual ~DummyHardwareInterface()
None tests(nox.Session session)
static const uint32_t BUFFER_SIZE
Size of the receive and reply buffers.
static const uint32_t REPLY_HISTORY_DEPTH
The size of the reply history for IPbus 2.0.
static const uint32_t ADDRESSMASK
The mask for the address space (size of the address space in one larger than this)