|
μHAL (v2.7.9)
Part of the IPbus software repository
|
Go to the documentation of this file.
39 #ifndef _uhal_tests_DummyHardware_hpp_
40 #define _uhal_tests_DummyHardware_hpp_
46 #include <boost/chrono/chrono_io.hpp>
47 #include <boost/thread/thread.hpp>
76 virtual void run() = 0;
81 template <
class DurationType>
94 template< u
int8_t IPbus_major , u
int8_t IPbus_minor >
105 DummyHardware (
const uint32_t& aReplyDelay,
const bool& aBigEndianHack );
116 void SetEndpoint(
const uint32_t& aAddress ,
const uint32_t& aValue );
129 void ni_read (
const uint32_t& aAddress );
135 void read (
const uint32_t& aAddress );
149 void ni_write (
const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt ,
const std::vector<uint32_t>::const_iterator& aEnd );
157 void write (
const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt ,
const std::vector<uint32_t>::const_iterator& aEnd );
164 void rmw_sum (
const uint32_t& aAddress ,
const uint32_t& aAddend );
172 void rmw_bits (
const uint32_t& aAddress ,
const uint32_t& aAndTerm ,
const uint32_t& aOrTerm );
204 std::deque< std::pair< uint32_t , std::vector< uint32_t > > >
mReplyHistory;
std::vector< uint32_t > mConfigurationSpace
The configuration space within the virtual hardware.
void unknown_type()
Analyse request and create reply when the header is unknown.
void status_packet_header()
Analyse request and create reply when an IPbus 2.0 status packet header is observed.
static const uint32_t ADDRESSMASK
The mask for the address space (size of the address space in one larger than this)
boost::chrono::microseconds mReplyDelay
The delay in seconds between the request and reply of the first transaction.
void readConfigurationSpace(const uint32_t &aAddress)
Analyse request and create reply when an incrementing "configuration space" read is observed.
void ni_read(const uint32_t &aAddress)
Analyse request and create reply when a non-incrementing read is observed.
bool control_packet_header()
Analyse request and create reply when an IPbus 2.0 control packet header is observed.
DummyHardwareInterface(const boost::chrono::microseconds &aReplyDelay)
static const uint32_t BUFFER_SIZE
Size of the receive and reply buffers.
std::vector< uint32_t > mReply
The buffer for the outgoing IPbus packet.
void setReplyDelay(const DurationType &aDelay)
Helper class to decode IPbus packets as passed from the Client to the Target.
std::deque< uint8_t > mTrafficHistory
History of the IPbus 2.0 packet-types received.
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< std::pair< uint32_t, std::vector< uint32_t > > > mReplyHistory
The history of the replies for the retry mechanism (IPbus 2.0 and above only)
virtual void stop()=0
Stops this dummy hardware instance - i.e. makes the 'run' method return.
void bot()
Analyse request and create reply when a Byte-OrderTransaction is observed.
void SetEndpoint(const uint32_t &aAddress, const uint32_t &aValue)
std::vector< uint32_t > mMemory
The memory space of the virtual hardware.
DummyHardware(const uint32_t &aReplyDelay, const bool &aBigEndianHack)
Constructor.
void AnalyzeReceivedAndCreateReply(const uint32_t &aByteCount)
Function which analyses the received IPbus packet and creates the suitable response.
Abstract base class to emulate IPbus hardware.
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.
uint32_t mLastPacketHeader
The last sent packet header for the retry mechanism (IPbus 2.0 and above only)
uint32_t GetEndpoint(const uint32_t &aAddress)
void unknown_packet_header()
Analyse request and create reply when an unknown IPbus 2.0 packet header is observed.
Common abstract base class for IPbus 1.3 and 2.0 dummy hardware.
bool mBigEndianHack
Whether we are talking to an IPbus client which includes the big-endian hack.
static const uint32_t REPLY_HISTORY_DEPTH
The size of the reply history for IPbus 2.0.
std::deque< uint32_t > mReceivedControlPacketHeaderHistory
History of the received control packet headers.
virtual ~DummyHardwareInterface()
void resend_packet_header()
Analyse request and create reply when an IPbus 2.0 resend packet header is observed.
virtual void run()=0
Function which "starts" the dummy hardware; does not return until the 'stop' method is called.
std::deque< uint32_t > mSentControlPacketHeaderHistory
History of the sent control packet headers.
HostToTargetInspector< IPbus_major, IPbus_minor > base_type
void read(const uint32_t &aAddress)
Analyse request and create reply when an incrementing read is observed.
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 > mReceive
The buffer for the incoming IPbus packet.
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.