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 std::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) |
| virtual void | bot () |
| Virtual callback function called when a Byte-OrderTransaction is observed. More... | |
| virtual void | ni_read (const uint32_t &aAddress) |
| Virtual callback function called when a non-incrementing read is observed. More... | |
| virtual void | read (const uint32_t &aAddress) |
| Virtual callback function called when an incrementing read is observed. More... | |
| virtual void | readConfigurationSpace (const uint32_t &aAddress) |
| Virtual callback function called when an incrementing "configuration space" read is observed. More... | |
| virtual void | ni_write (const uint32_t &aAddress, std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd) |
| Virtual callback function called when a non-incrementing write is observed. More... | |
| virtual void | write (const uint32_t &aAddress, std::vector< uint32_t >::const_iterator &aIt, const std::vector< uint32_t >::const_iterator &aEnd) |
| Virtual callback function called when an incrementing write is observed. More... | |
| virtual void | rmw_sum (const uint32_t &aAddress, const uint32_t &aAddend) |
| Virtual callback function called when a read-modify-write sum is observed. More... | |
| virtual void | rmw_bits (const uint32_t &aAddress, const uint32_t &aAndTerm, const uint32_t &aOrTerm) |
| Virtual callback function called when a read-modify-write bits is observed. More... | |
| virtual void | unknown_type () |
| Virtual callback function for the case where the header is unknown. More... | |
| virtual bool | control_packet_header () |
| Virtual callback function called when an IPbus 2.0 control packet header is observed. More... | |
| virtual void | status_packet_header () |
| Virtual callback function called when an IPbus 2.0 status packet header is observed. More... | |
| virtual void | resend_packet_header () |
| Virtual callback function called when an IPbus 2.0 resend packet header is observed. More... | |
| virtual void | unknown_packet_header () |
| Virtual callback function called when an unknown IPbus 2.0 packet header is observed. More... | |
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 | |
| std::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 93 of file DummyHardware.hpp.
|
private |
Definition at line 95 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 55 of file DummyHardware.cpp.
References uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mConfigurationSpace.
|
virtual |
Definition at line 74 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 80 of file DummyHardware.cpp.
References uhal::Debug, 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 179 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 378 of file DummyHardware.cpp.
References uhal::Integer(), uhal::log(), and uhal::Notice.
|
private |
Definition at line 170 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 191 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 245 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 209 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 227 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 453 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 333 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 303 of file DummyHardware.cpp.
|
protected |
Definition at line 161 of file DummyHardware.cpp.
|
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 408 of file DummyHardware.cpp.
References uhal::tests::BUFFER_SIZE, uhal::tests::j, uhal::tests::REPLY_HISTORY_DEPTH, and uhal::tests::x.
|
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 472 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 365 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 274 of file DummyHardware.cpp.
|
private |
Whether we are talking to an IPbus client which includes the big-endian hack.
Definition at line 217 of file DummyHardware.hpp.
|
private |
The configuration space within the virtual hardware.
Definition at line 193 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 205 of file DummyHardware.hpp.
|
private |
The memory space of the virtual hardware.
Definition at line 190 of file DummyHardware.hpp.
|
protected |
The buffer for the incoming IPbus packet.
Definition at line 197 of file DummyHardware.hpp.
|
protected |
History of the received control packet headers.
Definition at line 211 of file DummyHardware.hpp.
|
protected |
The buffer for the outgoing IPbus packet.
Definition at line 199 of file DummyHardware.hpp.
|
protected |
The history of the replies for the retry mechanism (IPbus 2.0 and above only)
Definition at line 202 of file DummyHardware.hpp.
|
protected |
History of the sent control packet headers.
Definition at line 213 of file DummyHardware.hpp.
|
protected |
History of the IPbus 2.0 packet-types received.
Definition at line 208 of file DummyHardware.hpp.