|
μHAL (v2.7.9)
Part of the IPbus software repository
|
Go to the documentation of this file.
41 #include <boost/test/unit_test.hpp>
55 HwInterface
hw = getHwInterface();
57 uint32_t
x =
static_cast<uint32_t
> ( rand() );
64 ValWord<uint32_t> reg_l =
hw.
getNode (
"REG_LOWER_MASK" ).
read();
65 ValWord<uint32_t> reg_u =
hw.
getNode (
"REG_UPPER_MASK" ).
read();
BOOST_CHECK(!mem.valid())
BOOST_CHECK_THROW(hw.getNode("REG").writeBlockOffset(xx, 0), uhal::exception::BulkTransferOffsetRequestedForSingleRegister)
void dispatch()
Make the IPbus client issue a dispatch.
An abstract base exception class, including an interface to throw as the derived type (for passing ex...
UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite, block_write_read, DummyHardwareFixture, { std::vector< size_t > lDepths=getBlockUnitTestDepths(quickTest ? N_1MB :N_10MB);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
ValWord< uint32_t > read() const
Read a single, unmasked, unsigned word.
const uint32_t & getMask() const
Return the mask to be applied if this node is a sub-field, rather than an entire register.
BOOST_CHECK_NO_THROW(hw.getNode("REG").writeBlock(xx))
BOOST_CHECK_EQUAL(mem.size(), N)
ValHeader write(const uint32_t &aValue) const
Write a single, unmasked word to a register.
const Node & getNode() const
Retrieve the top-level node.