Skip to content

Commit ba5bf11

Browse files
committed
[cru] Proper GBT MUX handling per endpoint
1 parent de030fa commit ba5bf11

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/Cru/CruBar.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ Cru::ReportInfo CruBar::report()
410410

411411
bool gbtEnabled = false;
412412
// Update linkMap
413-
Gbt gbt = Gbt(mPdaBar, linkMap, mWrapperCount);
413+
Gbt gbt = Gbt(mPdaBar, linkMap, mWrapperCount, mEndpoint);
414414
gbt.getGbtModes();
415415
gbt.getGbtMuxes();
416416
gbt.getLoopbacks();
@@ -546,7 +546,7 @@ void CruBar::configure(bool force)
546546

547547
if (mGbtEnabled) {
548548
log("Calibrating the fPLLs");
549-
Gbt gbt = Gbt(mPdaBar, mLinkMap, mWrapperCount);
549+
Gbt gbt = Gbt(mPdaBar, mLinkMap, mWrapperCount, mEndpoint);
550550
gbt.calibrateGbt(mLinkMap);
551551
Cru::fpllref(mLinkMap, mPdaBar, 2);
552552
Cru::fpllcal(mLinkMap, mPdaBar);
@@ -704,7 +704,7 @@ void CruBar::populateLinkMap(std::map<int, Link>& linkMap)
704704
{
705705
linkMap = initializeLinkMap();
706706

707-
Gbt gbt = Gbt(mPdaBar, linkMap, mWrapperCount);
707+
Gbt gbt = Gbt(mPdaBar, linkMap, mWrapperCount, mEndpoint);
708708

709709
for (auto& el : linkMap) {
710710
auto& link = el.second;

src/Cru/Gbt.cxx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@ namespace roc
2525
using Link = Cru::Link;
2626
using LinkStatus = Cru::LinkStatus;
2727

28-
Gbt::Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::map<int, Link>& linkMap, int wrapperCount) : mPdaBar(pdaBar),
29-
mLinkMap(linkMap),
30-
mWrapperCount(wrapperCount)
28+
Gbt::Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::map<int, Link>& linkMap, int wrapperCount, int endpoint) : mPdaBar(pdaBar),
29+
mLinkMap(linkMap),
30+
mWrapperCount(wrapperCount),
31+
mEndpoint(endpoint)
3132
{
3233
}
3334

3435
void Gbt::setMux(int index, uint32_t mux)
3536
{
37+
if (mEndpoint == 1) {
38+
index += 12;
39+
}
3640
uint32_t reg = index / 16;
3741
uint32_t bitOffset = (index % 16) * 2;
3842
uint32_t address = Cru::Registers::GBT_MUX_SELECT.address + (reg * 4);
@@ -103,6 +107,9 @@ void Gbt::getGbtMuxes()
103107
{
104108
for (auto& el : mLinkMap) {
105109
int index = el.first;
110+
if (mEndpoint == 1) {
111+
index += 12;
112+
}
106113
auto& link = el.second;
107114
uint32_t reg = (index / 16);
108115
uint32_t bitOffset = (index % 16) * 2;

src/Cru/Gbt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Gbt
3434

3535
public:
3636
//Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::vector<Link> &mLinkList, int wrapperCount);
37-
Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::map<int, Link>& mLinkMap, int wrapperCount);
37+
Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::map<int, Link>& mLinkMap, int wrapperCount, int endpoint);
3838
void setMux(int link, uint32_t mux);
3939
void setInternalDataGenerator(Link link, uint32_t value);
4040
void setTxMode(Link link, uint32_t mode);
@@ -66,6 +66,7 @@ class Gbt
6666
std::shared_ptr<Pda::PdaBar> mPdaBar;
6767
std::map<int, Link>& mLinkMap;
6868
int mWrapperCount;
69+
int mEndpoint;
6970
};
7071
} // namespace roc
7172
} // namespace AliceO2

0 commit comments

Comments
 (0)