@@ -31,7 +31,9 @@ namespace roc
3131CrorcBar::CrorcBar (const Parameters& parameters, std::unique_ptr<RocPciDevice> rocPciDevice)
3232 : BarInterfaceBase(parameters, std::move(rocPciDevice)),
3333 mCrorcId (parameters.getCrorcId().get_value_or(0x0 )),
34- mDynamicOffset(parameters.getDynamicOffsetEnabled().get_value_or(false ))
34+ mDynamicOffset(parameters.getDynamicOffsetEnabled().get_value_or(false )),
35+ mTimeFrameLength(parameters.getTimeFrameLength().get_value_or(0x100 )),
36+ mTimeFrameDetectionEnabled(parameters.getTimeFrameDetectionEnabled().get_value_or(true ))
3537{
3638}
3739
@@ -73,6 +75,13 @@ void CrorcBar::configure(bool /*force*/)
7375 // set crorc id
7476 log (" Setting the CRORC ID" );
7577 setCrorcId (mCrorcId );
78+
79+ // set timeframe length
80+ log (" Setting the Time Frame length" );
81+ setTimeFrameLength (mTimeFrameLength );
82+
83+ log (" Configuring Time Frame detection" );
84+ setTimeFrameDetectionEnabled (mTimeFrameDetectionEnabled );
7685}
7786
7887Crorc::ReportInfo CrorcBar::report ()
@@ -82,8 +91,10 @@ Crorc::ReportInfo CrorcBar::report()
8291 Crorc::ReportInfo reportInfo = {
8392 linkMap,
8493 getCrorcId (),
94+ getTimeFrameLength (),
95+ getTimeFrameDetectionEnabled (),
8596 getQsfpEnabled (),
86- getDynamicOffsetEnabled ()
97+ getDynamicOffsetEnabled (),
8798 };
8899 return reportInfo;
89100}
@@ -138,6 +149,29 @@ bool CrorcBar::getDynamicOffsetEnabled()
138149 return (readRegister (Crorc::Registers::CFG_CONTROL.index ) & 0x1 );
139150}
140151
152+ void CrorcBar::setTimeFrameLength (uint16_t timeFrameLength)
153+ {
154+ if (timeFrameLength > 256 ) {
155+ BOOST_THROW_EXCEPTION (Exception () << ErrorInfo::Message (" BAD TF LENGTH, should be less or equal to 256" ) << ErrorInfo::ConfigValue (timeFrameLength));
156+ }
157+ modifyRegister (Crorc::Registers::CFG_CONTROL.index , 16 , 12 , timeFrameLength);
158+ }
159+
160+ uint16_t CrorcBar::getTimeFrameLength ()
161+ {
162+ return (readRegister (Crorc::Registers::CFG_CONTROL.index ) >> 16 ) & 0x0fff ;
163+ }
164+
165+ void CrorcBar::setTimeFrameDetectionEnabled (bool enabled)
166+ {
167+ modifyRegister (Crorc::Registers::CFG_CONTROL.index , 28 , 1 , enabled ? 0x1 : 0x0 );
168+ }
169+
170+ bool CrorcBar::getTimeFrameDetectionEnabled ()
171+ {
172+ return (readRegister (Crorc::Registers::CFG_CONTROL.index ) >> 28 ) & 0x1 ;
173+ }
174+
141175void CrorcBar::getOpticalPowers (std::map<int , Crorc::Link>& linkMap)
142176{
143177 for (auto & el : linkMap) {
0 commit comments