Skip to content

Commit f5d3a39

Browse files
committed
added FEC counter per link
1 parent f310a88 commit f5d3a39

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

doc/releaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ This file describes the main feature changes for released versions of ReadoutCar
2828
## next version
2929
- Added glitchCounter to roc-status (monitoring + JSON output).
3030
- Added DMA status (enabled / disabled) to roc-status (all output styles, including monitoring).
31+
- Added FEC counter per link to roc-status (stdout + JSON output).

src/Cru/Common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct Link {
7272
/*uint32_t systemId = 0x1ff; // invalid, used as "unset" placeholder
7373
uint32_t feeId = 0x1f; // invalid, used as "unset" placeholder*/
7474
uint32_t glitchCounter = 0;
75+
uint32_t fecCounter = 0;
7576

7677
bool operator==(const Link& dlink) const
7778
{

src/Cru/Constants.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ static constexpr Register GBT_LINK_TX_CLOCK(0x00000004);
257257
/// Register for getting the glitch counter
258258
static constexpr Register GBT_LINK_GLITCH_COUNTER(0x00000044);
259259

260+
/// Register for getting the FEC counter
261+
static constexpr Register GBT_LINK_FEC_COUNTER(0x0000001C);
262+
260263
/// Register for selecting the the GBT Multiplexer
261264
static constexpr Register GBT_MUX_SELECT(0x0000001c);
262265
/*static constexpr uint32_t GBT_MUX_TTC(0x0);

src/Cru/CruBar.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ Cru::ReportInfo CruBar::report(bool forConfig)
510510
link.rxFreq = gbt.getRxClockFrequency(link) / 1e6; // Hz -> Mhz
511511
link.txFreq = gbt.getTxClockFrequency(link) / 1e6; // Hz -> Mhz
512512
link.glitchCounter = gbt.getGlitchCounter(link);
513+
link.fecCounter = gbt.getFecCounter(link);
513514
link.systemId = datapathWrapper.getSystemId(link);
514515
link.feeId = datapathWrapper.getFeeId(link);
515516

src/Cru/Gbt.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,17 @@ uint32_t Gbt::getGlitchCounter(Link link)
326326
return mPdaBar->readRegister(address / 4);
327327
}
328328

329+
uint32_t Gbt::getFecCounter(Link link)
330+
{
331+
uint32_t address = Cru::getWrapperBaseAddress(link.wrapper) +
332+
Cru::Registers::GBT_WRAPPER_BANK_OFFSET.address * (link.bank + 1) +
333+
Cru::Registers::GBT_BANK_LINK_OFFSET.address * (link.id + 1) +
334+
Cru::Registers::GBT_LINK_REGS_OFFSET.address +
335+
Cru::Registers::GBT_LINK_FEC_COUNTER.address;
336+
337+
return mPdaBar->readRegister(address / 4);
338+
}
339+
329340
void Gbt::resetFifo()
330341
{
331342
mPdaBar->modifyRegister(Cru::Registers::BSP_USER_CONTROL.index, 7, 1, 0x1); // reset TX

src/Cru/Gbt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Gbt
5252
uint32_t getRxClockFrequency(Link link);
5353
uint32_t getTxClockFrequency(Link link);
5454
uint32_t getGlitchCounter(Link link);
55+
uint32_t getFecCounter(Link link);
5556
void resetFifo();
5657
std::map<int, LoopbackStats> getLoopbackStats(bool reset, GbtPatternMode::type patternMode = GbtPatternMode::type::Counter,
5758
GbtCounterType::type counterType = GbtCounterType::type::ThirtyBit,

0 commit comments

Comments
 (0)