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:
23 UioBackend(std::string deviceName, std::string mapFileName);
24 ~UioBackend() override;
25
26 static boost::shared_ptr<DeviceBackend> createInstance(
27 std::string address, std::map<std::string, std::string> parameters);
28
29 void open() override;
30 void closeImpl() override;
31
32 size_t minimumTransferAlignment([[maybe_unused]] uint64_t bar) const override { return 4; }
33
34 bool barIndexValid(uint64_t bar) override;
35
36 void read(uint64_t bar, uint64_t address, int32_t* data, size_t sizeInBytes) override;
37 void write(uint64_t bar, uint64_t address, int32_t const* data, size_t sizeInBytes) override;
38 std::future<void> activateSubscription(
39 uint32_t interruptNumber, boost::shared_ptr<async::DomainImpl<std::nullptr_t>> asyncDomain) override;
40
41 std::string readDeviceInfo() override;
42
43 boost::shared_ptr<async::DomainImpl<std::nullptr_t>> _asyncDomain;
44 };
45
46} // 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:16
void open() override
Open the device.
Definition UioBackend.cc:24
void closeImpl() override
All backends derrived from NumericAddressedBackend must implement closeImpl() instead of close.
Definition UioBackend.cc:36
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:67
std::string readDeviceInfo() override
Return a device information string containing hardware details like the firmware version number or th...
Definition UioBackend.cc:88
boost::shared_ptr< async::DomainImpl< std::nullptr_t > > _asyncDomain
Definition UioBackend.h:43
size_t minimumTransferAlignment(uint64_t bar) const override
Determines the supported minimum alignment for any read/write requests.
Definition UioBackend.h:32
bool barIndexValid(uint64_t bar) override
Function to be implemented by the backends.
Definition UioBackend.cc:49