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;
79 virtual void stop() = 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 );
114 void AnalyzeReceivedAndCreateReply (
const uint32_t& aByteCount );
116 void SetEndpoint(
const uint32_t& aAddress ,
const uint32_t& aValue );
120 uint32_t GetEndpoint(
const uint32_t& aAddress );
131 void ni_read (
const uint32_t& aAddress );
137 void read (
const uint32_t& aAddress );
143 void readConfigurationSpace (
const uint32_t& aAddress );
151 void ni_write (
const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt ,
const std::vector<uint32_t>::const_iterator& aEnd );
159 void write (
const uint32_t& aAddress , std::vector<uint32_t>::const_iterator& aIt ,
const std::vector<uint32_t>::const_iterator& aEnd );
166 void rmw_sum (
const uint32_t& aAddress ,
const uint32_t& aAddend );
174 void rmw_bits (
const uint32_t& aAddress ,
const uint32_t& aAndTerm ,
const uint32_t& aOrTerm );
184 bool control_packet_header();
189 void status_packet_header();
194 void resend_packet_header();
199 void unknown_packet_header();
216 std::deque< std::pair< uint32_t , std::vector< uint32_t > > >
mReplyHistory;
uint32_t mLastPacketHeader
The last sent packet header for the retry mechanism (IPbus 2.0 and above only)
void setReplyDelay(const DurationType &aDelay)
boost::chrono::microseconds mReplyDelay
The delay in seconds between the request and reply of the first transaction.
Helper class to decode IPbus packets as passed from the Client to the Target.
static const uint32_t BUFFER_SIZE
Size of the receive and reply buffers.
bool mBigEndianHack
Whether we are talking to an IPbus client which includes the big-endian hack.
std::deque< uint32_t > mReceivedControlPacketHeaderHistory
History of the received control packet headers.
DummyHardwareInterface(const boost::chrono::microseconds &aReplyDelay)
Common abstract base class for IPbus 1.3 and 2.0 dummy hardware.
HostToTargetInspector< IPbus_major, IPbus_minor > base_type
virtual void stop()=0
Stops this dummy hardware instance - i.e. makes the 'run' method return.
std::vector< uint32_t > mReceive
The buffer for the incoming IPbus packet.
std::vector< uint32_t > mConfigurationSpace
The configuration space within the virtual hardware.
virtual ~DummyHardwareInterface()
std::deque< uint32_t > mSentControlPacketHeaderHistory
History of the sent control packet headers.
static const uint32_t REPLY_HISTORY_DEPTH
The size of the reply history for IPbus 2.0.
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)
std::deque< uint8_t > mTrafficHistory
History of the IPbus 2.0 packet-types received.
Abstract base class to emulate IPbus hardware.
static const uint32_t ADDRESSMASK
The mask for the address space (size of the address space in one larger than this) ...
std::vector< uint32_t > mReply
The buffer for the outgoing IPbus packet.
virtual void run()=0
Function which "starts" the dummy hardware; does not return until the 'stop' method is called...
std::vector< uint32_t > mMemory
The memory space of the virtual hardware.