Skip to content

Commit 0f7ff30

Browse files
committed
[cru] Add GBT MUX UL option
1 parent 3447258 commit 0f7ff30

File tree

7 files changed

+14
-9
lines changed

7 files changed

+14
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ The Parameters that affect the configuration of the CRU, their possible values (
151151

152152
`GbtMode (GBT | WB) [GBT]`
153153

154-
`GbtMux (TTC | DDG | SWT | TTCUP) [TTC]`
154+
`GbtMux (TTC | DDG | SWT | TTCUP |UL) [TTC]`
155155

156156
`LinkLoopbackEnabled (true | false) [false]`
157157

cru_template.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ systemId=0xfd
6969
# [true | false]
7070
enabled=true
7171

72-
# [TTC | DDG | SWT | TTCUP]
72+
# [TTC | DDG | SWT | TTCUP | UL]
7373
gbtMux=TTC
7474

7575
# 16-bit FEE ID

include/ReadoutCard/Cru.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static constexpr uint32_t GBT_MUX_TTC(0x0);
3838
static constexpr uint32_t GBT_MUX_DDG(0x1);
3939
static constexpr uint32_t GBT_MUX_SWT(0x2);
4040
static constexpr uint32_t GBT_MUX_TTCUP(0x3);
41+
static constexpr uint32_t GBT_MUX_UL(0x4);
4142

4243
static constexpr uint32_t GBT_MODE_GBT(0x0);
4344
static constexpr uint32_t GBT_MODE_WB(0x1);

include/ReadoutCard/ParameterTypes/GbtMux.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct GbtMux {
3131
Ddg = Cru::GBT_MUX_DDG,
3232
Swt = Cru::GBT_MUX_SWT,
3333
TtcUp = Cru::GBT_MUX_TTCUP,
34+
Ul = Cru::GBT_MUX_UL,
3435
Na = -1,
3536
};
3637

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ProgramConfig : public Program
6565
"GBT MODE [GBT, WB]");
6666
options.add_options()("gbtmux",
6767
po::value<std::string>(&mOptions.gbtMux)->default_value("TTC"),
68-
"GBT MUX [TTC, DDG, SWT, TTCUP]");
68+
"GBT MUX [TTC, DDG, SWT, TTCUP, UL]");
6969
options.add_options()("links",
7070
po::value<std::string>(&mOptions.links)->default_value("0"),
7171
"Links to enable");

src/Cru/Gbt.cxx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ void Gbt::setMux(int index, uint32_t mux)
3737
if (mEndpoint == 1) {
3838
index += 12;
3939
}
40-
uint32_t reg = index / 16;
41-
uint32_t bitOffset = (index % 16) * 2;
40+
uint32_t reg = index / 8;
41+
uint32_t bitOffset = (index % 8) * 4;
4242
uint32_t address = Cru::Registers::GBT_MUX_SELECT.address + (reg * 4);
43-
mPdaBar->modifyRegister(address / 4, bitOffset, 2, mux);
43+
mPdaBar->modifyRegister(address / 4, bitOffset, 4, mux);
4444
}
4545

4646
void Gbt::setInternalDataGenerator(Link link, uint32_t value)
@@ -111,10 +111,10 @@ void Gbt::getGbtMuxes()
111111
index += 12;
112112
}
113113
auto& link = el.second;
114-
uint32_t reg = (index / 16);
115-
uint32_t bitOffset = (index % 16) * 2;
114+
uint32_t reg = (index / 8);
115+
uint32_t bitOffset = (index % 8) * 4;
116116
uint32_t txMux = mPdaBar->readRegister((Cru::Registers::GBT_MUX_SELECT.address + reg * 4) / 4);
117-
txMux = (txMux >> bitOffset) & 0x3;
117+
txMux = (txMux >> bitOffset) & 0xf;
118118
if (txMux == Cru::GBT_MUX_TTC) {
119119
link.gbtMux = GbtMux::type::Ttc;
120120
} else if (txMux == Cru::GBT_MUX_DDG) {
@@ -123,6 +123,8 @@ void Gbt::getGbtMuxes()
123123
link.gbtMux = GbtMux::type::Swt;
124124
} else if (txMux == Cru::GBT_MUX_TTCUP) {
125125
link.gbtMux = GbtMux::type::TtcUp;
126+
} else if (txMux == Cru::GBT_MUX_UL) {
127+
link.gbtMux = GbtMux::type::Ul;
126128
} else {
127129
link.gbtMux = GbtMux::type::Na;
128130
}

src/ParameterTypes/GbtMux.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ static const auto converter = Utilities::makeEnumConverter<GbtMux::type>("GbtMux
2828
{ GbtMux::Ddg, "DDG" },
2929
{ GbtMux::Swt, "SWT" },
3030
{ GbtMux::TtcUp, "TTCUP" },
31+
{ GbtMux::Ul, "UL" },
3132
{ GbtMux::Na, "N/A" },
3233
});
3334

0 commit comments

Comments
 (0)