Skip to content

Commit 13dede8

Browse files
committed
[cru] Remove Generator Size parameter
1 parent c370840 commit 13dede8

File tree

5 files changed

+0
-67
lines changed

5 files changed

+0
-67
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ class ProgramDmaBench : public Program
153153
options.add_options()("generator",
154154
po::value<bool>(&mOptions.generatorEnabled)->default_value(true),
155155
"Enable data generator");
156-
options.add_options()("generator-size",
157-
SuffixOption<size_t>::make(&mOptions.dataGeneratorSize)->default_value("0"),
158-
"Data generator data size. 0 will use internal driver default.");
159156
Options::addOptionCardId(options);
160157
options.add_options()("links",
161158
po::value<std::string>(&mOptions.links)->default_value("0"),
@@ -1101,7 +1098,6 @@ class ProgramDmaBench : public Program
11011098
std::string links;
11021099
bool generatorEnabled = false;
11031100
bool bufferFullCheck = false;
1104-
size_t dataGeneratorSize;
11051101
size_t dmaPageSize;
11061102
std::string loopbackModeString;
11071103
std::string timeLimitString;

src/Cru/CruBar.cxx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -363,29 +363,6 @@ FirmwareFeatures CruBar::convertToFirmwareFeatures(uint32_t reg)
363363
return features;
364364
}
365365

366-
/// Sets the bits for the data generator size in the given integer
367-
/// \param bits Integer with bits to set
368-
/// \param size Size to set
369-
void CruBar::setDataGeneratorSizeBits(uint32_t& bits, size_t size)
370-
{
371-
if (!Utilities::isMultiple(size, 32ul)) {
372-
BOOST_THROW_EXCEPTION(Exception()
373-
<< ErrorInfo::Message("Unsupported generator data size for CRU; must be multiple of 32 bytes")
374-
<< ErrorInfo::GeneratorEventLength(size));
375-
}
376-
377-
if (size < 32 || size > Cru::DMA_PAGE_SIZE) {
378-
BOOST_THROW_EXCEPTION(Exception()
379-
<< ErrorInfo::Message("Unsupported generator data size for CRU; must be >= 32 bytes and <= 8 KiB")
380-
<< ErrorInfo::GeneratorEventLength(size));
381-
}
382-
383-
// We set the size in 256-bit (32 byte) words and do -1 because that's how it works.
384-
uint32_t sizeValue = ((size / 32) - 1) << 8;
385-
bits &= ~(uint32_t(0xff00));
386-
bits += sizeValue;
387-
}
388-
389366
/// Sets the bits for the data generator enabled in the given integer
390367
/// \param bits Integer with bits to set
391368
/// \param enabled Generator enabled or not
@@ -394,14 +371,6 @@ void CruBar::setDataGeneratorEnableBits(uint32_t& bits, bool enabled)
394371
Utilities::setBit(bits, 0, enabled);
395372
}
396373

