@@ -146,13 +146,23 @@ bool Ttc::configurePonTx(uint32_t onuAddress)
146146 // TODO: Show calibration status..
147147}
148148
149- LinkStatus Ttc::getOnuStickyBit ()
150- {
151- uint32_t was = mBar ->readRegister (Cru::Registers::TTC_ONU_STICKY.index );
152- mBar ->modifyRegister (Cru::Registers::TTC_DATA.index , 28 , 1 , 0x1 );
153- mBar ->modifyRegister (Cru::Registers::TTC_DATA.index , 28 , 1 , 0x0 );
154- uint32_t is = mBar ->readRegister (Cru::Registers::TTC_ONU_STICKY.index );
155-
149+ // The monitoring parameter is set when roc-status is called through the monitoring infrastructure
150+ // this reports and clears a different register, so that clock information is not lost
151+ // from rogue invocations of roc-status
152+ LinkStatus Ttc::getOnuStickyBit (bool monitoring)
153+ {
154+ uint32_t was, is;
155+ if (monitoring) {
156+ was = mBar ->readRegister (Cru::Registers::TTC_ONU_STICKY_MON.index );
157+ mBar ->writeRegister (Cru::Registers::TTC_ONU_STICKY_MON.index , 0x1 );
158+ mBar ->writeRegister (Cru::Registers::TTC_ONU_STICKY_MON.index , 0x0 );
159+ is = mBar ->readRegister (Cru::Registers::TTC_ONU_STICKY_MON.index );
160+ } else {
161+ was = mBar ->readRegister (Cru::Registers::TTC_ONU_STICKY.index );
162+ mBar ->modifyRegister (Cru::Registers::TTC_DATA.index , 28 , 1 , 0x1 );
163+ mBar ->modifyRegister (Cru::Registers::TTC_DATA.index , 28 , 1 , 0x0 );
164+ is = mBar ->readRegister (Cru::Registers::TTC_ONU_STICKY.index );
165+ }
156166 if (was == 0x0 && is == 0x0 ) {
157167 return LinkStatus::Up;
158168 } else if (was != 0x0 && is == 0x0 ) {
@@ -161,7 +171,7 @@ LinkStatus Ttc::getOnuStickyBit()
161171 return LinkStatus::Down;
162172}
163173
164- OnuStatus Ttc::onuStatus ()
174+ OnuStatus Ttc::onuStatus (bool monitoring )
165175{
166176 uint32_t calStatus = mBar ->readRegister (Cru::Registers::ONU_USER_LOGIC.index + 0xc / 4 );
167177 uint32_t onuAddress = mBar ->readRegister (Cru::Registers::ONU_USER_LOGIC.index ) >> 1 ;
@@ -176,7 +186,7 @@ OnuStatus Ttc::onuStatus()
176186 (calStatus >> 5 & 0x1 ) == 1 ,
177187 (calStatus >> 6 & 0x1 ) == 1 ,
178188 (calStatus >> 7 & 0x1 ) == 1 ,
179- getOnuStickyBit (),
189+ getOnuStickyBit (monitoring ),
180190 getPonQuality (),
181191 getPonQualityStatus (),
182192 getPonRxPower ()
0 commit comments