ChimeraTK-DeviceAccess 03.20.00
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChimeraTK::PcieBackend Class Reference

A class to provide the Pcie device functionality. More...

#include <PcieBackend.h>

+ Inheritance diagram for ChimeraTK::PcieBackend:
+ Collaboration diagram for ChimeraTK::PcieBackend:

Public Member Functions

 PcieBackend (std::string deviceNodeName, const std::string &mapFileName="")
 constructor called through createInstance to create device object
 
 ~PcieBackend () override
 
void open () override
 Open the device.
 
void closeImpl () override
 All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close.
 
void read (uint8_t bar, uint32_t address, int32_t *data, size_t sizeInBytes) override
 Deprecated read function using 32bit address for backwards compatibility.
 
void write (uint8_t bar, uint32_t address, int32_t const *data, size_t sizeInBytes) override
 Deprecated write function using 32bit address for backwards compatibility.
 
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.
 
- Public Member Functions inherited from ChimeraTK::NumericAddressedBackend
 NumericAddressedBackend (const std::string &mapFileName="", std::unique_ptr< NumericAddressedRegisterCatalogue > registerMapPointer=std::make_unique< NumericAddressedRegisterCatalogue >(), const std::string &dataConsistencyKeyDescriptor="")
 
 ~NumericAddressedBackend () override=default
 
virtual void read (uint64_t bar, uint64_t address, int32_t *data, size_t sizeInBytes)
 Read function to be implemented by backends.
 
virtual void write (uint64_t bar, uint64_t address, int32_t const *data, size_t sizeInBytes)
 Write function to be implemented by backends.
 
virtual bool barIndexValid (uint64_t bar)
 Function to be implemented by the backends.
 
virtual bool canMergeRequests () const
 Determines whether the backend supports merging of requests (read or write)
 
RegisterCatalogue getRegisterCatalogue () const override
 Return the register catalogue with detailed information on all registers.
 
MetadataCatalogue getMetadataCatalogue () const override
 Return the device metadata catalogue.
 
NumericAddressedRegisterInfo getRegisterInfo (const RegisterPath &registerPathName)
 getRegisterInfo returns a NumericAddressedRegisterInfo object for the given register.
 
void activateAsyncRead () noexcept override
 Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set.
 
void close () final
 Deactivates all asynchronous accessors and calls closeImpl().
 
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).
 
void setExceptionImpl () noexcept override
 Turn off the internal variable which remembers that async is active.
 
template<typename BackendSpecificUserType >
std::pair< BackendSpecificUserType, VersionNumbergetAsyncDomainInitialValue (size_t asyncDomainId)
 Get the initial value for a certain async::Domain.
 
- Public Member Functions inherited from ChimeraTK::DeviceBackendImpl
bool isOpen () override
 Return whether a device has been opened or not.
 
bool isConnected () final
 Deprecated since 2022-03-03.
 
void checkActiveException () final
 Function to be called by backends when needing to check for an active exception.
 
void setException (const std::string &message) noexcept final
 Set the backend into an exception state.
 
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.
 
std::string getActiveExceptionMessage () noexcept
 
std::set< DeviceBackend::BackendIDgetInvolvedBackendIDs () override
 Get the backend IDs of all involved backends.
 
- Public Member Functions inherited from ChimeraTK::DeviceBackend
virtual ~DeviceBackend ()=default
 Every virtual class needs a virtual desctructor.
 
template<typename UserType >
boost::shared_ptr< NDRegisterAccessor< UserType > > getRegisterAccessor (const RegisterPath &registerPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags)
 Get a NDRegisterAccessor object from the register name.
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (getRegisterAccessor_impl, boost::shared_ptr< NDRegisterAccessor< T > >(const RegisterPath &, size_t, size_t, AccessModeFlags))
 
BackendID getBackendID ()
 Get a unique ID for this backend instance.
 

Static Public Member Functions

static boost::shared_ptr< DeviceBackendcreateInstance (std::string address, std::map< std::string, std::string > parameters)
 

Additional Inherited Members

- Public Types inherited from ChimeraTK::DeviceBackend
using BackendID = std::uintptr_t
 
- Protected Member Functions inherited from ChimeraTK::DeviceBackendImpl
void setOpenedAndClearException () noexcept
 Backends should call this function at the end of a (successful) open() call.
 
- Protected Attributes inherited from ChimeraTK::NumericAddressedBackend
std::unique_ptr< NumericAddressedRegisterCatalogue_registerMapPointer
 
NumericAddressedRegisterCatalogue_registerMap
 
MetadataCatalogue _metadataCatalogue
 metadata catalogue
 
std::mutex _unalignedAccess
 mutex for protecting unaligned access
 
friend NumericAddressedLowLevelTransferElement
 
friend TriggeredPollDistributor
 
- Protected Attributes inherited from ChimeraTK::DeviceBackendImpl
std::atomic< bool > _opened {false}
 flag if backend is opened
 
async::DomainsContainer _asyncDomainsContainer
 Container for async::Domains to support wait_for_new_data.
 

Detailed Description

A class to provide the Pcie device functionality.

"

Definition at line 17 of file PcieBackend.h.

Constructor & Destructor Documentation

◆ PcieBackend()

ChimeraTK::PcieBackend::PcieBackend ( std::string  deviceNodeName,
const std::string &  mapFileName = "" 
)
explicit

constructor called through createInstance to create device object

Definition at line 28 of file PcieBackend.cc.

◆ ~PcieBackend()

ChimeraTK::PcieBackend::~PcieBackend ( )
override

Definition at line 32 of file PcieBackend.cc.

Member Function Documentation

◆ closeImpl()

void ChimeraTK::PcieBackend::closeImpl ( )
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 115 of file PcieBackend.cc.

◆ createInstance()

boost::shared_ptr< DeviceBackend > ChimeraTK::PcieBackend::createInstance ( std::string  address,
std::map< std::string, std::string >  parameters 
)
static

Definition at line 307 of file PcieBackend.cc.

◆ open()

void ChimeraTK::PcieBackend::open ( )
overridevirtual

Open the device.

Implements ChimeraTK::DeviceBackend.

Definition at line 36 of file PcieBackend.cc.

◆ read()

void ChimeraTK::PcieBackend::read ( uint8_t  bar,
uint32_t  address,
int32_t *  data,
size_t  sizeInBytes 
)
overridevirtual

Deprecated read function using 32bit address for backwards compatibility.

Old backends which have not yet been updated to the new 64 bit address interface will implement this. Please implement the read() function with the 64 bit address signature instead!

Note: deprecated with warning since 2022-07-28 remove after end of 2023.

Reimplemented from ChimeraTK::NumericAddressedBackend.

Definition at line 198 of file PcieBackend.cc.

◆ readDeviceInfo()

std::string ChimeraTK::PcieBackend::readDeviceInfo ( )
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 286 of file PcieBackend.cc.

◆ write()

void ChimeraTK::PcieBackend::write ( uint8_t  bar,
uint32_t  address,
int32_t const *  data,
size_t  sizeInBytes 
)
overridevirtual

Deprecated write function using 32bit address for backwards compatibility.

Old backends which have not yet been updated to the new 64 bit address interface will implement this. Please implement the write() function with the 64 bit address signature instead!

Note: deprecated with warning since 2022-07-28, remove after end of 2023.

Reimplemented from ChimeraTK::NumericAddressedBackend.

Definition at line 217 of file PcieBackend.cc.


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