397-
/// Sets the bits for the data generator random size in the given integer
398-
/// \param bits Integer with bits to set
399-
/// \param enabled Random enabled or not
400-
void CruBar::setDataGeneratorRandomSizeBits(uint32_t& bits, bool enabled)
401-
{
402-
Utilities::setBit(bits, 16, enabled);
403-
}
404-
405374
/// Reports the CRU status
406375
Cru::ReportInfo CruBar::report()
407376
{

src/Cru/CruBar.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class CruBar final : public BarInterfaceBase
7373

7474
static FirmwareFeatures convertToFirmwareFeatures(uint32_t reg);
7575

76-
static void setDataGeneratorSizeBits(uint32_t& bits, size_t size);
7776
static void setDataGeneratorEnableBits(uint32_t& bits, bool enabled);
7877
static void setDataGeneratorRandomSizeBits(uint32_t& bits, bool enabled);
7978

test/TestCruBar.cxx

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,4 @@ BOOST_AUTO_TEST_CASE(TestDataGeneratorConfiguration)
6060
CruBar::setDataGeneratorEnableBits(bits, false);
6161
BOOST_CHECK(bits == 0x0);
6262
}
63-
{
64-
uint32_t bits = 0;
65-
CruBar::setDataGeneratorRandomSizeBits(bits, true);
66-
BOOST_CHECK(bits == (1 << 16));
67-
CruBar::setDataGeneratorRandomSizeBits(bits, false);
68-
BOOST_CHECK(bits != (1 << 16));
69-
}
70-
{
71-
uint32_t bits = 0;
72-
CruBar::setDataGeneratorEnableBits(bits, true);
73-
BOOST_CHECK(bits == 0x1);
74-
CruBar::setDataGeneratorSizeBits(bits, 8 * 1024);
75-
BOOST_CHECK(bits == 0xff03);
76-
}
77-
{
78-
uint32_t bits = 0;
79-
CruBar::setDataGeneratorEnableBits(bits, true);
80-
CruBar::setDataGeneratorSizeBits(bits, 32);
81-
BOOST_CHECK(bits == 0x0003);
82-
}
83-
{
84-
uint32_t bits = 0;
85-
// Too high value
86-
BOOST_CHECK_THROW(CruBar::setDataGeneratorSizeBits(bits, 8 * 1024 + 1), std::exception);
87-
// Not a multiple of 256 bits
88-
BOOST_CHECK_THROW(CruBar::setDataGeneratorSizeBits(bits, 257), std::exception);
89-
}
9063
}

test/TestParameters.cxx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ constexpr auto SERIAL_NUMBER = 1;
1818
constexpr auto CHANNEL_NUMBER = 2;
1919
//constexpr auto DMA_BUFFER_SIZE = 3ul;
2020
constexpr auto DMA_PAGE_SIZE = 4ul;
21-
constexpr auto GENERATOR_DATA_SIZE = 5ul;
2221
constexpr auto GENERATOR_ENABLED = true;
2322
constexpr auto GENERATOR_LOOPBACK_MODE = LoopbackMode::Internal;
2423

@@ -34,22 +33,19 @@ BOOST_AUTO_TEST_CASE(ParametersPutGetTest)
3433
{
3534
Parameters p = Parameters::makeParameters(SERIAL_NUMBER, CHANNEL_NUMBER)
3635
.setDmaPageSize(DMA_PAGE_SIZE)
37-
.setGeneratorDataSize(GENERATOR_DATA_SIZE)
3836
.setGeneratorEnabled(GENERATOR_ENABLED)
3937
.setGeneratorLoopback(GENERATOR_LOOPBACK_MODE)
4038
.setBufferParameters(buffer_parameters::File{ "/my/file.shm", 0 });
4139

4240
BOOST_REQUIRE(boost::get<int>(p.getCardId().get()) == SERIAL_NUMBER);
4341
BOOST_REQUIRE(p.getChannelNumber().get_value_or(0) == CHANNEL_NUMBER);
4442
BOOST_REQUIRE(p.getDmaPageSize().get_value_or(0) == DMA_PAGE_SIZE);
45-
BOOST_REQUIRE(p.getGeneratorDataSize().get_value_or(0) == GENERATOR_DATA_SIZE);
4643
BOOST_REQUIRE(p.getGeneratorEnabled().get_value_or(false) == GENERATOR_ENABLED);
4744
BOOST_REQUIRE(p.getGeneratorLoopback().get_value_or(LoopbackMode::None) == GENERATOR_LOOPBACK_MODE);
4845

4946
BOOST_REQUIRE(boost::get<int>(p.getCardIdRequired()) == SERIAL_NUMBER);
5047
BOOST_REQUIRE(p.getChannelNumberRequired() == CHANNEL_NUMBER);
5148
BOOST_REQUIRE(p.getDmaPageSizeRequired() == DMA_PAGE_SIZE);
52-
BOOST_REQUIRE(p.getGeneratorDataSizeRequired() == GENERATOR_DATA_SIZE);
5349
BOOST_REQUIRE(p.getGeneratorEnabledRequired() == GENERATOR_ENABLED);
5450
BOOST_REQUIRE(p.getGeneratorLoopbackRequired() == GENERATOR_LOOPBACK_MODE);
5551

0 commit comments

Comments
 (0)