Skip to content

Commit da87736

Browse files
committed
[cru] Don't read the superpage size from the card twice
1 parent 2583b69 commit da87736

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,9 @@ class ProgramDmaBench : public Program
526526
}
527527

528528
if (readoutBytes > mSuperpageSize) {
529-
mDmaLoopBreak = true;
529+
mDmaLoopBreak = true; // Dump superpage somewhere
530+
mReadoutStream.open("RDH_CUMULATIVE_SP_SIZE_FAILURE.bin");
531+
mReadoutStream.write(reinterpret_cast<const char*>(superpageAddress), mSuperpageSize);
530532
BOOST_THROW_EXCEPTION(Exception() << ErrorInfo::Message("RDH reports cumulative dma page sizes that exceed the superpage size"));
531533
}
532534

@@ -604,6 +606,8 @@ class ProgramDmaBench : public Program
604606
if (mCardType == CardType::Cru && mDataSource != DataSource::Internal) {
605607
linkId = DataFormat::getLinkId(reinterpret_cast<const char*>(pageAddress));
606608
if (linkId >= mDataGeneratorCounters.size()) {
609+
mReadoutStream.open("LINK_ID_OUT_OF_RANGE.bin");
610+
mReadoutStream.write(reinterpret_cast<const char*>(pageAddress), mSuperpageSize);
607611
BOOST_THROW_EXCEPTION(Exception()
608612
<< ErrorInfo::Message("Link ID from superpage out of range")
609613
<< ErrorInfo::Index(linkId));

src/Cru/CruBar.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ uint32_t CruBar::getSuperpageSize(uint32_t link)
133133
writeRegister(Cru::Registers::LINK_SUPERPAGE_SIZE.get(link).index, 0xbadcafe); // write a dummy value to update the FIFO
134134
uint32_t superpageSizeFifo = readRegister(Cru::Registers::LINK_SUPERPAGE_SIZE.get(link).index);
135135
uint32_t superpageSize = Utilities::getBits(superpageSizeFifo, 0, 23); // [0-23] -> superpage size (in bytes)
136-
//uint32_t superpageIndex = Utilities::getBits(superpageSizeFifo, 24, 31); // [24-31] -> superpage index (0-255) for _testing_
136+
//uint32_t superpageIndex = Utilities::getBits(superpageSizeFifo, 24, 31); // [24-31] -> superpage index (0-255) _for testing_
137137

138138
return superpageSize;
139139
}
@@ -440,7 +440,7 @@ void CruBar::reconfigure()
440440
static_cast<uint32_t>(mDownstreamData) == reportInfo.downstreamData &&
441441
std::equal(mLinkMap.begin(), mLinkMap.end(), reportInfo.linkMap.begin()) &&
442442
checkPonUpstreamStatusExpected(reportInfo.ponStatusRegister, reportInfo.onuAddress) &&
443-
mCruId == reportInfo.cruId) {
443+
mCruId == reportInfo.cruId) { //TODO: Add the dynamic offset in reconfigure
444444
log("No need to reconfigure further");
445445
} else {
446446
log("Reconfiguring");

src/Cru/CruDmaChannel.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ void CruDmaChannel::transferSuperpageFromLinkToReady(Link& link)
279279
if (superpageSize == 0) { //backwards compatible in case the superpage size register is empty
280280
link.queue.front().setReceived(link.queue.front().getSize()); // force the full superpage size
281281
} else {
282-
link.queue.front().setReceived(getBar()->getSuperpageSize(link.id));
282+
link.queue.front().setReceived(superpageSize);
283283
}
284284
mReadyQueue.push_back(link.queue.front());
285285
link.queue.pop_front();

0 commit comments

Comments
 (0)