Skip to content

Commit 99a1b5c

Browse files
committed
Move some CRU constants under include/ReadoutCard/Cru.h
1 parent 98e7ac0 commit 99a1b5c

File tree

11 files changed

+83
-46
lines changed

11 files changed

+83
-46
lines changed

include/ReadoutCard/Cru.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/// \file Cru.h
2+
/// \brief Definitions of CRU related constants
3+
///
4+
/// \author Kostas Alexopoulos ([email protected])
5+
6+
#ifndef ALICEO2_INCLUDE_READOUTCARD_CRU_H_
7+
#define ALICEO2_INCLUDE_READOUTCARD_CRU_H_
8+
9+
#include <cstdint>
10+
11+
namespace AliceO2 {
12+
namespace roc {
13+
namespace Cru {
14+
15+
static constexpr uint32_t CLOCK_TTC(0x0);
16+
static constexpr uint32_t CLOCK_LOCAL(0x2);
17+
18+
static constexpr uint32_t DATA_CTP(0x0);
19+
static constexpr uint32_t DATA_PATTERN(0x1);
20+
static constexpr uint32_t DATA_MIDTRG(0x2);
21+
22+
static constexpr uint32_t GBT_MUX_TTC(0x0);
23+
static constexpr uint32_t GBT_MUX_DDG(0x1);
24+
static constexpr uint32_t GBT_MUX_SC(0x2);
25+
26+
static constexpr uint32_t GBT_MODE_GBT(0x0);
27+
static constexpr uint32_t GBT_MODE_WB(0x1);
28+
29+
static constexpr uint32_t GBT_PACKET(0x1);
30+
static constexpr uint32_t GBT_CONTINUOUS(0x0);
31+
32+
} // namespace Cru
33+
} // namespace roc
34+
} // namespace AliceO2
35+
36+
#endif // ALICEO2_INCLUDE_READOUTCARD_CRU_H_

include/ReadoutCard/ParameterTypes/Clock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ALICEO2_INCLUDE_READOUTCARD_CLOCK_H_
88

99
#include <string>
10-
#include <Cru/Constants.h>
10+
#include "ReadoutCard/Cru.h"
1111

