ChimeraTK-DeviceAccess
03.18.00
|
The shared dummy device opens a mapping file defining the registers and implements them in shared memory instead of connecting to the real device. More...
#include <SharedDummyBackend.h>
Public Member Functions | |
SharedDummyBackend (const std::string &instanceId, const std::string &mapFileName) | |
~SharedDummyBackend () override | |
void | open () override |
Open the device. More... | |
void | closeImpl () override |
All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close. More... | |
void | read (uint64_t bar, uint64_t address, int32_t *data, size_t sizeInBytes) override |
Read function to be implemented by backends. More... | |
void | write (uint64_t bar, uint64_t address, int32_t const *data, size_t sizeInBytes) override |
Write function to be implemented by backends. More... | |
std::string | readDeviceInfo () override |
Return a device information string containing hardware details like the firmware version number or the slot number used by the board. More... | |
VersionNumber | triggerInterrupt (uint32_t interruptNumber) override |
Simulate the arrival of an interrupt. More... | |
void | read ([[maybe_unused]] uint8_t bar,[[maybe_unused]] uint32_t address,[[maybe_unused]] int32_t *data,[[maybe_unused]] size_t sizeInBytes) final |
You cannot override the read version with 32 bit address any more. More... | |
void | write ([[maybe_unused]] uint8_t bar,[[maybe_unused]] uint32_t address,[[maybe_unused]] int32_t const *data,[[maybe_unused]] size_t sizeInBytes) final |
You cannot override the write version with 32 bit address any more. More... | |
Public Member Functions inherited from ChimeraTK::DummyBackendBase | |
DummyBackendBase (std::string const &mapFileName) | |
~DummyBackendBase () override=default | |
size_t | minimumTransferAlignment ([[maybe_unused]] uint64_t bar) const override |
Determines the supported minimum alignment for any read/write requests. More... | |
DEFINE_VIRTUAL_FUNCTION_OVERRIDE_VTABLE (NumericAddressedBackend, getRegisterAccessor_impl, boost::shared_ptr< NDRegisterAccessor< T >>(const RegisterPath &, size_t, size_t, AccessModeFlags)) | |
void | read ([[maybe_unused]] uint8_t bar, [[maybe_unused]] uint32_t address, [[maybe_unused]] int32_t *data, [[maybe_unused]] size_t sizeInBytes) final |
You cannot override the read version with 32 bit address any more. More... | |
void | write ([[maybe_unused]] uint8_t bar, [[maybe_unused]] uint32_t address, [[maybe_unused]] int32_t const *data, [[maybe_unused]] size_t sizeInBytes) final |
You cannot override the write version with 32 bit address any more. More... | |
bool | barIndexValid ([[maybe_unused]] uint64_t bar) override |
All bars are valid in dummies. More... | |
std::map< uint64_t, size_t > | getBarSizesInBytesFromRegisterMapping () const |
Determines the size of each bar because the DummyBackends allocate memory per bar. More... | |
template<typename UserType > | |
boost::shared_ptr< NDRegisterAccessor< UserType > > | getRegisterAccessor_impl (const RegisterPath ®isterPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags) |
Specific override which allows to create "DUMMY_INTEERRUPT_X" accessors. More... | |
Public Member Functions inherited from ChimeraTK::NumericAddressedBackend | |
NumericAddressedBackend (const std::string &mapFileName="", std::unique_ptr< NumericAddressedRegisterCatalogue > registerMapPointer=std::make_unique< NumericAddressedRegisterCatalogue >()) | |
~NumericAddressedBackend () override=default | |
virtual bool | barIndexValid (uint64_t bar) |
Function to be implemented by the backends. More... | |
virtual bool | canMergeRequests () const |
Determines whether the backend supports merging of requests (read or write) More... | |
RegisterCatalogue | getRegisterCatalogue () const override |
Return the register catalogue with detailed information on all registers. More... | |
MetadataCatalogue | getMetadataCatalogue () const override |
Return the device metadata catalogue. More... | |
NumericAddressedRegisterInfo | getRegisterInfo (const RegisterPath ®isterPathName) |
getRegisterInfo returns a NumericAddressedRegisterInfo object for the given register. More... | |
void | activateAsyncRead () noexcept override |
Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set. More... | |
void | close () final |
Deactivates all asynchronous accessors and calls closeImpl(). More... | |
virtual std::future< void > | activateSubscription (uint32_t interruptNumber, boost::shared_ptr< async::DomainImpl< std::nullptr_t >> asyncDomain) |
Activate/create the subscription for a given interrupt (for instance by starting the according interrupt handling thread). More... | |
void | setExceptionImpl () noexcept override |
Turn off the internal variable which remembers that async is active. More... | |
template<typename BackendSpecificUserType > | |
std::pair< BackendSpecificUserType, VersionNumber > | getAsyncDomainInitialValue (size_t asyncDomainId) |
Get the initial value for a certain async::Domain. More... | |
template<typename BackendSpecificUserType > | |
std::pair< BackendSpecificUserType, VersionNumber > | getAsyncDomainInitialValue ([[maybe_unused]] size_t asyncDomainId) |
Public Member Functions inherited from ChimeraTK::DeviceBackendImpl | |
bool | isOpen () override |
Return whether a device has been opened or not. More... | |
bool | isConnected () final |
Deprecated since 2022-03-03. More... | |
void | checkActiveException () final |
Function to be called by backends when needing to check for an active exception. More... | |
void | setException (const std::string &message) noexcept final |
Set the backend into an exception state. More... | |
bool | isFunctional () const noexcept final |
Return whether a device is working as intended, usually this means it is opened and does not have any errors. More... | |
std::string | getActiveExceptionMessage () noexcept |
Public Member Functions inherited from ChimeraTK::DeviceBackend | |
virtual | ~DeviceBackend ()=default |
Every virtual class needs a virtual desctructor. More... | |
template<typename UserType > | |
boost::shared_ptr< NDRegisterAccessor< UserType > > | getRegisterAccessor (const RegisterPath ®isterPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags) |
Get a NDRegisterAccessor object from the register name. More... | |
DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (getRegisterAccessor_impl, boost::shared_ptr< NDRegisterAccessor< T >>(const RegisterPath &, size_t, size_t, AccessModeFlags)) | |
Static Public Member Functions | |
static boost::shared_ptr< DeviceBackend > | createInstance (std::string address, std::map< std::string, std::string > parameters) |
Static Public Member Functions inherited from ChimeraTK::DummyBackendBase | |
static void | checkSizeIsMultipleOfWordSize (size_t sizeInBytes) |
template<typename T , typename... Args> | |
static boost::shared_ptr< DeviceBackend > | returnInstance ([[maybe_unused]] const std::string &instanceId, Args &&... arguments) |
Backward compatibility: Leftover from the time when the dummy managed it's own map to return the same instance multiple times, and still allow to use the same map file with different instances. More... | |
Additional Inherited Members | |
Public Attributes inherited from ChimeraTK::DummyBackendBase | |
std::atomic< bool > | throwExceptionOpen {false} |
std::atomic< bool > | throwExceptionRead {false} |
std::atomic< bool > | throwExceptionWrite {false} |
std::atomic< size_t > | throwExceptionCounter {0} |
Protected Member Functions inherited from ChimeraTK::DeviceBackendImpl | |
void | setOpenedAndClearException () noexcept |
Backends should call this function at the end of a (successful) open() call. More... | |
Protected Attributes inherited from ChimeraTK::NumericAddressedBackend | |
std::unique_ptr< NumericAddressedRegisterCatalogue > | _registerMapPointer |
NumericAddressedRegisterCatalogue & | _registerMap |
MetadataCatalogue | _metadataCatalogue |
metadata catalogue More... | |
std::mutex | _unalignedAccess |
mutex for protecting unaligned access More... | |
friend | NumericAddressedLowLevelTransferElement |
friend | TriggeredPollDistributor |
Protected Attributes inherited from ChimeraTK::DeviceBackendImpl | |
std::atomic< bool > | _opened {false} |
flag if backend is opened More... | |
async::DomainsContainer | _asyncDomainsContainer |
Container for async::Domains to support wait_for_new_data. More... | |
The shared dummy device opens a mapping file defining the registers and implements them in shared memory instead of connecting to the real device.
Thus, it provides access to the registers from several applications. The registers an application accesses can be stimulated or monitored by another process, e.g. for development and testing.
Accessing applications are required to the same mapping file (matching absolute path) and to be run by the same user.
Definition at line 47 of file SharedDummyBackend.h.
ChimeraTK::SharedDummyBackend::SharedDummyBackend | ( | const std::string & | instanceId, |
const std::string & | mapFileName | ||
) |
Definition at line 22 of file SharedDummyBackend.cc.
|
override |
Definition at line 28 of file SharedDummyBackend.cc.
|
overridevirtual |
All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close.
Like this it is assured that the deactivation of the asynchronous accessors is always executed.
Reimplemented from ChimeraTK::NumericAddressedBackend.
Definition at line 61 of file SharedDummyBackend.cc.
|
static |
Definition at line 114 of file SharedDummyBackend.cc.
|
overridevirtual |
Open the device.
Implements ChimeraTK::DeviceBackend.
Definition at line 57 of file SharedDummyBackend.cc.
|
inlinefinal |
You cannot override the read version with 32 bit address any more.
Please change your implementation to the 64 bit signature.
Definition at line 55 of file DummyBackendBase.h.
|
overridevirtual |
Read function to be implemented by backends.
TODO: Add documentation!
Reimplemented from ChimeraTK::NumericAddressedBackend.
Definition at line 65 of file SharedDummyBackend.cc.
|
overridevirtual |
Return a device information string containing hardware details like the firmware version number or the slot number used by the board.
The format and contained information of this string is completely backend implementation dependent, so the string may only be printed to the user as an informational output. Do not try to parse this string or extract information from it programmatically.
Implements ChimeraTK::DeviceBackend.
Definition at line 94 of file SharedDummyBackend.cc.
|
overridevirtual |
Simulate the arrival of an interrupt.
For all push-type accessors which have been created for that particular interrupt number, the data will be read out through a synchronous accessor and pushed into the data transport queues of the asynchronous accessors, so they can be received by the application.
Implements ChimeraTK::DummyBackendBase.
Definition at line 139 of file SharedDummyBackend.cc.
|
inlinefinal |
You cannot override the write version with 32 bit address any more.
Please change your implementation to the 64 bit signature.
Definition at line 63 of file DummyBackendBase.h.
|
overridevirtual |
Write function to be implemented by backends.
TODO: Add documentation!
Reimplemented from ChimeraTK::NumericAddressedBackend.
Definition at line 79 of file SharedDummyBackend.cc.