|
μHAL (v2.7.9)
Part of the IPbus software repository
|
Go to the documentation of this file.
40 #ifndef _uhal_ClientInterface_hpp_
41 #define _uhal_ClientInterface_hpp_
50 #include <boost/date_time/posix_time/posix_time_types.hpp>
51 #include <boost/shared_ptr.hpp>
52 #include <boost/weak_ptr.hpp>
53 #include <boost/thread/mutex.hpp>
65 class ClientInterface;
81 UHAL_DEFINE_EXCEPTION_CLASS ( BitsSetWhichAreForbiddenByBitMask , "Exception class to handle the case where a masked
write was attempted with a data source which has non-zero bits outside the bit-mask's bounds." )
87 UHAL_DEFINE_EXCEPTION_CLASS ( NullBufferException , "Exception class to handle a NULL buffer being passed to the transport class." )
91 UHAL_DEFINE_EXCEPTION_CLASS ( TransactionLevelError, "Base exception class covering situations in which a transaction-level error occurs (i.e. error occurs in individual read/
write).")
108 ClientInterface (
const std::string& aId,
const URI& aUri ,
const boost::posix_time::time_duration& aTimeoutPeriod );
135 const std::string& id()
const;
146 const std::string&
uri()
const;
163 uint64_t getTimeoutPeriod();
171 const boost::posix_time::time_duration& getBoostTimeoutPeriod();
180 ValHeader write (
const uint32_t& aAddr,
const uint32_t& aValue );
188 ValHeader write (
const uint32_t& aAddr,
const uint32_t& aValue,
const uint32_t& aMask );
229 ValWord< uint32_t > rmw_bits (
const uint32_t& aAddr ,
const uint32_t& aANDterm ,
const uint32_t& aORterm );
247 virtual void Flush( );
307 virtual uint32_t getPreambleSize();
319 std::pair < ValHeader , _ValHeader_* > CreateValHeader();
334 std::pair < ValVector<uint32_t> ,
_ValVector_<uint32_t>* > CreateValVector (
const uint32_t& aSize );
354 uint8_t* aSendBufferEnd ,
355 std::deque< std::pair< uint8_t* , uint32_t > >::iterator aReplyStartIt ,
356 std::deque< std::pair< uint8_t* , uint32_t > >::iterator aReplyEndIt ) = 0;
359 virtual void dispatchExceptionHandler();
387 void updateCurrentBuffers();
388 void deleteBuffers();
399 std::deque < boost::shared_ptr< Buffers > >
mBuffers;
401 #ifdef NO_PREEMPTIVE_DISPATCH
402 std::deque < boost::shared_ptr< Buffers > > mNoPreemptiveDispatchBuffers;
435 virtual boost::shared_ptr< Buffers > checkBufferSpace (
const uint32_t& aSendSize ,
const uint32_t& aReplySize , uint32_t& aAvailableSendSize , uint32_t& aAvailableReplySize );
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
#define UHAL_DEFINE_EXCEPTION_CLASS(ClassName, ClassDescription)
A class providing the core IPbus packing functionality.
boost::shared_ptr< Buffers > mCurrentBuffers
A pointer to a buffer-wrapper object.
virtual ValHeader implementWriteBlock(const uint32_t &aAddr, const std::vector< uint32_t > &aValues, const defs::BlockReadWriteMode &aMode=defs::INCREMENTAL)=0
Write a block of data to a block of registers or a block-write port.
virtual ValWord< uint32_t > implementRMWbits(const uint32_t &aAddr, const uint32_t &aANDterm, const uint32_t &aORterm)=0
Read the value of a register, apply the AND-term, apply the OR-term, set the register to this new val...
An abstract base class for defining the interface to the various IPbus clients as well as providing t...
An abstract base exception class, including an interface to throw as the derived type (for passing ex...
virtual void implementDispatch(boost::shared_ptr< Buffers > aBuffers)=0
Pure virtual function which actually performs the dispatch operation.
virtual uint32_t getMaxSendSize()=0
Return the maximum size to be sent based on the buffer size in the target.
hw setTimeoutPeriod(timeout)
std::string mId
the identifier of the target for this client
BlockReadWriteMode
define whether transactions target a single register, a block of registers, a block-read/write port o...
for(size_t i=0;i< lDepths.size();i++)
virtual uint32_t getMaxNumberOfBuffers()=0
Return the maximum number of packets in flight.
boost::mutex mUserSideMutex
A MutEx lock used to make sure the access functions are thread safe.
virtual ValWord< uint32_t > implementRead(const uint32_t &aAddr, const uint32_t &aMask=defs::NOMASK)=0
Read a single, masked, unsigned word.
virtual ValVector< uint32_t > implementReadBlock(const uint32_t &aAddr, const uint32_t &aSize, const defs::BlockReadWriteMode &aMode=defs::INCREMENTAL)=0
Read a block of unsigned data from a block of registers or a block-read port.
boost::posix_time::time_duration mTimeoutPeriod
Timeout period for transactions.
URI mUri
a struct containing the full URI of the target for this client
A Template helper struct wrapping a block of IPbus header, a register for storing a block of data and...
virtual ValHeader implementBOT()=0
Send a byte order transaction.
A Template helper struct wrapping an IPbus header, a register for storing a single word of data,...
Struct to store a URI when parsed by boost spirit.
virtual ValHeader implementWrite(const uint32_t &aAddr, const uint32_t &aValue)=0
Write a single, unmasked word to a register.
std::string getAddressDescription(const ClientInterface &, const uint32_t, const size_t &)
Generates a short string summarising which nodes match the specified address.
const uint32_t NOMASK
define what it means to have no mask
boost::mutex mBufferMutex
A MutEx lock used to make sure the access to the buffers is thread safe.
virtual ValWord< uint32_t > implementRMWsum(const uint32_t &aAddr, const int32_t &aAddend)=0
Read the value of a register, add the addend, set the register to this new value and return a copy of...
virtual exception::exception * validate(uint8_t *aSendBufferStart, uint8_t *aSendBufferEnd, std::deque< std::pair< uint8_t *, uint32_t > >::iterator aReplyStartIt, std::deque< std::pair< uint8_t *, uint32_t > >::iterator aReplyEndIt)=0
Function which the dispatch calls when the reply is received to check that the headers are as expecte...
virtual uint32_t getMaxReplySize()=0
Return the maximum size of reply packet based on the buffer size in the target.
std::deque< boost::shared_ptr< Buffers > > mBuffers
A memory pool of buffers which will be dispatched.
boost::weak_ptr< Node > mNode