Skip to content

Commit 7338e4c

Browse files
committed
[config] Take dynamic offset into account for reconfiguration
1 parent 79cf254 commit 7338e4c

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/Cru/Common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct ReportInfo {
8383
uint32_t ponStatusRegister;
8484
uint32_t onuAddress;
8585
uint16_t cruId;
86+
bool dynamicOffset;
8687
};
8788

8889
uint32_t getWrapperBaseAddress(int wrapper);

src/Cru/CruBar.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ Cru::ReportInfo CruBar::report()
428428
uint32_t ponStatusRegister = getPonStatusRegister();
429429
uint32_t onuAddress = getOnuAddress();
430430
uint16_t cruId = getCruId();
431+
bool dynamicOffset = datapathWrapper.getDynamicOffsetEnabled(0) && datapathWrapper.getDynamicOffsetEnabled(1); // should be enabled for both wrappers
431432

432433
Cru::ReportInfo reportInfo = {
433434
linkMap,
@@ -436,6 +437,7 @@ Cru::ReportInfo CruBar::report()
436437
ponStatusRegister,
437438
onuAddress,
438439
cruId,
440+
dynamicOffset,
439441
};
440442

441443
return reportInfo;
@@ -452,7 +454,8 @@ void CruBar::reconfigure()
452454
static_cast<uint32_t>(mDownstreamData) == reportInfo.downstreamData &&
453455
std::equal(mLinkMap.begin(), mLinkMap.end(), reportInfo.linkMap.begin()) &&
454456
checkPonUpstreamStatusExpected(reportInfo.ponStatusRegister, reportInfo.onuAddress) &&
455-
mCruId == reportInfo.cruId) { //TODO: Add the dynamic offset in reconfigure
457+
mCruId == reportInfo.cruId &&
458+
mDynamicOffset == reportInfo.dynamicOffset) {
456459
log("No need to reconfigure further");
457460
} else {
458461
log("Reconfiguring");

src/Cru/DatapathWrapper.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "Constants.h"
1717
#include "DatapathWrapper.h"
18+
#include "Utilities/Util.h"
1819

1920
namespace AliceO2
2021
{
@@ -189,5 +190,19 @@ void DatapathWrapper::setDynamicOffset(int wrapper, bool enable)
189190
}
190191
}
191192

193+
bool DatapathWrapper::getDynamicOffsetEnabled(int wrapper)
194+
{
195+
// Enable dynamic offset setting of the RDH (instead of fixed 0x2000)
196+
uint32_t address = getDatapathWrapperBaseAddress(wrapper) +
197+
Cru::Registers::DWRAPPER_GREGS.address +
198+
Cru::Registers::DWRAPPER_ENREG.address;
199+
200+
uint32_t value = mPdaBar->readRegister(address / 4);
201+
if (Utilities::getBit(value, 31) == 0x1) {
202+
return true;
203+
}
204+
return false;
205+
}
206+
192207
} // namespace roc
193208
} // namespace AliceO2

src/Cru/DatapathWrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class DatapathWrapper
4545
void useDataGeneratorSource(bool enable);
4646
void enableDataGenerator(bool enable);
4747
void setDynamicOffset(int wrapper, bool enable);
48+
bool getDynamicOffsetEnabled(int wrapper);
4849

4950
private:
5051
uint32_t getDatapathWrapperBaseAddress(int wrapper);

0 commit comments

Comments
 (0)