Skip to content

Commit 664dc04

Browse files
authored
Merge pull request #412 from sy-c/master
new features
2 parents 0992bd5 + ca7fe20 commit 664dc04

File tree

9 files changed

+60
-3
lines changed

9 files changed

+60
-3
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,14 @@ metric format for the CRORC and the CRU is different, as different parameters ar
654654
| `"opticalPower"` | - | double |
655655
| `"systemId"` | 8-bit hex | string |
656656
| `"feeId"` | 12-bit hex | string |
657+
| `"glitchCounter"` | - | int |
658+
| `"fecCounter"` | - | int |
659+
| `"pktProcessed"` | - | int |
660+
| `"pktErrorProtocol"` | - | int |
661+
| `"pktErrorCheck1"` | - | int |
662+
| `"pktErrorCheck2"` | - | int |
663+
| `"pktErrorOversize"` | - | int |
664+
| `"orbitSor"` | - | int |
657665
658666
| Tag key | Value |
659667
| --------------------- | --------------------- |

doc/releaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ This file describes the main feature changes for released versions of ReadoutCar
4343

4444
## v0.42.3 - 28/04/2023
4545
- Fix for roc-status --monitoring: glitchCounter unsigned.
46+
47+
## next version
48+
- Added some (per link) counters for roc-status --monitoring: pktProcessed, pktErrorProtocol, pktErrorCheck1, pktErrorCheck2, pktErrorOversize, orbitSor

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ class ProgramStatus : public Program
394394

