ChimeraTK-DeviceAccess  03.18.00
CtrlIntf.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 
5 #include "DeviceFile.h"
6 #include "XdmaIntfAbstract.h"
7 
8 #include <string>
9 
10 namespace ChimeraTK {
11 
12  // Control (config/status) interface to access the registers of FPGA IPs
13  class CtrlIntf : public XdmaIntfAbstract {
14  DeviceFile _file;
15  void* _mem;
16 
17  // Size of mmap'ed area in PCI BAR
18  size_t _mmapSize;
19  // 4 KiB is the minimum size available in Vivado
20  static constexpr size_t _mmapSizeMin = 4 * 1024;
21  static constexpr size_t _mmapSizeMax = 16 * 1024 * 1024;
22 
23  volatile int32_t* _reg_ptr(uintptr_t offs) const;
24  void _check_range(const std::string access_type, uintptr_t address, size_t nBytes) const;
25 
26  public:
27  CtrlIntf() = delete;
28  CtrlIntf(const std::string& devicePath);
29  virtual ~CtrlIntf();
30 
31  void read(uintptr_t address, int32_t* __restrict__ buf, size_t nBytes) override;
32  void write(uintptr_t address, const int32_t* data, size_t nBytes) override;
33  };
34 
35 } // namespace ChimeraTK
DeviceFile.h
ChimeraTK::DeviceFile
Definition: DeviceFile.h:12
ChimeraTK::CtrlIntf::write
void write(uintptr_t address, const int32_t *data, size_t nBytes) override
Definition: CtrlIntf.cc:66
ChimeraTK::XdmaIntfAbstract
Definition: XdmaIntfAbstract.h:10
ChimeraTK::CtrlIntf::read
void read(uintptr_t address, int32_t *__restrict__ buf, size_t nBytes) override
Definition: CtrlIntf.cc:53
ChimeraTK::CtrlIntf::~CtrlIntf
virtual ~CtrlIntf()
Definition: CtrlIntf.cc:35
ChimeraTK::CtrlIntf::CtrlIntf
CtrlIntf()=delete
XdmaIntfAbstract.h
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::CtrlIntf
Definition: CtrlIntf.h:13