1212
namespace AliceO2 {
1313
namespace roc {
@@ -17,8 +17,8 @@ struct Clock
1717
{
1818
enum type
1919
{
20-
Local = Cru::Registers::CLOCK_LOCAL,
21-
Ttc = Cru::Registers::CLOCK_TTC,
20+
Local = Cru::CLOCK_LOCAL,
21+
Ttc = Cru::CLOCK_TTC,
2222
};
2323

2424
/// Converts a Clock to a string

include/ReadoutCard/ParameterTypes/DatapathMode.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ALICEO2_INCLUDE_READOUTCARD_CRU_DATAPATHMODE_H_
88

99
#include <string>
10-
#include <Cru/Constants.h>
10+
#include "ReadoutCard/Cru.h"
1111

1212
namespace AliceO2 {
1313
namespace roc {
@@ -17,8 +17,8 @@ struct DatapathMode
1717
{
1818
enum type
1919
{
20-
Continuous = Cru::Registers::GBT_CONTINUOUS,
21-
Packet = Cru::Registers::GBT_PACKET,
20+
Continuous = Cru::GBT_CONTINUOUS,
21+
Packet = Cru::GBT_PACKET,
2222
};
2323

2424
/// Converts a DatapathMode to a string

include/ReadoutCard/ParameterTypes/DownstreamData.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ALICEO2_INCLUDE_READOUTCARD_CRU_DOWNSTREAMDATA_H_
88

99
#include <string>
10-
#include <Cru/Constants.h>
10+
#include "ReadoutCard/Cru.h"
1111

1212
namespace AliceO2 {
1313
namespace roc {
@@ -17,13 +17,13 @@ struct DownstreamData
1717
{
1818
enum type
1919
{
20-
Ctp = Cru::Registers::DATA_CTP,
21-
Pattern = Cru::Registers::DATA_PATTERN,
22-
Midtrg = Cru::Registers::DATA_MIDTRG,
20+
Ctp = Cru::DATA_CTP,
21+
Pattern = Cru::DATA_PATTERN,
22+
Midtrg = Cru::DATA_MIDTRG,
2323
};
2424

2525
/// Converts a DownstreamData to an int
26-
static std::string toString(const DownstreamData::type& gbtMux);
26+
static std::string toString(const DownstreamData::type& downstreamData);
2727

2828
/// Converts a string to a DownstreamData
2929
static DownstreamData::type fromString(const std::string& string);

include/ReadoutCard/ParameterTypes/GbtMode.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ALICEO2_INCLUDE_READOUTCARD_CRU_GBTMODE_H_
88

99
#include <string>
10-
#include <Cru/Constants.h>
10+
#include "ReadoutCard/Cru.h"
1111

1212
namespace AliceO2 {
1313
namespace roc {
@@ -17,12 +17,12 @@ struct GbtMode
1717
{
1818
enum type
1919
{
20-
Gbt = Cru::Registers::GBT_MODE_GBT,
21-
Wb = Cru::Registers::GBT_MODE_WB,
20+
Gbt = Cru::GBT_MODE_GBT,
21+
Wb = Cru::GBT_MODE_WB,
2222
};
2323

2424
/// Converts a GbtMode to an int
25-
static std::string toString(const GbtMode::type& gbtMux);
25+
static std::string toString(const GbtMode::type& gbtMode);
2626

2727
/// Converts a string to a GbtMode
2828
static GbtMode::type fromString(const std::string& string);

include/ReadoutCard/ParameterTypes/GbtMux.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define ALICEO2_INCLUDE_READOUTCARD_CRU_GBTMUX_H_
88

99
#include <string>
10-
#include <Cru/Constants.h>
10+
#include "ReadoutCard/Cru.h"
1111

1212
namespace AliceO2 {
1313
namespace roc {
@@ -17,9 +17,9 @@ struct GbtMux
1717
{
1818
enum type
1919
{
20-
Ttc = Cru::Registers::GBT_MUX_TTC,
21-
Ddg = Cru::Registers::GBT_MUX_DDG,
22-
Sc = Cru::Registers::GBT_MUX_SC,
20+
Ttc = Cru::GBT_MUX_TTC,
21+
Ddg = Cru::GBT_MUX_DDG,
22+
Sc = Cru::GBT_MUX_SC,
2323
};
2424

2525
/// Converts a GbtMux to an int

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,31 @@ class ProgramStatus: public Program
7272

7373
for (const auto& link : reportInfo.linkList) {
7474
int globalId = link.id + link.bank*6;
75-
std::string gbtTxMode = (link.gbtTxMode == Cru::Registers::GBT_MODE_WB ? "WB" : "GBT");
76-
std::string gbtRxMode = (link.gbtRxMode == Cru::Registers::GBT_MODE_WB ? "WB" : "GBT");
75+
std::string gbtTxMode = (link.gbtTxMode == Cru::GBT_MODE_WB ? "WB" : "GBT");
76+
std::string gbtRxMode = (link.gbtRxMode == Cru::GBT_MODE_WB ? "WB" : "GBT");
7777
std::string gbtTxRxMode = gbtTxMode + "/" + gbtRxMode;
7878
std::string loopback = (link.loopback == false ? "None" : "Enabled");
7979

8080
std::string downstreamData;
81-
if (reportInfo.downstreamData == Cru::Registers::DATA_CTP) {
81+
if (reportInfo.downstreamData == Cru::DATA_CTP) {
8282
downstreamData = "CTP";
83-
} else if (reportInfo.downstreamData == Cru::Registers::DATA_PATTERN) {
83+
} else if (reportInfo.downstreamData == Cru::DATA_PATTERN) {
8484
downstreamData = "PATTERN";
85-
} else if (reportInfo.downstreamData == Cru::Registers::DATA_MIDTRG) {
85+
} else if (reportInfo.downstreamData == Cru::DATA_MIDTRG) {
8686
downstreamData = "MIDTRG";
8787
}
8888

8989
std::string gbtMux;
90-
if (link.gbtMux == Cru::Registers::GBT_MUX_TTC) {
90+
if (link.gbtMux == Cru::GBT_MUX_TTC) {
9191
gbtMux = "TTC:" + downstreamData;
92-
} else if (link.gbtMux == Cru::Registers::GBT_MUX_DDG) {
92+
} else if (link.gbtMux == Cru::GBT_MUX_DDG) {
9393
gbtMux = "DDG";
94-
} else if (link.gbtMux == Cru::Registers::GBT_MUX_SC) {
94+
} else if (link.gbtMux == Cru::GBT_MUX_SC) {
9595
gbtMux = "SC";
9696
}
9797

9898
std::string datapathMode;
99-
if (link.datapathMode == Cru::Registers::GBT_PACKET) {
99+
if (link.datapathMode == Cru::GBT_PACKET) {
100100
datapathMode = "Packet";
101101
} else {
102102
datapathMode = "Continuous";

src/Cru/Constants.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/// \file Cru/Constants.h
2-
/// \brief Definitions of CRU related constants
2+
/// \brief Definitions of internal CRU related constants
33
///
44
/// \author Pascal Boeschoten ([email protected])
55
/// \author Kostas Alexopoulos ([email protected])
66

77
#ifndef ALICEO2_READOUTCARD_CRU_CONSTANTS_H_
88
#define ALICEO2_READOUTCARD_CRU_CONSTANTS_H_
99

10+
#include "ReadoutCard/Cru.h"
1011
#include "Register.h"
1112

1213
namespace AliceO2
@@ -153,13 +154,13 @@ static constexpr Register LOCAL_CLOCK(0x00240004);
153154
/// Register for locking the clock the the refclk
154155
static constexpr Register LOCK_CLOCK_TO_REF(0x00220000);
155156

156-
/// Register for modifying TTC parameters (e.g. Clock/Downstream Data)
157+
/// Register for modifying TTC parameters (CLOCK_/DATA_)
157158
static constexpr Register TTC_DATA(0x00200000);
158-
static constexpr uint32_t CLOCK_TTC(0x0);
159+
/*static constexpr uint32_t CLOCK_TTC(0x0);
159160
static constexpr uint32_t CLOCK_LOCAL(0x2);
160161
static constexpr uint32_t DATA_CTP(0x0);
161162
static constexpr uint32_t DATA_PATTERN(0x1);
162-
static constexpr uint32_t DATA_MIDTRG(0x2);
163+
static constexpr uint32_t DATA_MIDTRG(0x2);*/
163164

164165
/// Registers used for TTC calibration
165166
static constexpr Register PON_WRAPPER_PLL(0x00224000);
@@ -192,9 +193,9 @@ static constexpr Register GBT_LINK_SOURCE_SELECT(0x00000038);
192193

193194
/// Register for selecting the the GBT Multiplexer
194195
static constexpr Register GBT_MUX_SELECT(0x0000001c);
195-
static constexpr uint32_t GBT_MUX_TTC(0x0);
196+
/*static constexpr uint32_t GBT_MUX_TTC(0x0);
196197
static constexpr uint32_t GBT_MUX_DDG(0x1);
197-
static constexpr uint32_t GBT_MUX_SC(0x2);
198+
static constexpr uint32_t GBT_MUX_SC(0x2);*/
198199

199200
/// GBT registers to get Link and Wrapper parameters (e.g. count/links per bank)
200201
static constexpr Register GBT_LINK_XCVR_OFFSET(0x00001000);
@@ -207,8 +208,8 @@ static constexpr Register GBT_BANK_FPLL(0x0000e000);
207208
/// Registers to set TX and RX GBT modes
208209
static constexpr Register GBT_LINK_TX_CONTROL_OFFSET(0x00000034);
209210
static constexpr Register GBT_LINK_RX_CONTROL_OFFSET(0x00000040);
210-
static constexpr uint32_t GBT_MODE_GBT(0x0);
211-
static constexpr uint32_t GBT_MODE_WB(0x1);
211+
/*static constexpr uint32_t GBT_MODE_GBT(0x0);
212+
static constexpr uint32_t GBT_MODE_WB(0x1);*/
212213

213214

214215
//** DATAPATH WRAPPER **//
@@ -231,8 +232,8 @@ static constexpr Register DWRAPPER_MUX_CONTROL(0x00000004);
231232
static constexpr Register DATAPATHLINK_OFFSET(0x00040000);
232233
static constexpr Register DATALINK_OFFSET(0x00001000);
233234
static constexpr Register DATALINK_CONTROL(0x00000000);
234-
static constexpr uint32_t GBT_PACKET(0x1);
235-
static constexpr uint32_t GBT_CONTINUOUS(0x0);
235+
/*static constexpr uint32_t GBT_PACKET(0x1);
236+
static constexpr uint32_t GBT_CONTINUOUS(0x0);*/
236237

237238
/// Registers to set the Flow Control
238239
static constexpr Register FLOW_CONTROL_OFFSET(0x000c0000);

src/Cru/CruBar.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ void CruBar::configure()
470470
std::cout << "Configuring GBT" << std::endl;
471471
for (auto const& link: mLinkList) {
472472
gbt.setInternalDataGenerator(link, 0);
473-
gbt.setTxMode(link, Cru::Registers::GBT_MODE_GBT); //TX is always GBT
474-
gbt.setRxMode(link, mGbtMode); //RX may also be WB
473+
gbt.setTxMode(link, Cru::GBT_MODE_GBT); //TX is always GBT
474+
gbt.setRxMode(link, mGbtMode); //RX may also be WB
475475
gbt.setLoopback(link, mLoopback);
476476
}
477477

src/Cru/Gbt.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ void Gbt::getGbtModes()
7070
{
7171
for (auto& link: mLinkList) {
7272
uint32_t rxControl = mPdaBar->readRegister(getRxControlAddress(link)/4);
73-
if (((rxControl >> 8) & 0x1) == Cru::Registers::GBT_MODE_WB) { //TODO: Change with Constants
73+
if (((rxControl >> 8) & 0x1) == Cru::GBT_MODE_WB) { //TODO: Change with Constants
7474
link.gbtRxMode = GbtMode::type::Wb;
7575
} else {
7676
link.gbtRxMode = GbtMode::type::Gbt;
7777
}
7878

7979
uint32_t txControl = mPdaBar->readRegister(getTxControlAddress(link)/4);
80-
if (((txControl >> 8) & 0x1) == Cru::Registers::GBT_MODE_WB) { //TODO: Change with Constants
80+
if (((txControl >> 8) & 0x1) == Cru::GBT_MODE_WB) { //TODO: Change with Constants
8181
link.gbtTxMode = GbtMode::type::Wb;
8282
} else {
8383
link.gbtTxMode = GbtMode::type::Gbt;
@@ -89,11 +89,11 @@ void Gbt::getGbtMuxes()
8989
{
9090
for (auto& link: mLinkList) { uint32_t txMux = mPdaBar->readRegister((Cru::Registers::GBT_MUX_SELECT.address + link.bank * 4)/4);
9191
txMux = (txMux >> (link.id*4)) & 0x3;
92-
if (txMux == Cru::Registers::GBT_MUX_TTC) {
92+
if (txMux == Cru::GBT_MUX_TTC) {
9393
link.gbtMux = GbtMux::type::Ttc;
94-
} else if (txMux == Cru::Registers::GBT_MUX_DDG) {
94+
} else if (txMux == Cru::GBT_MUX_DDG) {
9595
link.gbtMux = GbtMux::type::Ddg;
96-
} else if (txMux == Cru::Registers::GBT_MUX_SC) {
96+
} else if (txMux == Cru::GBT_MUX_SC) {
9797
link.gbtMux = GbtMux::type::Sc;
9898
}
9999
}

0 commit comments

Comments
 (0)