μHAL (v2.7.9)
Part of the IPbus software repository
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
uhal::tests::DummyHardware< IPbus_major, IPbus_minor > Class Template Reference

Abstract base class to emulate IPbus hardware. More...

#include <uhal/tests/DummyHardware.hpp>

Inheritance diagram for uhal::tests::DummyHardware< IPbus_major, IPbus_minor >:
[legend]
Collaboration diagram for uhal::tests::DummyHardware< IPbus_major, IPbus_minor >:
[legend]

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...
 

Detailed Description

template<uint8_t IPbus_major, uint8_t IPbus_minor>
class uhal::tests::DummyHardware< IPbus_major, IPbus_minor >

Abstract base class to emulate IPbus hardware.

Definition at line 95 of file DummyHardware.hpp.

Member Typedef Documentation

◆ base_type

template<uint8_t IPbus_major, uint8_t IPbus_minor>
typedef HostToTargetInspector< IPbus_major , IPbus_minor > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::base_type
private

Definition at line 97 of file DummyHardware.hpp.

Constructor & Destructor Documentation

◆ DummyHardware()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::DummyHardware ( const uint32_t &  aReplyDelay,
const bool &  aBigEndianHack 
)

Constructor.

Parameters
aReplyDelaya time delay between the reply and response for the first transaction
aBigEndianHackwhether 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.

◆ ~DummyHardware()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::~DummyHardware
virtual

Definition at line 75 of file DummyHardware.cpp.

Member Function Documentation

◆ AnalyzeReceivedAndCreateReply()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::AnalyzeReceivedAndCreateReply ( const uint32_t &  aByteCount)
protected

Function which analyses the received IPbus packet and creates the suitable response.

Parameters
aByteCountthe number of bytes received

Definition at line 81 of file DummyHardware.cpp.

References uhal::Debug, uhal::log(), and uhal::LoggingIncludes().

◆ bot()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::bot
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.

◆ control_packet_header()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
bool uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::control_packet_header
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.

◆ GetEndpoint()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
uint32_t uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::GetEndpoint ( const uint32_t &  aAddress)
private

Definition at line 173 of file DummyHardware.cpp.

◆ ni_read()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::ni_read ( const uint32_t &  aAddress)
privatevirtual

Analyse request and create reply when a non-incrementing read is observed.

Parameters
aAddressthe base address of the read

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 194 of file DummyHardware.cpp.

◆ ni_write()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::ni_write ( const uint32_t &  aAddress,
std::vector< uint32_t >::const_iterator &  aIt,
const std::vector< uint32_t >::const_iterator &  aEnd 
)
privatevirtual

Analyse request and create reply when a non-incrementing write is observed.

Parameters
aAddressthe base address of the write
aItiterator to the start of the payload
aEnditerator to the end of the payload

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 248 of file DummyHardware.cpp.

◆ read()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::read ( const uint32_t &  aAddress)
privatevirtual

Analyse request and create reply when an incrementing read is observed.

Parameters
aAddressthe base address of the read

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 212 of file DummyHardware.cpp.

◆ readConfigurationSpace()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::readConfigurationSpace ( const uint32_t &  aAddress)
privatevirtual

Analyse request and create reply when an incrementing "configuration space" read is observed.

Parameters
aAddressthe base address of the read

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 230 of file DummyHardware.cpp.

◆ resend_packet_header()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::resend_packet_header
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.

◆ rmw_bits()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::rmw_bits ( const uint32_t &  aAddress,
const uint32_t &  aAndTerm,
const uint32_t &  aOrTerm 
)
privatevirtual

Analyse request and create reply when a read-modify-write bits is observed.

Parameters
aAddressthe base address of the write
aAndTermthe value to be and'ed
aOrTermthe value to be or'ed

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 336 of file DummyHardware.cpp.

◆ rmw_sum()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::rmw_sum ( const uint32_t &  aAddress,
const uint32_t &  aAddend 
)
privatevirtual

Analyse request and create reply when a read-modify-write sum is observed.

Parameters
aAddressthe base address of the write
aAddendthe value to be added

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 306 of file DummyHardware.cpp.

◆ SetEndpoint()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::SetEndpoint ( const uint32_t &  aAddress,
const uint32_t &  aValue 
)
protected

Definition at line 164 of file DummyHardware.cpp.

References uhal::tests::ADDRESSMASK.

◆ status_packet_header()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::status_packet_header
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.

◆ unknown_packet_header()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::unknown_packet_header
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.

◆ unknown_type()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::unknown_type
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().

◆ write()

template<uint8_t IPbus_major, uint8_t IPbus_minor>
void uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::write ( const uint32_t &  aAddress,
std::vector< uint32_t >::const_iterator &  aIt,
const std::vector< uint32_t >::const_iterator &  aEnd 
)
privatevirtual

Analyse request and create reply when an incrementing write is observed.

Parameters
aAddressthe base address of the write
aItiterator to the start of the payload
aEnditerator to the end of the payload

Reimplemented from uhal::HostToTargetInspector< IPbus_major, IPbus_minor >.

Definition at line 277 of file DummyHardware.cpp.

Member Data Documentation

◆ mBigEndianHack

template<uint8_t IPbus_major, uint8_t IPbus_minor>
bool uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mBigEndianHack
private

Whether we are talking to an IPbus client which includes the big-endian hack.

Definition at line 219 of file DummyHardware.hpp.

◆ mConfigurationSpace

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::vector< uint32_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mConfigurationSpace
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().

◆ mLastPacketHeader

template<uint8_t IPbus_major, uint8_t IPbus_minor>
uint32_t uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mLastPacketHeader
protected

The last sent packet header for the retry mechanism (IPbus 2.0 and above only)

Definition at line 207 of file DummyHardware.hpp.

◆ mMemory

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::vector< uint32_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mMemory
private

The memory space of the virtual hardware.

Definition at line 192 of file DummyHardware.hpp.

◆ mReceive

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::vector< uint32_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mReceive
protected

The buffer for the incoming IPbus packet.

Definition at line 199 of file DummyHardware.hpp.

◆ mReceivedControlPacketHeaderHistory

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::deque< uint32_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mReceivedControlPacketHeaderHistory
protected

History of the received control packet headers.

Definition at line 213 of file DummyHardware.hpp.

◆ mReply

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::vector< uint32_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mReply
protected

The buffer for the outgoing IPbus packet.

Definition at line 201 of file DummyHardware.hpp.

◆ mReplyHistory

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::deque< std::pair< uint32_t , std::vector< uint32_t > > > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mReplyHistory
protected

The history of the replies for the retry mechanism (IPbus 2.0 and above only)

Definition at line 204 of file DummyHardware.hpp.

◆ mSentControlPacketHeaderHistory

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::deque< uint32_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mSentControlPacketHeaderHistory
protected

History of the sent control packet headers.

Definition at line 215 of file DummyHardware.hpp.

◆ mTrafficHistory

template<uint8_t IPbus_major, uint8_t IPbus_minor>
std::deque< uint8_t > uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::mTrafficHistory
protected

History of the IPbus 2.0 packet-types received.

Definition at line 210 of file DummyHardware.hpp.


The documentation for this class was generated from the following files: