Abstract base class to emulate IPbus hardware. More...
#include <uhal/tests/DummyHardware.hpp>
Public Member Functions | |
DummyHardware (const uint32_t &aReplyDelay, const bool &aBigEndianHack) | |
Constructor. More... | |
virtual | ~DummyHardware () |
Public Member Functions inherited from uhal::tests::DummyHardwareInterface | |
DummyHardwareInterface (const boost::chrono::microseconds &aReplyDelay) | |
virtual | ~DummyHardwareInterface () |
virtual void | run ()=0 |
Function which "starts" the dummy hardware; does not return until the 'stop' method is called. More... | |
virtual void | stop ()=0 |
Stops this dummy hardware instance - i.e. makes the 'run' method return. More... | |
template<class DurationType > | |
void | setReplyDelay (const DurationType &aDelay) |
Public Member Functions inherited from uhal::HostToTargetInspector< IPbus_major, IPbus_minor > | |
HostToTargetInspector () | |
Default constructor. More... | |
virtual | ~HostToTargetInspector () |
Destructor. More... | |
bool | analyze (std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd, const bool &aContinueOnError=true) |
Analyse an IPbus packet held as a vector of uint32_t's. More... | |
Protected Member Functions | |
void | AnalyzeReceivedAndCreateReply (const uint32_t &aByteCount) |
Function which analyses the received IPbus packet and creates the suitable response. More... | |
void | SetEndpoint (const uint32_t &aAddress, const uint32_t &aValue) |
Protected Attributes | |
std::vector< uint32_t > | mReceive |
The buffer for the incoming IPbus packet. More... | |
std::vector< uint32_t > | mReply |
The buffer for the outgoing IPbus packet. More... | |
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) More... | |
uint32_t | mLastPacketHeader |
The last sent packet header for the retry mechanism (IPbus 2.0 and above only) More... | |
std::deque< uint8_t > | mTrafficHistory |
History of the IPbus 2.0 packet-types received. More... | |
std::deque< uint32_t > | mReceivedControlPacketHeaderHistory |
History of the received control packet headers. More... | |
std::deque< uint32_t > | mSentControlPacketHeaderHistory |
History of the sent control packet headers. More... | |
Protected Attributes inherited from uhal::tests::DummyHardwareInterface | |
boost::chrono::microseconds | mReplyDelay |
The delay in seconds between the request and reply of the first transaction. More... | |
Protected Attributes inherited from uhal::HostToTargetInspector< IPbus_major, IPbus_minor > | |
uint32_t | mHeader |
The current raw transaction header. More... | |
IPbusTransactionType | mType |
The current transaction type. More... | |
uint32_t | mWordCounter |
The current word count. More... | |
uint32_t | mTransactionId |
The current transaction id. More... | |
uint8_t | mResponseGood |
The current error code/flag. More... | |
uint32_t | mPacketHeader |
The current raw IPbus2 packet header. More... | |
uint32_t | mPacketCounter |
The current IPbus2 packet counter. More... | |
uint32_t | mPacketType |
The current IPbus2 packet type. More... | |
Private Types | |
typedef HostToTargetInspector< IPbus_major, IPbus_minor > | base_type |
Private Member Functions | |
uint32_t | GetEndpoint (const uint32_t &aAddress) |
void | bot () |
Analyse request and create reply when a Byte-OrderTransaction is observed. More... | |
void | ni_read (const uint32_t &aAddress) |
Analyse request and create reply when a non-incrementing read is observed. More... | |
void | read (const uint32_t &aAddress) |
Analyse request and create reply when an incrementing read is observed. More... | |
void | readConfigurationSpace (const uint32_t &aAddress) |
Analyse request and create reply when an incrementing "configuration space" read is observed. More... | |
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. More... | |
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. More... | |
void | rmw_sum (const uint32_t &aAddress, const uint32_t &aAddend) |
Analyse request and create reply when a read-modify-write sum is observed. More... | |
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. More... | |
void | unknown_type () |
Analyse request and create reply when the header is unknown. More... | |
bool | control_packet_header () |
Analyse request and create reply when an IPbus 2.0 control packet header is observed. More... | |
void | status_packet_header () |
Analyse request and create reply when an IPbus 2.0 status packet header is observed. More... | |
void | resend_packet_header () |
Analyse request and create reply when an IPbus 2.0 resend packet header is observed. More... | |
void | unknown_packet_header () |
Analyse request and create reply when an unknown IPbus 2.0 packet header is observed. More... | |
Private Attributes | |
std::vector< uint32_t > | mMemory |
The memory space of the virtual hardware. More... | |
std::vector< uint32_t > | mConfigurationSpace |
The configuration space within the virtual hardware. More... | |
bool | mBigEndianHack |
Whether we are talking to an IPbus client which includes the big-endian hack. More... | |
Abstract base class to emulate IPbus hardware.
Definition at line 95 of file DummyHardware.hpp.
|
private |
Definition at line 97 of file DummyHardware.hpp.
uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::DummyHardware | ( | const uint32_t & | aReplyDelay, |
const bool & | aBigEndianHack | ||
) |
Constructor.
aReplyDelay | a time delay between the reply and response for the first transaction |
aBigEndianHack | whether we are using the dummy hardware with a client which uses the big-endian hack. |
Definition at line 56 of file DummyHardware.cpp.
References uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mConfigurationSpace.
|
virtual |
Definition at line 75 of file DummyHardware.cpp.
|
protected |
Function which analyses the received IPbus packet and creates the suitable response.
aByteCount | the number of bytes received |
Definition at line 81 of file DummyHardware.cpp.
References uhal::Debug, uhal::log(), and uhal::LoggingIncludes().
|
privatevirtual |
Analyse request and create reply when a Byte-OrderTransaction is observed.
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 182 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when an IPbus 2.0 control packet header is observed.
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 381 of file DummyHardware.cpp.
References uhal::Integer(), uhal::log(), and uhal::Notice.
|
private |
Definition at line 173 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when a non-incrementing read is observed.
aAddress | the base address of the read |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 194 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when a non-incrementing write is observed.
aAddress | the base address of the write |
aIt | iterator to the start of the payload |
aEnd | iterator to the end of the payload |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 248 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when an incrementing read is observed.
aAddress | the base address of the read |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 212 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when an incrementing "configuration space" read is observed.
aAddress | the base address of the read |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 230 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when an IPbus 2.0 resend packet header is observed.
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 456 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when a read-modify-write bits is observed.
aAddress | the base address of the write |
aAndTerm | the value to be and'ed |
aOrTerm | the value to be or'ed |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 336 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when a read-modify-write sum is observed.
aAddress | the base address of the write |
aAddend | the value to be added |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 306 of file DummyHardware.cpp.
|
protected |
Definition at line 164 of file DummyHardware.cpp.
References uhal::tests::ADDRESSMASK.
|
privatevirtual |
Analyse request and create reply when an IPbus 2.0 status packet header is observed.
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 411 of file DummyHardware.cpp.
References uhal::tests::BUFFER_SIZE, uhal::tests::j, and uhal::tests::REPLY_HISTORY_DEPTH.
|
privatevirtual |
Analyse request and create reply when an unknown IPbus 2.0 packet header is observed.
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 475 of file DummyHardware.cpp.
|
privatevirtual |
Analyse request and create reply when the header is unknown.
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 368 of file DummyHardware.cpp.
References uhal::Error, uhal::Integer(), and uhal::log().
|
privatevirtual |
Analyse request and create reply when an incrementing write is observed.
aAddress | the base address of the write |
aIt | iterator to the start of the payload |
aEnd | iterator to the end of the payload |
Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.
Definition at line 277 of file DummyHardware.cpp.
|
private |
Whether we are talking to an IPbus client which includes the big-endian hack.
Definition at line 219 of file DummyHardware.hpp.
|
private |
The configuration space within the virtual hardware.
Definition at line 195 of file DummyHardware.hpp.
Referenced by uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::DummyHardware().
|
protected |
The last sent packet header for the retry mechanism (IPbus 2.0 and above only)
Definition at line 207 of file DummyHardware.hpp.
|
private |
The memory space of the virtual hardware.
Definition at line 192 of file DummyHardware.hpp.
|
protected |
The buffer for the incoming IPbus packet.
Definition at line 199 of file DummyHardware.hpp.
|
protected |
History of the received control packet headers.
Definition at line 213 of file DummyHardware.hpp.
|
protected |
The buffer for the outgoing IPbus packet.
Definition at line 201 of file DummyHardware.hpp.
|
protected |
The history of the replies for the retry mechanism (IPbus 2.0 and above only)
Definition at line 204 of file DummyHardware.hpp.
|
protected |
History of the sent control packet headers.
Definition at line 215 of file DummyHardware.hpp.
|
protected |
History of the IPbus 2.0 packet-types received.
Definition at line 210 of file DummyHardware.hpp.