Skip to content

Commit dfccd07

Browse files
committed
[bench-dma] Add option to disable TF checks
1 parent f95d891 commit dfccd07

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ class ProgramDmaBench : public Program
201201
options.add_options()("bypass-fw-check",
202202
po::bool_switch(&mOptions.bypassFirmwareCheck),
203203
"Flag to bypass the firmware checker");
204+
options.add_options()("no-tf-check",
205+
po::bool_switch(&mOptions.noTimeFrameCheck),
206+
"Skip error checking");
207+
204208
}
205209

206210
virtual void run(const po::variables_map& map)
@@ -300,6 +304,11 @@ class ProgramDmaBench : public Program
300304
std::cout << "Maximum RDH packet counter " << mMaxRdhPacketCounter << std::endl;
301305
mTimeFrameLength = mOptions.timeFrameLength;
302306
std::cout << "TimeFrame length " << mTimeFrameLength << std::endl;
307+
if (mOptions.noTimeFrameCheck) {
308+
mTimeFrameCheckEnabled = false;
309+
std::cout << "TimeFrame check disabled" << std::endl;
310+
}
311+
303312
}
304313

305314
// Get DMA channel object
@@ -669,7 +678,9 @@ class ProgramDmaBench : public Program
669678
// Get initial data counter value from page
670679
if (mDataGeneratorCounters[linkId] == DATA_COUNTER_INITIAL_VALUE) {
671680
auto dataCounter = getDataGeneratorCounterFromPage(pageAddress, 0x0); // no header!
672-
mErrorStream << b::format("resync dataCounter for e:%d l:%d cnt:%x\n") % eventNumber % linkId % dataCounter;
681+
if (mErrorCount < MAX_RECORDED_ERRORS) {
682+
mErrorStream << b::format("resync dataCounter for e:%d l:%d cnt:%x\n") % eventNumber % linkId % dataCounter;
683+
}
673684
mDataGeneratorCounters[linkId] = dataCounter - 1; // -- so that the for loop offset incrementer logic is consistent
674685
}
675686

@@ -719,8 +730,10 @@ class ProgramDmaBench : public Program
719730
const auto packetCounter = DataFormat::getPacketCounter(reinterpret_cast<const char*>(pageAddress));
720731

721732
if (mPacketCounters[linkId] == PACKET_COUNTER_INITIAL_VALUE) {
722-
mErrorStream << b::format("resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x le:%d \n") % eventNumber % linkId % packetCounter %
723-
mPacketCounters[linkId] % mEventCounters[linkId];
733+
if (mErrorCount < MAX_RECORDED_ERRORS) {
734+
mErrorStream << b::format("resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x le:%d \n") % eventNumber % linkId % packetCounter %
735+
mPacketCounters[linkId] % mEventCounters[linkId];
736+
}
724737
mPacketCounters[linkId] = packetCounter;
725738
} else if (((mPacketCounters[linkId] + mErrorCheckFrequency) % (mMaxRdhPacketCounter + 1)) != packetCounter) { //packetCounter is 8bits long
726739
// log packet counter error
@@ -749,7 +762,9 @@ class ProgramDmaBench : public Program
749762
// Get counter value only if page is valid...
750763
const auto dataCounter = getDataGeneratorCounterFromPage(pageAddress, DataFormat::getHeaderSize());
751764
if (mDataGeneratorCounters[linkId] == DATA_COUNTER_INITIAL_VALUE) {
752-
mErrorStream << b::format("resync counter for e:%d l:%d cnt:%x\n") % eventNumber % linkId % dataCounter;
765+
if (mErrorCount < MAX_RECORDED_ERRORS) {
766+
mErrorStream << b::format("resync counter for e:%d l:%d cnt:%x\n") % eventNumber % linkId % dataCounter;
767+
}
753768
mDataGeneratorCounters[linkId] = dataCounter;
754769
}
755770
//const uint32_t dataCounter = mDataGeneratorCounters[linkId];
@@ -846,8 +861,10 @@ class ProgramDmaBench : public Program
846861
uint32_t packetCounter = DataFormat::getPacketCounter(reinterpret_cast<const char*>(pageAddress));
847862

848863
if (mPacketCounters[linkId] == PACKET_COUNTER_INITIAL_VALUE) {
849-
mErrorStream << b::format("resync packet counter for e%d l:%d packet_cnt:%x mpacket_cnt:%x, le:%d \n") % eventNumber % linkId % packetCounter %
850-
mPacketCounters[linkId] % mEventCounters[linkId];
864+
if (mErrorCount < MAX_RECORDED_ERRORS) {
865+
mErrorStream << b::format("resync packet counter for e%d l:%d packet_cnt:%x mpacket_cnt:%x, le:%d \n") % eventNumber % linkId % packetCounter %
866+
mPacketCounters[linkId] % mEventCounters[linkId];
867+
}
851868
mPacketCounters[linkId] = packetCounter;
852869
} else if (((mPacketCounters[linkId] + mErrorCheckFrequency) % (mMaxRdhPacketCounter + 1)) != packetCounter) {
853870
mErrorCount++;
@@ -859,7 +876,7 @@ class ProgramDmaBench : public Program
859876
mPacketCounters[linkId] = packetCounter;
860877
}
861878

862-
if (false && !checkTimeFrameAlignment(pageAddress, atStartOfSuperpage)) {
879+
if (mTimeFrameCheckEnabled && !checkTimeFrameAlignment(pageAddress, atStartOfSuperpage)) {
863880
// log TF not at the beginning of the superpage error
864881
mErrorCount++;
865882
if (mErrorCount < MAX_RECORDED_ERRORS) {
@@ -874,7 +891,9 @@ class ProgramDmaBench : public Program
874891
// Get counter value only if page is valid...
875892
const auto dataCounter = getDataGeneratorCounterFromPage(pageAddress, DataFormat::getHeaderSize());
876893
if (mDataGeneratorCounters[linkId] == DATA_COUNTER_INITIAL_VALUE) {
877-
mErrorStream << b::format("resync counter for e:%d l:%d cnt:%x\n") % eventNumber % linkId % dataCounter;
894+
if (mErrorCount < MAX_RECORDED_ERRORS) {
895+
mErrorStream << b::format("resync counter for e:%d l:%d cnt:%x\n") % eventNumber % linkId % dataCounter;
896+
}
878897
mDataGeneratorCounters[linkId] = dataCounter;
879898
}
880899

@@ -1172,6 +1191,7 @@ class ProgramDmaBench : public Program
11721191
bool bypassFirmwareCheck = false;
11731192
uint32_t timeFrameLength = 256;
11741193
bool printSuperpageChange = false;
1194+
bool noTimeFrameCheck = false;
11751195
} mOptions;
11761196

11771197
/// The DMA channel
@@ -1285,6 +1305,9 @@ class ProgramDmaBench : public Program
12851305

12861306
/// The orbit number that coincides with the next TimeFrame
12871307
uint32_t mTimeFrameLength = 0x0;
1308+
1309+
/// Flag for TF check
1310+
bool mTimeFrameCheckEnabled = true;
12881311
};
12891312

12901313
int main(int argc, char** argv)

0 commit comments

Comments
 (0)