diff --git a/CMakeLists.txt b/CMakeLists.txt index 32d5743b..bd128fee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ endif() # Define project project(ReadoutCard - VERSION 0.45.7 + VERSION 0.46.0 DESCRIPTION "O2 ReadoutCard library" LANGUAGES C CXX ) diff --git a/doc/releaseNotes.md b/doc/releaseNotes.md index 518eaddc..f889b170 100644 --- a/doc/releaseNotes.md +++ b/doc/releaseNotes.md @@ -93,3 +93,6 @@ This file describes the main feature changes for released versions of ReadoutCar ## v0.45.7 - 13/03/2025 - o2-roc-config: added (temporary) option --test-mode-ORC501 to enable testing of new firmware as described in [ORC-501](https://its.cern.ch/jira/browse/ORC-501). + +## v0.46.0 - 19/03/2025 +- class DmaChannelInterface: added getCounterFirstOrbit(), c.f. JIRA OMON-800 diff --git a/include/ReadoutCard/DmaChannelInterface.h b/include/ReadoutCard/DmaChannelInterface.h index 16ac0fdf..99846424 100644 --- a/include/ReadoutCard/DmaChannelInterface.h +++ b/include/ReadoutCard/DmaChannelInterface.h @@ -143,6 +143,13 @@ class DmaChannelInterface /// Gets card unique ID, such as an FPGA chip ID in the case of the CRU /// \return A string containing the unique ID virtual boost::optional getCardId() = 0; + + /// Gets the first orbit received by CRU + /// cf JIRA OMON-800 + /// \return orbit number, or -1 if not found. + virtual int32_t getCounterFirstOrbit() { + return -1; + } }; } // namespace roc diff --git a/src/Cru/CruDmaChannel.cxx b/src/Cru/CruDmaChannel.cxx index 287fc651..2dd4fe66 100644 --- a/src/Cru/CruDmaChannel.cxx +++ b/src/Cru/CruDmaChannel.cxx @@ -481,5 +481,18 @@ boost::optional CruDmaChannel::getCardId() } } +int32_t CruDmaChannel::getCounterFirstOrbit() { + int address = 0x0; + int endpoint = getBar()->getEndpointNumber(); + if (endpoint == 0) { + address = 0x64002C; + } else if (endpoint == 1) { + address = 0x74002C; + } else { + return -1; + } + return getBar2()->readRegister(address / 4); +} + } // namespace roc } // namespace o2 diff --git a/src/Cru/CruDmaChannel.h b/src/Cru/CruDmaChannel.h index 42c4f221..eb0604d1 100644 --- a/src/Cru/CruDmaChannel.h +++ b/src/Cru/CruDmaChannel.h @@ -62,6 +62,8 @@ class CruDmaChannel final : public DmaChannelPdaBase virtual boost::optional getCardId() override; AllowedChannels allowedChannels(); + virtual int32_t getCounterFirstOrbit() override; + protected: virtual void deviceStartDma() override; virtual void deviceStopDma() override;