Skip to content

Commit 216bd82

Browse files
committed
[roc-loopback] Introduce loopback tool
1 parent 1b37e99 commit 216bd82

File tree

19 files changed

+798
-6
lines changed

19 files changed

+798
-6
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ add_subdirectory(doc)
2424
# Add compiler flags for warnings and debug symbols
2525
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror")
2626

27+
# Increase boost MPL maximum length to accommodate for a longer Parameters variant
28+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -DBOOST_MPL_LIMIT_LIST_SIZE=30")
29+
2730
# Set fPIC for all targets
2831
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2932

@@ -126,8 +129,11 @@ add_library(ReadoutCard SHARED
126129
src/ParameterTypes/Clock.cxx
127130
src/ParameterTypes/DatapathMode.cxx
128131
src/ParameterTypes/DownstreamData.cxx
132+
src/ParameterTypes/GbtCounterType.cxx
129133
src/ParameterTypes/GbtMode.cxx
130134
src/ParameterTypes/GbtMux.cxx
135+
src/ParameterTypes/GbtPatternMode.cxx
136+
src/ParameterTypes/GbtStatsMode.cxx
131137
src/ParameterTypes/Hex.cxx
132138
src/ParameterTypes/DataSource.cxx
133139
src/ParameterTypes/PciAddress.cxx
@@ -190,6 +196,7 @@ set(EXE_SRCS
190196
ProgramFlash.cxx
191197
ProgramFlashRead.cxx
192198
ProgramListCards.cxx
199+
ProgramLoopback.cxx
193200
ProgramMetrics.cxx
194201
ProgramPacketMonitor.cxx
195202
ProgramPatternPlayer.cxx
@@ -215,6 +222,7 @@ set(EXE_NAMES
215222
o2-roc-flash
216223
o2-roc-flash-read
217224
o2-roc-list-cards
225+
o2-roc-loopback
218226
o2-roc-metrics
219227
o2-roc-pkt-monitor
220228
o2-roc-pat-player
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file GbtCounterType.h
12+
/// \brief Definition of the GbtCounterType enum and supporting functions.
13+
///
14+
/// \author Kostas Alexopoulos ([email protected])
15+
16+
#ifndef O2_READOUTCARD_INCLUDE_CRU_GBTCOUNTERTYPE_H_
17+
#define O2_READOUTCARD_INCLUDE_CRU_GBTCOUNTERTYPE_H_
18+
19+
#include "ReadoutCard/NamespaceAlias.h"
20+
#include <string>
21+
22+
namespace o2
23+
{
24+
namespace roc
25+
{
26+
27+
/// Namespace for the ROC GBT counter type enum, and supporting functions
28+
struct GbtCounterType {
29+
enum type {
30+
ThirtyBit, // can't have enum identifiers starting with a digit
31+
EightBit,
32+
};
33+
34+
/// Converts a GbtCounterType to an int
35+
static std::string toString(const GbtCounterType::type& gbtCounterType);
36+
37+
/// Converts a string to a GbtCounterType
38+
static GbtCounterType::type fromString(const std::string& string);
39+
};
40+
41+
} // namespace roc
42+
} // namespace o2
43+
44+
#endif // O2_READOUTCARD_INCLUDE_CRU_GBTCOUNTERTYPE_H_
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file GbtPatternMode.h
12+
/// \brief Definition of the GbtPatternMode enum and supporting functions.
13+
///
14+
/// \author Kostas Alexopoulos ([email protected])
15+
16+
#ifndef O2_READOUTCARD_INCLUDE_CRU_GBTPATTERNMODE_H_
17+
#define O2_READOUTCARD_INCLUDE_CRU_GBTPATTERNMODE_H_
18+
19+
#include "ReadoutCard/NamespaceAlias.h"
20+
#include <string>
21+
22+
namespace o2
23+
{
24+
namespace roc
25+
{
26+
27+
/// Namespace for the ROC GBT pattern mode enum, and supporting functions
28+
struct GbtPatternMode {
29+
enum type {
30+
Counter,
31+
Static,
32+
};
33+
34+
/// Converts a GbtPatternMode to an int
35+
static std::string toString(const GbtPatternMode::type& gbtPatternMode);
36+
37+
/// Converts a string to a GbtPatternMode
38+
static GbtPatternMode::type fromString(const std::string& string);
39+
};
40+
41+
} // namespace roc
42+
} // namespace o2
43+
44+
#endif // O2_READOUTCARD_INCLUDE_CRU_GBTPATTERNMODE_H_
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file GbtStatsMode.h
12+
/// \brief Definition of the GbtStatsMode enum and supporting functions.
13+
///
14+
/// \author Kostas Alexopoulos ([email protected])
15+
16+
#ifndef O2_READOUTCARD_INCLUDE_CRU_GBTSTATSMODE_H_
17+
#define O2_READOUTCARD_INCLUDE_CRU_GBTSTATSMODE_H_
18+
19+
#include "ReadoutCard/NamespaceAlias.h"
20+
#include <string>
21+
22+
namespace o2
23+
{
24+
namespace roc
25+
{
26+
27+
/// Namespace for the ROC GBT stats mode enum, and supporting functions
28+
struct GbtStatsMode {
29+
enum type {
30+
Count,
31+
Fec,
32+
All
33+
};
34+
35+
/// Converts a GbtStatsMode to an int
36+
static std::string toString(const GbtStatsMode::type& gbtStatsMode);
37+
38+
/// Converts a string to a GbtStatsMode
39+
static GbtStatsMode::type fromString(const std::string& string);
40+
};
41+
42+
} // namespace roc
43+
} // namespace o2
44+
45+
#endif // O2_READOUTCARD_INCLUDE_CRU_GBTSTATSMODE_H_

include/ReadoutCard/Parameters.h

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
#include "ReadoutCard/ParameterTypes/Clock.h"
3535
#include "ReadoutCard/ParameterTypes/DatapathMode.h"
3636
#include "ReadoutCard/ParameterTypes/DownstreamData.h"
37+
#include "ReadoutCard/ParameterTypes/GbtCounterType.h"
3738
#include "ReadoutCard/ParameterTypes/GbtMode.h"
3839
#include "ReadoutCard/ParameterTypes/GbtMux.h"
40+
#include "ReadoutCard/ParameterTypes/GbtPatternMode.h"
41+
#include "ReadoutCard/ParameterTypes/GbtStatsMode.h"
3942

4043
namespace o2
4144
{
@@ -102,12 +105,26 @@ class Parameters
102105
/// Type for the downstream data parameter
103106
using DownstreamDataType = DownstreamData::type;
104107

105-
/// Type for the gbt mux parameter
106-
using GbtMuxType = GbtMux::type;
108+
/// Type for the gbt counter type parameter
109+
using GbtCounterTypeType = GbtCounterType::type;
107110

108111
/// Type for the gbt mode parameter
109112
using GbtModeType = GbtMode::type;
110113

114+
/// Type for the gbt mux parameter
115+
using GbtMuxType = GbtMux::type;
116+
117+
/// Type for the gbt pattern mode parameter
118+
using GbtPatternModeType = GbtPatternMode::type;
119+
120+
/// Type for the gbt stats mode parameter
121+
using GbtStatsModeType = GbtStatsMode::type;
122+
123+
/// Types for the gbt masks
124+
using GbtHighMaskType = uint32_t;
125+
using GbtMedMaskType = uint32_t;
126+
using GbtLowMaskType = uint32_t;
127+
111128
/// Type for the link loopback enabled parameter
112129
using LinkLoopbackEnabledType = bool;
113130

@@ -362,6 +379,15 @@ class Parameters
362379
/// \return Reference to this object for chaining calls
363380
auto setDownstreamData(DownstreamDataType value) -> Parameters&;
364381

382+
/// Sets the GbtCounterType Parameter
383+
///
384+
/// The GBT Counter Type parameter refers to the counter type used to collect loopback stats
385+
/// The GBT Counter Type may be 30 or 8 bit
386+
///
387+
/// \param value The value to set
388+
/// \return Reference to this object for chaining calls
389+
auto setGbtCounterType(GbtCounterTypeType value) -> Parameters&;
390+
365391
/// Sets the GbtMode Parameter
366392
///
367393
/// The GBT Mode parameter refers to the selection of the GBT Mode for the CRU configuration
@@ -388,6 +414,48 @@ class Parameters
388414
/// \return Reference to this object for chaining calls
389415
auto setGbtMuxMap(GbtMuxMapType value) -> Parameters&;
390416

417+
/// Sets the GbtPatternMode Parameter
418+
///
419+
/// The GBT Pattern Mode parameter refers to the pattern mode used to collect loopback stats
420+
/// The GBT Pattern Mode may be Counter or Static
421+
///
422+
/// \param value The value to set
423+
/// \return Reference to this object for chaining calls
424+
auto setGbtPatternMode(GbtPatternModeType value) -> Parameters&;
425+
426+
/// Sets the GbtStatsMode Parameter
427+
///
428+
/// The GBT Stats Mode parameter refers to the selection of the GBT Loopback Stats to be reported
429+
/// The GBT Stats Mode may be Counter, Fec, or All
430+
///
431+
/// \param value The value to set
432+
/// \return Reference to this object for chaining calls
433+
auto setGbtStatsMode(GbtStatsModeType value) -> Parameters&;
434+
435+
/// Sets the GbtHighMask Parameter
436+
///
437+
/// The GBT High mask parameter is used to report GBT loopback stats
438+
///
439+
/// \param value The value to set
440+
/// \return Reference to this object for chaining calls
441+
auto setGbtHighMask(GbtHighMaskType value) -> Parameters&;
442+
443+
/// Sets the GbtMedMask Parameter
444+
///
445+
/// The GBT Med mask parameter is used to report GBT loopback stats
446+
///
447+
/// \param value The value to set
448+
/// \return Reference to this object for chaining calls
449+
auto setGbtMedMask(GbtMedMaskType value) -> Parameters&;
450+
451+
/// Sets the GbtLowMask Parameter
452+
///
453+
/// The GBT Low mask parameter is used to report GBT loopback stats
454+
///
455+
/// \param value The value to set
456+
/// \return Reference to this object for chaining calls
457+
auto setGbtLowMask(GbtLowMaskType value) -> Parameters&;
458+
391459
/// Sets the StbrdEnabled parameter
392460
///
393461
/// If enabled the STBRD command is used to start the CRORC trigger.
@@ -517,6 +585,10 @@ class Parameters
517585
/// \return The value
518586
auto getDownstreamData() const -> boost::optional<DownstreamDataType>;
519587

588+
/// Gets the GbtCounterType Parameter
589+
/// \return The value
590+
auto getGbtCounterType() const -> boost::optional<GbtCounterTypeType>;
591+
520592
/// Gets the GbtMode Parameter
521593
/// \return The value
522594
auto getGbtMode() const -> boost::optional<GbtModeType>;
@@ -529,6 +601,26 @@ class Parameters
529601
/// \return The value
530602
auto getGbtMuxMap() const -> boost::optional<GbtMuxMapType>;
531603

604+
/// Gets the GbtPatternMode Parameter
605+
/// \return The value
606+
auto getGbtPatternMode() const -> boost::optional<GbtPatternModeType>;
607+
608+
/// Gets the GbtStatsMode Parameter
609+
/// \return The value
610+
auto getGbtStatsMode() const -> boost::optional<GbtStatsModeType>;
611+
612+
/// Gets the GbtHighMask Parameter
613+
/// \return The value
614+
auto getGbtHighMask() const -> boost::optional<GbtHighMaskType>;
615+
616+
/// Gets the GbtMedMask Parameter
617+
/// \return The value
618+
auto getGbtMedMask() const -> boost::optional<GbtMedMaskType>;
619+
620+
/// Gets the GbtLowMask Parameter
621+
/// \return The value
622+
auto getGbtLowMask() const -> boost::optional<GbtLowMaskType>;
623+
532624
/// Gets the StbrdEnabled parameter
533625
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
534626
auto getStbrdEnabled() const -> boost::optional<StbrdEnabledType>;
@@ -664,6 +756,11 @@ class Parameters
664756
/// \return The value
665757
auto getDownstreamDataRequired() const -> DownstreamDataType;
666758

759+
/// Gets the GbtCounterType Parameter
760+
/// \exception ParameterException The parameter was not present
761+
/// \return The value
762+
auto getGbtCounterTypeRequired() const -> GbtCounterTypeType;
763+
667764
/// Gets the GbtMode Parameter
668765
/// \exception ParameterException The parameter was not present
669766
/// \return The value
@@ -679,6 +776,31 @@ class Parameters
679776
/// \return The value
680777
auto getGbtMuxMapRequired() const -> GbtMuxMapType;
681778

779+
/// Gets the GbtPatternMode Parameter
780+
/// \exception ParameterException The parameter was not present
781+
/// \return The value
782+
auto getGbtPatternModeRequired() const -> GbtPatternModeType;
783+
784+
/// Gets the GbtStatsMode Parameter
785+
/// \exception ParameterException The parameter was not present
786+
/// \return The value
787+
auto getGbtStatsModeRequired() const -> GbtStatsModeType;
788+
789+
/// Gets the GbtHighMask Parameter
790+
/// \exception ParameterException The parameter was not present
791+
/// \return The value
792+
auto getGbtHighMaskRequired() const -> GbtHighMaskType;
793+
794+
/// Gets the GbtMedMask Parameter
795+
/// \exception ParameterException The parameter was not present
796+
/// \return The value
797+
auto getGbtMedMaskRequired() const -> GbtMedMaskType;
798+
799+
/// Gets the GbtLowMask Parameter
800+
/// \exception ParameterException The parameter was not present
801+
/// \return The value
802+
auto getGbtLowMaskRequired() const -> GbtLowMaskType;
803+
682804
/// Gets the StbrdEnabled parameter
683805
/// \exception ParameterException The parameter was not present
684806
/// \return The value

0 commit comments

Comments
 (0)