ChimeraTK-DeviceAccess  03.18.00
testLargeBar.cpp
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 
4 #define BOOST_TEST_DYN_LINK
5 #define BOOST_TEST_MODULE LargeBarNumberTest
6 #include <boost/test/unit_test.hpp>
7 using namespace boost::unit_test_framework;
8 
9 /* This test is checking that 64-bit BARs are working as expected
10  */
11 
12 #include "Device.h"
14 using namespace ChimeraTK;
15 
16 BOOST_AUTO_TEST_CASE(testLargeBarNumber) {
17  Device d;
18  d.open("(dummy?map=goodMapFile.map)");
19 
20  // Checking the large bar in the RegisterInfo checks the map file parser and the data type in the catalogue
21  auto registerInfo = d.getRegisterCatalogue().getRegister("LARGE_BAR/NUMBER");
22  BOOST_CHECK_EQUAL(dynamic_cast<NumericAddressedRegisterInfo&>(registerInfo.getImpl()).bar, 0x100000000);
23 
24  // this is a smoke test that reading and writing works with a large BAR map file
25  auto intAccessor = d.getScalarRegisterAccessor<int32_t>("LARGE_BAR/NUMBER");
26  // intAccessor.read();
27 
28  // intAccessor = 42;
29  // intAccessor.write();
30 }
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(testLargeBarNumber)
Definition: testLargeBar.cpp:16
ChimeraTK::NumericAddressedRegisterInfo
Definition: NumericAddressedRegisterCatalogue.h:15
ChimeraTK::RegisterCatalogue::getRegister
RegisterInfo getRegister(const RegisterPath &registerPathName) const
Get register information for a given full path name.
Definition: RegisterCatalogue.cc:43
ChimeraTK::NumericAddressedRegisterInfo::bar
uint64_t bar
Upper part of the address (name originally from PCIe, meaning now generalised)
Definition: NumericAddressedRegisterCatalogue.h:113
Device.h
ChimeraTK::Device::getRegisterCatalogue
RegisterCatalogue getRegisterCatalogue() const
Return the register catalogue with detailed information on all registers.
Definition: Device.cc:22
NumericAddressedRegisterCatalogue.h
ChimeraTK::Device
Class allows to read/write registers from device.
Definition: Device.h:39
ChimeraTK::Device::open
void open(std::string const &aliasName)
Open a device by the given alias name from the DMAP file.
Definition: Device.cc:58
ChimeraTK::Device::getScalarRegisterAccessor
ScalarRegisterAccessor< UserType > getScalarRegisterAccessor(const RegisterPath &registerPathName, size_t wordOffsetInRegister=0, const AccessModeFlags &flags=AccessModeFlags({})) const
Get a ScalarRegisterObject object for the given register.
Definition: Device.h:263
ChimeraTK
Definition: DummyBackend.h:16