ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
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>
7using 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"
14using namespace ChimeraTK;
15
16BOOST_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}
Class allows to read/write registers from device.
Definition Device.h:39
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:266
RegisterCatalogue getRegisterCatalogue() const
Return the register catalogue with detailed information on all registers.
Definition Device.cc:22
void open(std::string const &aliasName)
Open a device by the given alias name from the DMAP file.
Definition Device.cc:58
uint64_t bar
Upper part of the address (name originally from PCIe, meaning now generalised)
RegisterInfo getRegister(const RegisterPath &registerPathName) const
Get register information for a given full path name.
BOOST_AUTO_TEST_CASE(testLargeBarNumber)