Skip to content

Commit d2e87ac

Browse files
committed
added getCounterFirstOrbit()
1 parent 26ebdaa commit d2e87ac

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

include/ReadoutCard/DmaChannelInterface.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ class DmaChannelInterface
143143
/// Gets card unique ID, such as an FPGA chip ID in the case of the CRU
144144
/// \return A string containing the unique ID
145145
virtual boost::optional<std::string> getCardId() = 0;
146+
147+
/// Gets the first orbit received by CRU
148+
/// cf JIRA OMON-800
149+
/// \return orbit number, or -1 if not found.
150+
virtual int32_t getCounterFirstOrbit() {
151+
return -1;
152+
}
146153
};
147154

148155
} // namespace roc

src/Cru/CruDmaChannel.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,5 +481,18 @@ boost::optional<std::string> CruDmaChannel::getCardId()
481481
}
482482
}
483483

484+
int32_t CruDmaChannel::getCounterFirstOrbit() {
485+
int address = 0x0;
486+
int endpoint = getBar()->getEndpointNumber();
487+
if (endpoint == 0) {
488+
address = 0x64002C;
489+
} else if (endpoint == 1) {
490+
address = 0x74002C;
491+
} else {
492+
return -1;
493+
}
494+
return getBar2()->readRegister(address / 4);
495+
}
496+
484497
} // namespace roc
485498
} // namespace o2

src/Cru/CruDmaChannel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class CruDmaChannel final : public DmaChannelPdaBase
6262
virtual boost::optional<std::string> getCardId() override;
6363
AllowedChannels allowedChannels();
6464

65+
virtual int32_t getCounterFirstOrbit() override;
66+
6567
protected:
6668
virtual void deviceStartDma() override;
6769
virtual void deviceStopDma() override;

0 commit comments

Comments
 (0)