Skip to content

Commit 8de6815

Browse files
committed
[roc-status] Adapt optical status to new endpoint link scheme
1 parent 9a4d5dd commit 8de6815

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Cru/CruBar.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ Cru::ReportInfo CruBar::report()
424424
}
425425

426426
// Update the link map with optical power information through I2C
427-
I2c i2c = I2c(Cru::Registers::BSP_I2C_MINIPODS.address, 0x0, mPdaBar);
427+
I2c i2c = I2c(Cru::Registers::BSP_I2C_MINIPODS.address, 0x0, mPdaBar, mEndpoint);
428428
i2c.getOpticalPower(linkMap);
429429

430430
Ttc ttc = Ttc(mPdaBar);

src/Cru/I2c.cxx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace roc
2828

2929
I2c::I2c(uint32_t baseAddress, uint32_t chipAddress,
3030
std::shared_ptr<Pda::PdaBar> pdaBar,
31+
int endpoint,
3132
std::vector<std::pair<uint32_t, uint32_t>> registerMap)
3233
: mI2cConfig(baseAddress),
3334
mI2cCommand(baseAddress + 0x4),
@@ -36,6 +37,7 @@ I2c::I2c(uint32_t baseAddress, uint32_t chipAddress,
3637
mChipAddressStart(0x0),
3738
mChipAddressEnd(0x7f),
3839
mPdaBar(pdaBar),
40+
mEndpoint(endpoint),
3941
mRegisterMap(registerMap)
4042
{
4143
}
@@ -226,17 +228,13 @@ void I2c::getOpticalPower(std::map<int, Link>& linkMap)
226228
* value 23 -> chip1 but link 23
227229
* ... */
228230

229-
int chipIndex = 11;
231+
int chipIndex = (mEndpoint == 0) ? 11 : 23;
230232
for (auto& el : linkMap) {
231233
auto& link = el.second;
232234
if (opticalPowers.empty()) { //Means no chip found
233235
link.opticalPower = 0.0;
234236
} else {
235237
link.opticalPower = opticalPowers[chipIndex--];
236-
237-
if (chipIndex == -1) {
238-
chipIndex = 23; //move to second chip
239-
}
240238
}
241239
}
242240

src/Cru/I2c.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class I2c
3333
public:
3434
I2c(uint32_t baseAddress, uint32_t chipAddress,
3535
std::shared_ptr<Pda::PdaBar> pdaBar,
36+
int endpoint = 0,
3637
std::vector<std::pair<uint32_t, uint32_t>> registerMap = {});
3738
~I2c();
3839

@@ -57,6 +58,7 @@ class I2c
5758
uint32_t mChipAddressEnd = 0x7f;
5859

5960
std::shared_ptr<Pda::PdaBar> mPdaBar;
61+
int mEndpoint = 0;
6062
std::vector<std::pair<uint32_t, uint32_t>> mRegisterMap;
6163
};
6264

src/Cru/Ttc.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ void Ttc::configurePlls(uint32_t clock)
5858
registerMap2 = getTtcClockPll2RegisterMap();
5959
}
6060

61-
I2c p1 = I2c(Cru::Registers::SI5345_1.address, chipAddress, mPdaBar, registerMap1);
62-
I2c p2 = I2c(Cru::Registers::SI5345_2.address, chipAddress, mPdaBar, registerMap2);
63-
I2c p3 = I2c(Cru::Registers::SI5344.address, chipAddress, mPdaBar, registerMap3);
61+
I2c p1 = I2c(Cru::Registers::SI5345_1.address, chipAddress, mPdaBar, 0, registerMap1);
62+
I2c p2 = I2c(Cru::Registers::SI5345_2.address, chipAddress, mPdaBar, 0, registerMap2);
63+
I2c p3 = I2c(Cru::Registers::SI5344.address, chipAddress, mPdaBar, 0, registerMap3);
6464

6565
p1.configurePll();
6666
p2.configurePll();

0 commit comments

Comments
 (0)