ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
UioBackend.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
6#include "UioAccess.h"
7
8#include <thread>
9
10namespace ChimeraTK {
11
13 private:
14 std::shared_ptr<UioAccess> _uioAccess;
15
16 std::thread _interruptWaitingThread;
17 std::atomic<bool> _stopInterruptLoop{false}; // Used to shut down thread
18
19 void waitForInterruptLoop(std::promise<void> subscriptionDonePromise);
20
21 /* data */
22 public:
24 const std::string& deviceName, const std::string& mapFileName, const std::string& dataConsistencyKeyDescriptor);
25 ~UioBackend() override;
26
27 static boost::shared_ptr<DeviceBackend> createInstance(
28 std::string address, std::map<std::string, std::string> parameters);
29
30 void open() override;
31 void closeImpl() override;
32
33 size_t minimumTransferAlignment([[maybe_unused]] uint64_t bar) const override { return 4; }
34
35 bool barIndexValid(uint64_t bar) override;
36
37 void read(uint64_t bar, uint64_t address, int32_t* data, size_t sizeInBytes) override;
38 void write(uint64_t bar, uint64_t address, int32_t const* data, size_t sizeInBytes) override;
39 std::future<void> activateSubscription(
40 uint32_t interruptNumber, boost::shared_ptr<async::DomainImpl<std::nullptr_t>> asyncDomain) override;
41
42 std::string readDeviceInfo() override;
43
44 boost::shared_ptr<async::DomainImpl<std::nullptr_t>> _asyncDomain;
45 };
46
47} // namespace ChimeraTK
Base class for address-based device backends (e.g.
static boost::shared_ptr< DeviceBackend > createInstance(std::string address, std::map< std::string, std::string > parameters)
Definition UioBackend.cc:19
void open() override
Open the device.
Definition UioBackend.cc:34
void closeImpl() override
All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close.
Definition UioBackend.cc:46
std::future< void > activateSubscription(uint32_t interruptNumber, boost::shared_ptr< async::DomainImpl< std::nullptr_t > > asyncDomain) override
Activate/create the subscription for a given interrupt (for instance by starting the according interr...
Definition UioBackend.cc:77
std::string readDeviceInfo() override
Return a device information string containing hardware details like the firmware version number or th...
Definition UioBackend.cc:98
boost::shared_ptr< async::DomainImpl< std::nullptr_t > > _asyncDomain
Definition UioBackend.h:44
size_t minimumTransferAlignment(uint64_t bar) const override
Determines the supported minimum alignment for any read/write requests.
Definition UioBackend.h:33
bool barIndexValid(uint64_t bar) override
Function to be implemented by the backends.
Definition UioBackend.cc:59