42 #include <boost/test/unit_test.hpp> 52 HwInterface
hw = getHwInterface();
54 IPbusCore&
client =
dynamic_cast<IPbusCore&
>(hw.getClient());
56 for (
size_t i = 0; i < 10; i++) {
57 const uint32_t expectedValue = uint16_t(getpid()) << 16 | i;
66 ValWord<uint32_t>
x = client.readConfigurationSpace(i);
81 for (
size_t i = 0; i < 10; i++) {
82 const uint32_t expectedValue = uint16_t(getpid()) << 16 | i;
ValWord< uint32_t > readConfigurationSpace(const uint32_t &aAddr)
Read a single, unmasked, unsigned word from the configuration address space.
void dispatch()
Method to dispatch all IPbus packets which are in the queue of IPbusPacketInfo's and wait until all q...
T value() const
Return the value of the validated memory with check on validity.
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite, block_write_read, DummyHardwareFixture, { std::vector< size_t > lDepths=getBlockUnitTestDepths();for(size_t i=0;i< lDepths.size();i++) { const size_t N=lDepths.at(i);BOOST_TEST_MESSAGE(" N = "<< N);HwInterface hw=getHwInterface();std::vector< uint32_t > xx;xx.reserve(N);for(size_t i=0;i!=N;++i) { xx.push_back(static_cast< uint32_t >(rand()));} hw.getNode("LARGE_MEM").writeBlock(xx);ValVector< uint32_t > mem=hw.getNode("LARGE_MEM").readBlock(N);BOOST_CHECK(!mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);if(N > 0) { BOOST_CHECK_THROW(mem.at(0), uhal::exception::NonValidatedMemory);} BOOST_CHECK_THROW(mem.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);if(N< N_10MB) { bool correct_block_write_read=true;std::vector< uint32_t >::const_iterator j=xx.begin();for(ValVector< uint32_t >::const_iterator i(mem.begin());i!=mem.end();++i,++j) { correct_block_write_read=correct_block_write_read &&(*i== *j);} BOOST_CHECK(correct_block_write_read);} } }) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite
BOOST_CHECK_THROW(hw.getNode("REG").writeBlockOffset(xx, 0), uhal::exception::BulkTransferOffsetRequestedForSingleRegister)
A class providing the core IPbus packing functionality.
BOOST_CHECK_EQUAL(hw.getNode("SUBSYSTEM1.SUBMODULE.REG").getAddress(), hw.getNode("SUBSYSTEM1").getNode("SUBMODULE").getNode("REG").getAddress())
ClientInterface & getClient()
Get the underlying IPbus client.