@@ -66,7 +66,8 @@ CruBar::CruBar(const Parameters& parameters, std::unique_ptr<RocPciDevice> rocPc
6666 mGbtStatsMode(parameters.getGbtStatsMode().get_value_or(GbtStatsMode::All)),
6767 mGbtHighMask(parameters.getGbtHighMask().get_value_or(0xffffffff )),
6868 mGbtMedMask(parameters.getGbtMedMask().get_value_or(0xffffffff )),
69- mGbtLowMask(parameters.getGbtLowMask().get_value_or(0xffffffff ))
69+ mGbtLowMask(parameters.getGbtLowMask().get_value_or(0xffffffff )),
70+ mTimeFrameLength(parameters.getTimeFrameLength().get_value_or(0x100 ))
7071{
7172 if (getIndex () == 0 ) {
7273 mFeatures = parseFirmwareFeatures ();
@@ -540,6 +541,7 @@ Cru::ReportInfo CruBar::report(bool forConfig)
540541 bool runStatsEnabled = datapathWrapper.getLinkEnabled (runStatsLink);
541542
542543 bool userAndCommonLogicEnabled = datapathWrapper.getUserAndCommonLogicEnabled (mEndpoint );
544+ uint16_t timeFrameLength = getTimeFrameLength ();
543545
544546 Cru::ReportInfo reportInfo = {
545547 linkMap,
@@ -553,7 +555,8 @@ Cru::ReportInfo CruBar::report(bool forConfig)
553555 gbtEnabled,
554556 userLogicEnabled,
555557 runStatsEnabled,
556- userAndCommonLogicEnabled
558+ userAndCommonLogicEnabled,
559+ timeFrameLength
557560 };
558561
559562 return reportInfo;
@@ -703,6 +706,7 @@ void CruBar::configure(bool force)
703706 mUserAndCommonLogicEnabled == reportInfo.userAndCommonLogicEnabled &&
704707 mRunStatsEnabled == reportInfo.runStatsEnabled &&
705708 mGbtEnabled == reportInfo.gbtEnabled &&
709+ mTimeFrameLength == reportInfo.timeFrameLength &&
706710 !force) {
707711 log (" No need to reconfigure further" , LogInfoOps);
708712 return ;
@@ -823,6 +827,11 @@ void CruBar::configure(bool force)
823827 datapathWrapper.setDynamicOffset (mEndpoint , mDynamicOffset );
824828 }
825829
830+ if (mTimeFrameLength != reportInfo.timeFrameLength || force) {
831+ log (" Setting Time Frame length" , LogInfoDevel);
832+ setTimeFrameLength (mTimeFrameLength );
833+ }
834+
826835 log (" CRU configuration done" , LogInfoOps);
827836}
828837
@@ -1162,5 +1171,16 @@ std::map<int, Cru::LoopbackStats> CruBar::getGbtLoopbackStats(bool reset)
11621171 return gbt.getLoopbackStats (reset, mGbtPatternMode , mGbtCounterType , mGbtStatsMode , mGbtLowMask , mGbtMedMask , mGbtHighMask );
11631172}
11641173
1174+ uint16_t CruBar::getTimeFrameLength ()
1175+ {
1176+ uint32_t timeFrameLength = readRegister (Cru::Registers::TIME_FRAME_LENGTH.index );
1177+ return (uint16_t )Utilities::getBits (timeFrameLength, 12 , 20 );
1178+ }
1179+
1180+ void CruBar::setTimeFrameLength (uint16_t timeFrameLength)
1181+ {
1182+ modifyRegister (Cru::Registers::TIME_FRAME_LENGTH.index , 20 , 12 , timeFrameLength);
1183+ }
1184+
11651185} // namespace roc
11661186} // namespace o2
0 commit comments