Skip to content

Commit f7ca340

Browse files
committed
[roc-config] Update gbt mux registers
1 parent 234e49a commit f7ca340

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/Cru/CruBar.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ void CruBar::populateLinkMap(std::map<int, Link> &linkMap)
663663
} else { // Specific MUX not found
664664
link.gbtMux = mGbtMux;
665665
}
666-
gbt.setMux(link, link.gbtMux);
666+
gbt.setMux(el.first, link.gbtMux);
667667

668668
link.datapathMode = mDatapathMode;
669669
}

src/Cru/Gbt.cxx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ Gbt::Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::map<int, Link> &linkMap, int
3030
{
3131
}
3232

33-
void Gbt::setMux(Link link, uint32_t mux)
33+
void Gbt::setMux(int index, uint32_t mux)
3434
{
35-
uint32_t address = Cru::Registers::GBT_MUX_SELECT.address + (link.bank * 4);
36-
mPdaBar->modifyRegister(address/4, link.id*4, 2, mux);
35+
uint32_t reg = index / 16;
36+
uint32_t bitOffset = (index % 16) * 2;
37+
uint32_t address = Cru::Registers::GBT_MUX_SELECT.address + (reg * 4);
38+
mPdaBar->modifyRegister(address/4, bitOffset, 2, mux);
3739
}
3840

3941
void Gbt::setInternalDataGenerator(Link link, uint32_t value)
@@ -100,15 +102,20 @@ void Gbt::getGbtModes()
100102
void Gbt::getGbtMuxes()
101103
{
102104
for (auto& el: mLinkMap) {
105+
int index = el.first;
103106
auto& link = el.second;
104-
uint32_t txMux = mPdaBar->readRegister((Cru::Registers::GBT_MUX_SELECT.address + link.bank * 4)/4);
105-
txMux = (txMux >> (link.id*4)) & 0x3;
107+
uint32_t reg = (index / 16);
108+
uint32_t bitOffset = (index % 16) * 2;
109+
uint32_t txMux = mPdaBar->readRegister((Cru::Registers::GBT_MUX_SELECT.address + reg * 4)/4);
110+
txMux = (txMux >> bitOffset) & 0x3;
106111
if (txMux == Cru::GBT_MUX_TTC) {
107112
link.gbtMux = GbtMux::type::Ttc;
108113
} else if (txMux == Cru::GBT_MUX_DDG) {
109114
link.gbtMux = GbtMux::type::Ddg;
110115
} else if (txMux == Cru::GBT_MUX_SWT) {
111116
link.gbtMux = GbtMux::type::Swt;
117+
} else {
118+
link.gbtMux = GbtMux::type::Na;
112119
}
113120
}
114121
}

src/Cru/Gbt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Gbt {
3030
public:
3131
//Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::vector<Link> &mLinkList, int wrapperCount);
3232
Gbt(std::shared_ptr<Pda::PdaBar> pdaBar, std::map<int, Link> &mLinkMap, int wrapperCount);
33-
void setMux(Link link, uint32_t mux);
33+
void setMux(int link, uint32_t mux);
3434
void setInternalDataGenerator(Link link, uint32_t value);
3535
void setTxMode(Link link, uint32_t mode);
3636
void setRxMode(Link link, uint32_t mode);

0 commit comments

Comments
 (0)