ChimeraTK-DeviceAccess  03.18.00
testGenericMuxedInterruptDistributor.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 GenericMuxedInterruptDistributorTest
6 #include "Device.h"
7 #include "DummyBackend.h"
9 
10 #include <boost/test/unit_test.hpp>
11 
12 #include <chrono>
13 #include <thread>
14 
15 using namespace ChimeraTK;
16 using namespace boost::unit_test_framework;
17 
18 bool readWithTimeout(VoidRegisterAccessor& acc, size_t msTimeout = 3000) {
19  auto startTime = std::chrono::steady_clock::now();
20  auto currentTime = startTime;
21  while(currentTime < startTime + std::chrono::milliseconds(msTimeout)) {
22  std::this_thread::sleep_for(std::chrono::milliseconds(10));
23  if(acc.readNonBlocking()) {
24  return true;
25  }
26  currentTime = std::chrono::steady_clock::now();
27  }
28  return false;
29 }
30 
31 BOOST_AUTO_TEST_SUITE(INTCHandlerTestSuite)
32 
33 static constexpr std::string_view testCdd{"(WriteMonitoring:xdma/slot5?map=irq_test.mapp)"};
34 
35 /********************************************************************************************************************/
36 
37 // We need a special backend because the firmware has several "clear on 1", which internally modify
38 // individual bits in a word. We have to monitor the writes and log this state. Only looking at the last write is not sufficient.
40  public:
41  WriteMonitoringBackend(const std::string& mapFileName) : DummyBackend(mapFileName) {
42  acknowledged["ISR"] = 0;
43  acknowledged["IAR"] = 0;
44  acknowledged["ICR"] = 0;
45 
46  setWriteCallbackFunction(AddressRange(0, 0x00800008, 4),
47  [&] { acknowledged["ISR"] |= static_cast<uint32_t>(getRawAccessor("TEST0", "ISR")); });
48  setWriteCallbackFunction(AddressRange(0, 0x0090000C, 4),
49  [&] { acknowledged["IAR"] |= static_cast<uint32_t>(getRawAccessor("TEST1", "IAR")); });
50  setWriteCallbackFunction(AddressRange(0, 0x00A0000C, 4),
51  [&] { acknowledged["ICR"] |= static_cast<uint32_t>(getRawAccessor("TEST2", "ICR")); });
52  setWriteCallbackFunction(AddressRange(0, 0x00D00008, 4),
53  [&] { acknowledged["ISR"] |= static_cast<uint32_t>(getRawAccessor("TEST5", "ISR")); });
54  setWriteCallbackFunction(AddressRange(0, 0x00D0000C, 4), // comment for formatting
55  [&] { sie |= static_cast<uint32_t>(getRawAccessor("TEST5", "SIE")); });
56  }
57 
58  static boost::shared_ptr<DeviceBackend> createInstance(
59  [[maybe_unused]] std::string address, std::map<std::string, std::string> parameters) {
60  if(parameters["map"].empty()) {
61  throw ChimeraTK::logic_error("No map file name given.");
62  }
63  return boost::shared_ptr<DeviceBackend>(new WriteMonitoringBackend(parameters["map"]));
64  }
65 
66  std::map<std::string, uint32_t> acknowledged;
67  uint32_t sie{0};
68 };
69 
71  public:
74  "WriteMonitoring", &WriteMonitoringBackend::createInstance);
75  }
76 };
77 
78 static BackendRegisterer b;
79 
80 /********************************************************************************************************************/
81 
82 struct TestFixture {
83  Device device{std::string{testCdd}};
87  uint32_t _interrupt;
88  boost::shared_ptr<WriteMonitoringBackend> dummyBackend;
89 
90  TestFixture(uint32_t interrupt, bool activateAsyncFirst) : _interrupt(interrupt) {
91  dummyBackend = boost::dynamic_pointer_cast<WriteMonitoringBackend>(device.getBackend());
92  assert(dummyBackend);
93 
94  if(activateAsyncFirst) {
95  device.open();
97  }
98 
100  "!" + std::to_string(interrupt) + ":4", {ChimeraTK::AccessMode::wait_for_new_data}));
101  dummyInterrupt.replace(device.getVoidRegisterAccessor("DUMMY_INTERRUPT_" + std::to_string(interrupt)));
102  isr.replace(
103  device.getScalarRegisterAccessor<uint32_t>("TEST" + std::to_string(interrupt) + "/ISR/DUMMY_WRITEABLE"));
104 
105  if(activateAsyncFirst) {
106  // only if asyncRead is active we will get an initial value. Pop it here for convenience.
107  BOOST_TEST(readWithTimeout(accInterrupt));
108  }
109  }
110 
111  virtual ~TestFixture() { device.close(); }
112 };
113 
114 /********************************************************************************************************************/
115 
122  Device device{std::string{testCdd}};
124 
125  ThrowTestFixture(uint32_t interrupt) {
126  std::string testRegister("!" + std::to_string(interrupt) + ":4");
127  try {
128  accInterrupt.replace(device.getVoidRegisterAccessor(testRegister, {ChimeraTK::AccessMode::wait_for_new_data}));
129  BOOST_CHECK_MESSAGE(false, "Creating register \"" + testRegister + "\" did not throw as expected!");
130  }
131  catch(ChimeraTK::logic_error& e) {
132  std::cout << "Caught expected exception for " << boost::unit_test::framework::current_test_case().p_name
133  << ". Print for manual check of message: " << e.what() << std::endl;
134  BOOST_CHECK(true); // just to have a hook for the last successful test
135  }
136  }
137 };
138 
139 /********************************************************************************************************************/
140 
141 struct Inactive0 : public TestFixture {
142  Inactive0() : TestFixture(0, false) {}
143 };
145  device.open();
146 
147  auto ier = device.getScalarRegisterAccessor<int>("TEST0/IER");
148  ier.read();
149  BOOST_TEST(0x0 == ier);
150  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0);
151 
153 
154  ier.read();
155  BOOST_TEST(0x10 == ier);
156  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x10);
157  dummyBackend->acknowledged["ISR"] = 0;
158 
160  ier.read();
161  BOOST_TEST(ier == 0x30);
162  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x20); // we must NOT acknowledge 0x10 again!
163 
164  accInterrupt.replace(VoidRegisterAccessor{});
165 
166  // FIXME: This is the expected result if the SubDomain destructor would notify the MuxedInterruptDistributor.
167  // This is not implemented yet.
168 #if false
169  ier.read();
170  BOOST_TEST(ier == 0x20); // only the second iterator remains
171 #endif
172 
173  // at this point the Domain and with it the MuxedInterruptDistributor goe out of scope, and the distributor's
174  // destructor is kicking in.
175  accInterrupt2.replace(VoidRegisterAccessor{});
176  ier.read();
177  BOOST_TEST(ier == 0x0);
178 }
179 
180 struct Active0 : public TestFixture {
181  Active0() : TestFixture(0, true) {}
182 };
184  auto ier = device.getScalarRegisterAccessor<int>("TEST0/IER");
185  ier.read();
186  BOOST_TEST(0x10 == ier);
187  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x10);
188  // no need to repeat all following tests in inactiveIER here.
189 }
190 
191 /*********************************************************************************************************************/
192 BOOST_AUTO_TEST_CASE(activateOnActiveDomain) {
193  // Test that the activation is called correctly for all members if the upper layers in the distribution tree are
194  // already active Tree:
195  //
196  // Domain 3 - SubDomain [3] -- VariableDistributor<void> [3]
197  // \_ MuxedInterruptDistibutor [3] --- SubDomain [3, 0] -- VariableDistributor<void> [3, 0]
198  // \ \_ MuxedInterruptDistibutor [3, 0]
199  // \_ SubDomain [3, 1] -- VariableDistributor<void> [3, 1]
200  // \_ MuxedInterruptDistibutor [3, 1]
202  device.open(std::string{testCdd});
204 
205  // Create the domain and check that it is active
207  readWithTimeout(accessor3); // initial value
208  auto dummyInterruptTrigger =
209  device.getVoidRegisterAccessor("DUMMY_INTERRUPT_3"); // for triggering the dummy interrupt
210  dummyInterruptTrigger.write();
211  readWithTimeout(accessor3); // initial value
212 
213  // Test 1: get an accessor for a sub SubDomain of MuxedInterruptDistibutor [3], which is in the already
214  // active SubDomain [3].
216  readWithTimeout(acc3_0);
217 
218  // Test that the MuxedInterruptDistibutor [3] has been activated
219  // MER might be write-only
220  BOOST_TEST(
221  device.read<int32_t>("TEST3/MER/DUMMY_READABLE") == 0x3); // MER always has two bits which both have to be set
222 
223  // Test that the handshake for sub-domain [3, 0] has been activated
224  BOOST_TEST(device.read<uint32_t>("TEST3/IER") == (1U << 0));
225 
226  // Test 2: The the SubDomain behind the MuxedInterruptDistributor [3] itself is activated (not only the handshake) if
227  // the distributor is already active. We use SubDomain [3, 1] for this and test the SubDomain activation indirectly by
228  // the activation of the MuxedInterruptDistibutor [3, 1]
230  readWithTimeout(acc3_1);
231 
232  BOOST_TEST(device.read<int32_t>("TEST3/SUB1/MER") == 0x3);
233  BOOST_TEST(device.read<uint32_t>("TEST3/SUB1/IER") == (1U << 3));
234 }
235 
236 struct AcknowledgeTest : public TestFixture {
237  AcknowledgeTest(uint32_t interrupt, std::string ackReg) : TestFixture(interrupt, true), ackRegister(ackReg) {}
238 
240  std::string ackRegister;
241 
242  void run() {
243  // acknowledge has been written when activating
244  BOOST_TEST(dummyBackend->acknowledged[ackRegister] == 0x10);
245 
246  // prepare the status before sending the interrupt
247  // set one more bit to be sensitive to the handshake (need to see changes)
248  isr.setAndWrite(0x11);
249 
250  dummyBackend->acknowledged[ackRegister] = 0;
251 
252  dummyInterrupt.write();
253  // wait until interrupt handler is done
254  BOOST_TEST(readWithTimeout(accInterrupt));
255 
256  BOOST_TEST(dummyBackend->acknowledged[ackRegister] == 0x10);
257 
258  dummyBackend->acknowledged[ackRegister] = 0;
259  accInterrupt2.replace(device.getVoidRegisterAccessor(
260  "!" + std::to_string(_interrupt) + ":5", {ChimeraTK::AccessMode::wait_for_new_data}));
261  BOOST_TEST(dummyBackend->acknowledged[ackRegister] == 0x20);
262  readWithTimeout(accInterrupt2); // pop the initial value
263 
264  // Signal the first accessor
265 
266  isr.setAndWrite(0x11);
267 
268  dummyBackend->acknowledged[ackRegister] = 0;
269  dummyInterrupt.write();
270  BOOST_TEST(readWithTimeout(accInterrupt));
271  BOOST_CHECK(!accInterrupt2.readNonBlocking());
272 
273  BOOST_TEST(dummyBackend->acknowledged[ackRegister] == 0x10);
274  if(ackRegister != "ISR") {
275  BOOST_TEST(isr.readAndGet() == 0x11);
276  }
277 
278  // Signal the second accessor
279  isr.setAndWrite(0x21);
280 
281  dummyBackend->acknowledged[ackRegister] = 0;
282  dummyInterrupt.write();
283  BOOST_TEST(readWithTimeout(accInterrupt2));
284  BOOST_CHECK(!accInterrupt.readNonBlocking());
285 
286  BOOST_TEST(dummyBackend->acknowledged[ackRegister] == 0x20);
287  if(ackRegister != "ISR") {
288  BOOST_TEST(isr.readAndGet() == 0x21);
289  }
290 
291  // Signal both
292  isr.setAndWrite(0x31);
293 
294  dummyBackend->acknowledged[ackRegister] = 0;
295  dummyInterrupt.write();
296  BOOST_TEST(readWithTimeout(accInterrupt));
297  BOOST_TEST(readWithTimeout(accInterrupt2));
298 
299  BOOST_TEST(dummyBackend->acknowledged[ackRegister] == 0x30);
300  if(ackRegister != "ISR") {
301  BOOST_TEST(isr.readAndGet() == 0x31);
302  }
303  }
304 };
305 
306 /**********************************************************************************************************************/
307 
308 // ISR is used as acknowledge register
311 };
313  run();
314 }
315 
316 /**********************************************************************************************************************/
317 /*if IAR is present: INTC writes 1<<n the according bit mask to IAR and not to ISR*/
320 };
322  run();
323 }
324 
325 /**********************************************************************************************************************/
326 /* if ICR is present: INTC writes 1<<n the according bit mask to ICR and not to ISR */
327 
330 };
332  run();
333 }
334 
335 struct MasterEnableTest : public TestFixture {
336  MasterEnableTest(uint32_t interrupt, std::string meRegister, bool enableFirst)
337  : TestFixture(interrupt, enableFirst), isEnabled(enableFirst) {
338  masterEnable.replace(device.getScalarRegisterAccessor<uint32_t>(
339  RegisterPath("TEST" + std::to_string(interrupt)) / meRegister / "DUMMY_READABLE"));
340  }
341 
343  bool isEnabled;
344 
345  void run() {
346  if(!isEnabled) {
347  device.open();
348 
349  // MER should not be set
350  BOOST_TEST(masterEnable.readAndGet() == 0x0);
351 
353  }
354 
355  // MER should be set now
356  BOOST_TEST(masterEnable.readAndGet() == 0x3); // last two bits active
357  }
358 };
359 /********************************************************************************************************************/
360 
362  MerInactiveTestFixture() : MasterEnableTest(3, "MER", false) {}
363 };
365  run();
366 }
368  MerActiveTestFixture() : MasterEnableTest(3, "MER", true) {}
369 };
371  run();
372 }
373 
374 /********************************************************************************************************************/
375 BOOST_AUTO_TEST_CASE(testIMR) { // TEST4
377 
378  device.open("(dummy:xdma/slot5?map=irq_test.mapp)");
379  BOOST_TEST(device.isOpened() == true);
380 
381  auto imr = device.getScalarRegisterAccessor<uint32_t>("TEST4.IMR");
382  imr.setAndWrite(0x7F); // 7 bits in this register (see map file)
383 
384  // IMR is not implemented yet. This is giving an exception at the moment.
385  try {
386  auto accInterrput = device.getScalarRegisterAccessor<int>("!4:4", 0, {ChimeraTK::AccessMode::wait_for_new_data});
387  BOOST_CHECK_MESSAGE(false, "IMR not detected as invalid option.");
388  }
389  catch(ChimeraTK::logic_error& e) {
390  std::cout << "Caught expected exeption. Print for manual check of message: " << e.what() << std::endl;
391  // We skip the rest of the test for now, but leave the code below.
392  return;
393  }
394 
396 
397  BOOST_TEST(imr.readAndGet() == 0x6F);
398 
399  device.close();
400 }
401 
402 /********************************************************************************************************************/
403 
404 struct Inactive5 : public TestFixture {
405  Inactive5() : TestFixture(5, false) {}
406 };
408  auto sie = device.getScalarRegisterAccessor<int>("TEST5/SIE/DUMMY_READABLE");
409  auto cie = device.getScalarRegisterAccessor<int>("TEST5/CIE/DUMMY_READABLE");
410 
411  device.open();
412 
413  // pre-condition: both registers are 0
414  BOOST_TEST(sie.readAndGet() == 0x0);
415  BOOST_TEST(cie.readAndGet() == 0x0);
416  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x0);
417  BOOST_TEST(isr.readAndGet() == 0x0);
418 
419  // activate
421 
422  // only SIE has been written
423  BOOST_TEST(sie.readAndGet() == 0x10);
424  BOOST_TEST(isr.readAndGet() == 0x10);
425  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x10);
426  BOOST_TEST(cie.readAndGet() == 0x0);
427 
428  // remove the accessor. CIE should be written
429  accInterrupt.replace(VoidRegisterAccessor{});
430 
431  BOOST_TEST(cie.readAndGet() == 0x10);
432 }
433 
434 BOOST_FIXTURE_TEST_CASE(testSieCieMulti1, Inactive5) {
435  // Mixed activation: the second accessor is created AFTER activateAsyncRead
436  auto sie = device.getScalarRegisterAccessor<int>("TEST5/SIE/DUMMY_READABLE");
437  auto cie = device.getScalarRegisterAccessor<int>("TEST5/CIE/DUMMY_READABLE");
438 
439  device.open();
441  BOOST_TEST(sie.readAndGet() == 0x10); // just to be safe, we already know this from the previous test
442  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x10);
443  dummyBackend->acknowledged["ISR"] = 0x0;
444 
446  sie.read();
447  BOOST_CHECK_MESSAGE((sie == 0x20) || // the implementation can either only set the new bit
448  (sie == 0x30), // or send the whole mask again
449  "SIE is " + std::to_string(sie) + ", but should be 0x20 or 0x30");
450  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x20); // we must NOT acknowledge 0x10 again!
451 
452  accInterrupt.replace(VoidRegisterAccessor{});
453 
454  // FIXME: This is the expected result if the SubDomain destructor would notify the MuxedInterruptDistributor.
455  // This is not implemented yet.
456 #if false
457  BOOST_TEST(cie.readAndGet() == 0x10);
458 #endif
459 
460  // at this point the Domain and with it the MuxedInterruptDistributor goe out of scope, and the distributor's
461  // destructor is kicking in.
462  accInterrupt2.replace(VoidRegisterAccessor{});
463 
464  // FIXME: Finally wanted behaviour: There is only one accessor left
465 #if false
466  BOOST_TEST(cie.readAndGet() == 0x20);
467 #endif
468  // Actual behaviour: Both flags are written at the same time.
469  BOOST_TEST(cie.readAndGet() == 0x30);
470 }
471 
472 BOOST_FIXTURE_TEST_CASE(testSieCieMulti2, Inactive5) {
473  // Create both accessors first, then call activateAsyncRead()
474  // No need to check the clear section again. It's the same as above.
476 
477  BOOST_TEST(dummyBackend->sie == 0x0);
478  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x0);
479 
480  device.open();
482 
483  BOOST_TEST(dummyBackend->sie == 0x30); // both bits set, no matter whether at the same time or individually
484  BOOST_TEST(dummyBackend->acknowledged["ISR"] == 0x30);
485 }
486 
487 /**********************************************************************************************************************/
488 
490  GieInactiveTestFixture() : MasterEnableTest(6, "GIE", false) {}
491 };
493  run();
494 }
496  GieActiveTestFixture() : MasterEnableTest(6, "GIE", true) {}
497 };
499  run();
500 }
501 
502 /********************************************************************************************************************/
503 
505  MieInactiveTestFixture() : MasterEnableTest(7, "MIE", false) {}
506 };
508  run();
509 }
511  MieActiveTestFixture() : MasterEnableTest(7, "MIE", true) {}
512 };
514  run();
515 }
516 
517 /********************************************************************************************************************/
518 /* ERROR Scenarios */
519 /**********************************************************************************************************************/
520 
523 };
525 
526 /********************************************************************************************************************/
527 
530 };
531 BOOST_FIXTURE_TEST_CASE(testJsonErrorInGeneralStructure, InvalidJson1TestFixture) {}
532 
533 /********************************************************************************************************************/
534 
537 };
538 BOOST_FIXTURE_TEST_CASE(testJsonErrorInIntcSprecific, InvalidJson2TestFixture) {}
539 
540 /********************************************************************************************************************/
541 
544 };
546 
547 /********************************************************************************************************************/
548 
551 };
553 
554 /********************************************************************************************************************/
555 
558 };
560 
561 /********************************************************************************************************************/
562 
565 };
567 
568 /********************************************************************************************************************/
569 
572 };
574 
575 /********************************************************************************************************************/
576 
579 };
581 
582 /********************************************************************************************************************/
583 
586 };
588 
589 /********************************************************************************************************************/
590 
591 // Adapt this when more versions are added
594 };
596 
597 /********************************************************************************************************************/
598 
599 // Adapt this when more versions are added
602 };
604 
605 /********************************************************************************************************************/
606 
609 };
611 
612 /********************************************************************************************************************/
613 
616 };
618 
619 /********************************************************************************************************************/
620 
623 };
625 
626 /********************************************************************************************************************/
627 
630 };
632 
633 /********************************************************************************************************************/
634 
637 };
639 
640 /********************************************************************************************************************/
641 
642 // ISR must be writeable if there is no ICR/IAR
645 };
647 
648 /********************************************************************************************************************/
649 
652 };
654 
655 /********************************************************************************************************************/
656 
659 };
661 
662 /********************************************************************************************************************/
663 
666 };
668 
669 /********************************************************************************************************************/
670 
673 };
675 
676 /********************************************************************************************************************/
677 
680 };
682 
683 /********************************************************************************************************************/
684 
687 };
689 
690 /********************************************************************************************************************/
691 
694 };
696 
697 /********************************************************************************************************************/
698 
701 };
703 
704 /********************************************************************************************************************/
705 
706 BOOST_AUTO_TEST_SUITE_END()
AcknowledgeTest::AcknowledgeTest
AcknowledgeTest(uint32_t interrupt, std::string ackReg)
Definition: testGenericMuxedInterruptDistributor.cpp:237
IsrReadableTestFixture::IsrReadableTestFixture
IsrReadableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:636
MerInactiveTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:361
UnknownOptionTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:521
OnlySieTestFixture::OnlySieTestFixture
OnlySieTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:543
NoIsrTestFixture::NoIsrTestFixture
NoIsrTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:564
WriteMonitoringBackend::createInstance
static boost::shared_ptr< DeviceBackend > createInstance([[maybe_unused]] std::string address, std::map< std::string, std::string > parameters)
Definition: testGenericMuxedInterruptDistributor.cpp:58
NoIsrTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:563
AcknowledgeTest::ackRegister
std::string ackRegister
Definition: testGenericMuxedInterruptDistributor.cpp:240
MieInactiveTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:504
MieAndMerTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:614
IerWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:650
MasterEnableTest::MasterEnableTest
MasterEnableTest(uint32_t interrupt, std::string meRegister, bool enableFirst)
Definition: testGenericMuxedInterruptDistributor.cpp:336
NoPathTestFixture::NoPathTestFixture
NoPathTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:578
device
ctk::Device device
Definition: testExceptionDummyDevice.cc:18
InvalidJson2TestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:535
NoIerTestFixture::NoIerTestFixture
NoIerTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:571
ChimeraTK::Device::close
void close()
Close the device.
Definition: Device.cc:66
ChimeraTK::Device::getBackend
boost::shared_ptr< DeviceBackend > getBackend()
Obtain the backend.
Definition: Device.cc:111
ChimeraTK::BackendFactory::getInstance
static BackendFactory & getInstance()
Static function to get an instance of factory.
Definition: BackendFactory.cc:191
AcknowledgeTest::run
void run()
Definition: testGenericMuxedInterruptDistributor.cpp:242
IcrTestFixture::IcrTestFixture
IcrTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:329
DummyBackend.h
ChimeraTK::Device::getVoidRegisterAccessor
VoidRegisterAccessor getVoidRegisterAccessor(const RegisterPath &registerPathName, const AccessModeFlags &flags=AccessModeFlags({})) const
Get a VoidRegisterAccessor object for the given register.
Definition: Device.cc:103
ChimeraTK::Device::read
UserType read(const RegisterPath &registerPathName, const AccessModeFlags &flags=AccessModeFlags({})) const
Inefficient convenience function to read a single-word register without obtaining an accessor.
Definition: Device.h:293
MieAndGieTestFixture::MieAndGieTestFixture
MieAndGieTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:608
GieInactiveTestFixture::GieInactiveTestFixture
GieInactiveTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:490
CieWritableTestFixture::CieWritableTestFixture
CieWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:700
Inactive0::Inactive0
Inactive0()
Definition: testGenericMuxedInterruptDistributor.cpp:142
IsrReadableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:635
NonexistendPathTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:584
ChimeraTK::testable_rebot_sleep::now
boost::chrono::steady_clock::time_point now()
Definition: testableRebotSleep.cc:7
ChimeraTK::VoidRegisterAccessor::read
void read()
Definition: VoidRegisterAccessor.h:44
MieAndGieTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:607
Active0::Active0
Active0()
Definition: testGenericMuxedInterruptDistributor.cpp:181
WriteMonitoringBackend::acknowledged
std::map< std::string, uint32_t > acknowledged
Definition: testGenericMuxedInterruptDistributor.cpp:66
MieInactiveTestFixture::MieInactiveTestFixture
MieInactiveTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:505
IarWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:664
ThrowTestFixture
Test that a logic error is thrown as soon as you try to get an accessor with invalid map file entries...
Definition: testGenericMuxedInterruptDistributor.cpp:121
UnknownMainKeyTestFixture::UnknownMainKeyTestFixture
UnknownMainKeyTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:601
TestFixture::~TestFixture
virtual ~TestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:111
ChimeraTK::DummyBackend::AddressRange
Definition: DummyBackend.h:82
TestFixture::dummyBackend
boost::shared_ptr< WriteMonitoringBackend > dummyBackend
Definition: testGenericMuxedInterruptDistributor.cpp:88
BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(inactiveIER, Inactive0)
Definition: testGenericMuxedInterruptDistributor.cpp:144
ChimeraTK::ScalarRegisterAccessor::readAndGet
UserType readAndGet()
Convenience function to read and return a value of UserType.
Definition: ScalarRegisterAccessor.h:300
TestFixture::TestFixture
TestFixture(uint32_t interrupt, bool activateAsyncFirst)
Definition: testGenericMuxedInterruptDistributor.cpp:90
ThrowTestFixture::accInterrupt
VoidRegisterAccessor accInterrupt
Definition: testGenericMuxedInterruptDistributor.cpp:123
GieActiveTestFixture::GieActiveTestFixture
GieActiveTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:496
MieWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:671
GieAndMerTestFixture::GieAndMerTestFixture
GieAndMerTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:622
ChimeraTK::ScalarRegisterAccessor< uint32_t >
MieAndMerTestFixture::MieAndMerTestFixture
MieAndMerTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:615
InvalidJson1TestFixture::InvalidJson1TestFixture
InvalidJson1TestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:529
InvalidJson1TestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:528
IarAndIcrTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:556
MasterEnableTest
Definition: testGenericMuxedInterruptDistributor.cpp:335
IcrWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:657
GieActiveTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:495
UnknownMainKeyTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:600
CieWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:699
Inactive5::Inactive5
Inactive5()
Definition: testGenericMuxedInterruptDistributor.cpp:405
ChimeraTK::VoidRegisterAccessor::readNonBlocking
bool readNonBlocking()
Definition: VoidRegisterAccessor.h:53
IcrWritableTestFixture::IcrWritableTestFixture
IcrWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:658
UnknownOptionTestFixture::UnknownOptionTestFixture
UnknownOptionTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:522
ChimeraTK::NDRegisterAccessorAbstractor::replace
void replace(const NDRegisterAccessorAbstractor< UserType > &newAccessor)
Assign a new accessor to this NDRegisterAccessorAbstractor.
Definition: NDRegisterAccessorAbstractor.h:67
MerWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:685
GieInactiveTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:489
Active0
Definition: testGenericMuxedInterruptDistributor.cpp:180
Inactive5
Definition: testGenericMuxedInterruptDistributor.cpp:404
IsrTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:309
ChimeraTK::Device::activateAsyncRead
void activateAsyncRead() noexcept
Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set.
Definition: Device.cc:91
GieWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:678
ChimeraTK::AccessMode::wait_for_new_data
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.
IarAndIcrTestFixture::IarAndIcrTestFixture
IarAndIcrTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:557
Device.h
WriteMonitoringBackend
Definition: testGenericMuxedInterruptDistributor.cpp:39
ChimeraTK::VoidRegisterAccessor
Accessor class to read and write void-typed registers.
Definition: VoidRegisterAccessor.h:14
OnlySieTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:542
MieGieAndMerTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:628
TestFixture::isr
ScalarRegisterAccessor< uint32_t > isr
Definition: testGenericMuxedInterruptDistributor.cpp:86
MieWritableTestFixture::MieWritableTestFixture
MieWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:672
UnknownVersionTestFixture::UnknownVersionTestFixture
UnknownVersionTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:593
MerActiveTestFixture::MerActiveTestFixture
MerActiveTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:368
MieGieAndMerTestFixture::MieGieAndMerTestFixture
MieGieAndMerTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:629
NoIerTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:570
IsrTestFixture::IsrTestFixture
IsrTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:310
ChimeraTK::logic_error::what
const char * what() const noexcept override
Return the message describing what exactly went wrong.
Definition: Exception.cpp:20
BackendRegisterer::BackendRegisterer
BackendRegisterer()
Definition: testGenericMuxedInterruptDistributor.cpp:72
OnlyCieTestFixture::OnlyCieTestFixture
OnlyCieTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:550
ChimeraTK::Device
Class allows to read/write registers from device.
Definition: Device.h:39
MasterEnableTest::run
void run()
Definition: testGenericMuxedInterruptDistributor.cpp:345
UnknownVersionTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:592
IarWritableTestFixture::IarWritableTestFixture
IarWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:665
MieActiveTestFixture::MieActiveTestFixture
MieActiveTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:511
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
IcrTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:328
BackendRegisterer
Definition: testGenericMuxedInterruptDistributor.cpp:70
IarTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:318
InvalidJson2TestFixture::InvalidJson2TestFixture
InvalidJson2TestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:536
AcknowledgeTest::accInterrupt2
VoidRegisterAccessor accInterrupt2
Definition: testGenericMuxedInterruptDistributor.cpp:239
DummyRegisterAccessor.h
ChimeraTK::RegisterPath
Class to store a register path name.
Definition: RegisterPath.h:16
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
NoPathTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:577
TestFixture::dummyInterrupt
VoidRegisterAccessor dummyInterrupt
Definition: testGenericMuxedInterruptDistributor.cpp:85
ChimeraTK::Device::isOpened
bool isOpened() const
Check if the device is currently opened.
Definition: Device.cc:73
WriteMonitoringBackend::WriteMonitoringBackend
WriteMonitoringBackend(const std::string &mapFileName)
Definition: testGenericMuxedInterruptDistributor.cpp:41
SieWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:692
GieWritableTestFixture::GieWritableTestFixture
GieWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:679
TestFixture::accInterrupt
VoidRegisterAccessor accInterrupt
Definition: testGenericMuxedInterruptDistributor.cpp:84
MerInactiveTestFixture::MerInactiveTestFixture
MerInactiveTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:362
ChimeraTK::DummyBackend
The dummy device opens a mapping file instead of a device, and implements all registers defined in th...
Definition: DummyBackend.h:45
IerWritableTestFixture::IerWritableTestFixture
IerWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:651
Inactive0
Definition: testGenericMuxedInterruptDistributor.cpp:141
MasterEnableTest::masterEnable
ScalarRegisterAccessor< uint32_t > masterEnable
Definition: testGenericMuxedInterruptDistributor.cpp:342
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(activateOnActiveDomain)
Definition: testGenericMuxedInterruptDistributor.cpp:192
SieWritableTestFixture::SieWritableTestFixture
SieWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:693
ThrowTestFixture::ThrowTestFixture
ThrowTestFixture(uint32_t interrupt)
Definition: testGenericMuxedInterruptDistributor.cpp:125
ChimeraTK::BackendFactory::registerBackendType
void registerBackendType(const std::string &backendType, boost::shared_ptr< DeviceBackend >(*creatorFunction)(std::string address, std::map< std::string, std::string > parameters), const std::vector< std::string > &sdmParameterNames={}, const std::string &deviceAccessVersion=CHIMERATK_DEVICEACCESS_VERSION)
Register a backend by the name backendType with the given creatorFunction.
Definition: BackendFactory.cc:45
ChimeraTK::TransferElementAbstractor::write
bool write(ChimeraTK::VersionNumber versionNumber={})
Write the data to device.
Definition: TransferElementAbstractor.h:89
MerWritableTestFixture::MerWritableTestFixture
MerWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:686
TestFixture::_interrupt
uint32_t _interrupt
Definition: testGenericMuxedInterruptDistributor.cpp:87
MieActiveTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:510
MasterEnableTest::isEnabled
bool isEnabled
Definition: testGenericMuxedInterruptDistributor.cpp:343
ChimeraTK
Definition: DummyBackend.h:16
MerActiveTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:367
ChimeraTK::to_string
std::string to_string(Boolean &value)
Definition: SupportedUserTypes.h:59
IarTestFixture::IarTestFixture
IarTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:319
NonexistendPathTestFixture::NonexistendPathTestFixture
NonexistendPathTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:585
IsrWritableTestFixture::IsrWritableTestFixture
IsrWritableTestFixture()
Definition: testGenericMuxedInterruptDistributor.cpp:644
ChimeraTK::logic_error
Exception thrown when a logic error has occured.
Definition: Exception.h:51
readWithTimeout
bool readWithTimeout(VoidRegisterAccessor &acc, size_t msTimeout=3000)
Definition: testGenericMuxedInterruptDistributor.cpp:18
AcknowledgeTest
Definition: testGenericMuxedInterruptDistributor.cpp:236
IsrWritableTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:643
OnlyCieTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:549
GieAndMerTestFixture
Definition: testGenericMuxedInterruptDistributor.cpp:621