395395
float rxFreq = link.rxFreq;
396396
float txFreq = link.txFreq;
397-
uint32_t glitchCounter = link.glitchCounter;
398397
std::string fecCounter;
399398
if (mOptions.fec) {
400399
fecCounter = Utilities::toHexString(link.fecCounter);
@@ -427,8 +426,14 @@ class ProgramStatus : public Program
427426
.addValue(opticalPower, "opticalPower")
428427
.addValue(systemId, "systemId")
429428
.addValue(feeId, "feeId")
430-
.addValue((uint64_t)glitchCounter, "glitchCounter")
429+
.addValue((uint64_t)link.glitchCounter, "glitchCounter")
431430
.addValue((uint64_t)link.fecCounter, "fecCounter")
431+
.addValue((uint64_t)link.pktProcessed, "pktProcessed")
432+
.addValue((uint64_t)link.pktErrorProtocol, "pktErrorProtocol")
433+
.addValue((uint64_t)link.pktErrorCheck1, "pktErrorCheck1")
434+
.addValue((uint64_t)link.pktErrorCheck2, "pktErrorCheck2")
435+
.addValue((uint64_t)link.pktErrorOversize, "pktErrorOversize")
436+
.addValue((uint64_t)link.orbitSor, "orbitSor")
432437
.addTag(tags::Key::SerialId, card.serialId.getSerial())
433438
.addTag(tags::Key::Endpoint, card.serialId.getEndpoint())
434439
.addTag(tags::Key::CRU, card.sequenceId)
@@ -449,7 +454,7 @@ class ProgramStatus : public Program
449454
linkNode.put("opticalPower", Utilities::toPreciseString(opticalPower));
450455
linkNode.put("systemId", systemId);
451456
linkNode.put("feeId", feeId);
452-
linkNode.put("glitchCounter", glitchCounter);
457+
linkNode.put("glitchCounter", link.glitchCounter);
453458
if (mOptions.fec) {
454459
linkNode.put("fecCounter", fecCounter);
455460
}

src/Cru/Common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ struct Link {
7373
uint32_t feeId = 0x1f; // invalid, used as "unset" placeholder*/
7474
uint32_t glitchCounter = 0;
7575
uint32_t fecCounter = 0;
76+
uint32_t pktProcessed = 0;
77+
uint32_t pktErrorProtocol = 0;
78+
uint32_t pktErrorCheck1 = 0;
79+
uint32_t pktErrorCheck2 = 0;
80+
uint32_t pktErrorOversize = 0;
81+
uint32_t orbitSor = 0;
7682

7783
bool operator==(const Link& dlink) const
7884
{

src/Cru/Constants.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ static constexpr Register DWRAPPER_TRIGGER_SIZE(0x00000034);
327327
static constexpr Register DATALINK_PACKETS_REJECTED(0x00000008);
328328
static constexpr Register DATALINK_PACKETS_ACCEPTED(0x0000000c);
329329
static constexpr Register DATALINK_PACKETS_FORCED(0x00000010);
330+
static constexpr Register DATALINK_PACKETS_PROCESSED(0x00000014);
331+
static constexpr Register DATALINK_PACKETS_ERROR_PROTOCOL(0x00000018);
332+
static constexpr Register DATALINK_PACKETS_ERROR_CHECK1(0x0000001c);
333+
static constexpr Register DATALINK_PACKETS_ERROR_CHECK2(0x00000020);
334+
static constexpr Register DATALINK_PACKETS_ERROR_OVERSIZE(0x00000024);
335+
static constexpr Register DATALINK_ORBIT_SOR(0x00000028);
330336

331337
/// Registers to set the Flow Control
332338
static constexpr Register FLOW_CONTROL_OFFSET(0x000c0000);
@@ -373,6 +379,13 @@ static constexpr Register USER_LOGIC_EVSIZE_RAND(0x00c80008);
373379
static constexpr Register USER_LOGIC_SYSTEM_ID(0x00c8000c);
374380
static constexpr Register USER_LOGIC_LINK_ID(0x00c80010);
375381

382+
static constexpr Register USER_LOGIC_BASE0(0x0065E000);
383+
static constexpr Register USER_LOGIC_BASE1(0x0075E000);
384+
static constexpr Register USER_LOGIC_PACKETS_REJECTED(0x00000008);
385+
static constexpr Register USER_LOGIC_PACKETS_ACCEPTED(0x0000000c);
386+
static constexpr Register USER_LOGIC_PACKETS_FORCED(0x00000010);
387+
static constexpr Register USER_LOGIC_ORBIT_SOR(0x00000014);
388+
376389
/// Register to adjust the TimeFrame length (31 downto 20)
377390
static constexpr Register TIME_FRAME_LENGTH(0x00000c00);
378391

src/Cru/CruBar.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,12 @@ Cru::ReportInfo CruBar::report(bool forConfig)
513513
link.fecCounter = gbt.getFecCounter(link);
514514
link.systemId = datapathWrapper.getSystemId(link);
515515
link.feeId = datapathWrapper.getFeeId(link);
516+
link.pktProcessed = datapathWrapper.getLinkRegister(link, Cru::Registers::DATALINK_PACKETS_PROCESSED);
517+
link.pktErrorProtocol = datapathWrapper.getLinkRegister(link, Cru::Registers::DATALINK_PACKETS_ERROR_PROTOCOL);
518+
link.pktErrorCheck1 = datapathWrapper.getLinkRegister(link, Cru::Registers::DATALINK_PACKETS_ERROR_CHECK1);
519+
link.pktErrorCheck2 = datapathWrapper.getLinkRegister(link, Cru::Registers::DATALINK_PACKETS_ERROR_CHECK2);
520+
link.pktErrorOversize = datapathWrapper.getLinkRegister(link, Cru::Registers::DATALINK_PACKETS_ERROR_OVERSIZE);
521+
link.orbitSor = datapathWrapper.getLinkRegister(link, Cru::Registers::DATALINK_ORBIT_SOR);
516522

517523
if (link.enabled) {
518524
gbtEnabled = true;

src/Cru/DatapathWrapper.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ uint32_t DatapathWrapper::getForcedPackets(Link link)
262262
return mPdaBar->readRegister(address / 4);
263263
}
264264

265+
uint32_t DatapathWrapper::getLinkRegister(const Link link, const Register reg)
266+
{
267+
uint32_t address = getDatapathWrapperBaseAddress(link.dwrapper) +
268+
Cru::Registers::DATAPATHLINK_OFFSET.address +
269+
Cru::Registers::DATALINK_OFFSET.address * link.dwrapperId +
270+
reg.address;
271+
272+
return mPdaBar->readRegister(address / 4);
273+
}
274+
265275
/// size in gbt words
266276
void DatapathWrapper::setTriggerWindowSize(int wrapper, uint32_t size)
267277
{

src/Cru/DatapathWrapper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ class DatapathWrapper
6262
void setFeeId(Link link, uint32_t feeId);
6363
uint32_t getFeeId(Link link);
6464

65+
// generic function to retrieve given register for given link
66+
// (to avoid defining one getter function per register...)
67+
uint32_t getLinkRegister(const Link link, const Register reg);
68+
6569
private:
6670
uint32_t getDatapathWrapperBaseAddress(int wrapper);
6771

src/FirmwareChecker.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ FirmwareChecker::FirmwareChecker() : mCompatibleFirmwareList({
3333
{ "6838510f", "v3.17.0" },
3434
{ "8e74a7f8", "v3.17.1" },
3535
{ "9052c0dd", "v3.18.1" },
36+
{ "47df4106", "v3.19.0" },
37+
{ "adc37d07", "v3.19.0" },
3638
/* CRORC */
3739
{ "267f8e5", "v2.9.1" },
3840
{ "cecc295", "v2.9.0" },

0 commit comments

Comments
 (0)